From 7e6eb81be9c8de9e8fbbe522de899628549156e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Robert?= Date: Tue, 2 Jul 2024 22:41:18 +0200 Subject: [PATCH] TST: speed up env resolution with uv --- .github/workflows/bleeding-edge.yaml | 21 ++++++++++--------- .github/workflows/build-test.yaml | 19 +++++++++-------- .github/workflows/wheels.yaml | 31 ++++++++++++++-------------- pyproject.toml | 19 +++++++++++++++++ 4 files changed, 56 insertions(+), 34 deletions(-) diff --git a/.github/workflows/bleeding-edge.yaml b/.github/workflows/bleeding-edge.yaml index 790ba10..bbd3b0b 100644 --- a/.github/workflows/bleeding-edge.yaml +++ b/.github/workflows/bleeding-edge.yaml @@ -26,30 +26,31 @@ jobs: steps: - name: Checkout repo uses: actions/checkout@v4 - - name: Set up Python (newest testable version) uses: actions/setup-python@v5 with: python-version: 3.12-dev + - uses: yezz123/setup-uv@v4 + with: + uv-version: 0.2.18 + uv-venv: .venv - name: Install dependencies run: | - python -m pip install --upgrade pip - python -m pip install --upgrade setuptools wheel - python -m pip install --pre --only-binary ":all:" numpy \ - --extra-index https://pypi.anaconda.org/scientific-python-nightly-wheels/simple - python -m pip install --pre Cython + uv pip install --upgrade setuptools wheel + uv pip install --pre --only-binary ":all:" numpy \ + --extra-index-url https://pypi.anaconda.org/scientific-python-nightly-wheels/simple + uv pip install --pre Cython - name: Build # --no-build-isolation is used to guarantee that build time dependencies # are not installed by pip as specified from pyproject.toml, hence we get # to use the dev version of numpy at build time. run: | - python setup.py build_ext -q -j2 - python -m pip install -e . --no-build-isolation - python -m pip install --upgrade --pre pytest + uv pip install -e . --no-build-isolation + uv pip install --upgrade --pre pytest - - run: python -m pip list + - run: uv pip list - name: Run Tests run: | diff --git a/.github/workflows/build-test.yaml b/.github/workflows/build-test.yaml index f78a888..a1b6e91 100644 --- a/.github/workflows/build-test.yaml +++ b/.github/workflows/build-test.yaml @@ -42,26 +42,27 @@ jobs: runs-on: ${{ matrix.os }} steps: + - name: Checkout repo + uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} - - name: Checkout repo - uses: actions/checkout@v4 + - uses: yezz123/setup-uv@v4 + with: + uv-version: 0.2.18 + uv-venv: .venv - - run: | - python -m pip install --upgrade pip - python -m pip install --requirement test_requirements.txt + - run: uv pip install --requirement test_requirements.txt - if: matrix.deps == 'minimal' run: | - pipx run uv pip compile pyproject.toml --resolution=lowest-direct > mindeps.txt - python -m pip install --requirement mindeps.txt + uv pip compile pyproject.toml --resolution=lowest-direct | uv pip install -r - - name: Build - run: python -m pip install --editable "." + run: uv pip install --editable "." - - run: python -m pip list + - run: uv pip list - name: Run Tests run: pytest --color=yes diff --git a/.github/workflows/wheels.yaml b/.github/workflows/wheels.yaml index 04b04e4..0ae6ec2 100644 --- a/.github/workflows/wheels.yaml +++ b/.github/workflows/wheels.yaml @@ -29,18 +29,18 @@ jobs: - name: Checkout repo uses: actions/checkout@v4 + - uses: yezz123/setup-uv@v4 + with: + uv-version: 0.2.18 + uv-venv: .venv + - name: Build wheels for CPython uses: pypa/cibuildwheel@v2.19.1 with: output-dir: dist env: - CIBW_BUILD: cp39-* cp310-* cp311-* cp312-* - CIBW_ARCHS_LINUX: x86_64 - MACOSX_DEPLOYMENT_TARGET: '10.9' # as of CIBW 2.9, this is the default value, pin it so it can't be bumped silently - CIBW_ARCHS_WINDOWS: auto64 - CIBW_BUILD_VERBOSITY: 1 CIBW_TEST_COMMAND: > - python -m pip install -r {project}/test_requirements.txt + uv pip install -r {project}/test_requirements.txt && pytest --pyargs ewah_bool_utils --color=yes - uses: actions/upload-artifact@v4 @@ -74,21 +74,22 @@ jobs: uses: actions/setup-python@v5 with: python-version: 3.x + - uses: yezz123/setup-uv@v4 + with: + uv-version: 0.2.18 + uv-venv: .venv - name: install check-manifest - run: | - python -m pip install --upgrade pip - python -m pip install check-manifest + run: uv pip install check-manifest - name: Install build time dependencies shell: bash run: | - python -m pip install "Cython>=3.0,<3.1" - python -m pip install oldest-supported-numpy - python -m pip install --upgrade wheel - python -m pip install --upgrade setuptools + uv pip install "Cython>=3.0,<3.1" + uv pip install oldest-supported-numpy + uv pip install --upgrade wheel + uv pip install --upgrade setuptools - name: Build shell: bash - run: | - python -m pip install --no-build-isolation . + run: uv pip install --no-build-isolation . - name: Init submodules uses: snickerbockers/submodules-init@v4 - name: run check-manifest diff --git a/pyproject.toml b/pyproject.toml index 66592a6..a2088ee 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -82,3 +82,22 @@ select = [ [tool.ruff.lint.isort] combine-as-imports = true + +[tool.cibuildwheel] +build = "cp39-* cp310-* cp311-* cp312-*" +build-frontend = "build[uv]" +build-verbosity = 1 +test-skip = "*-musllinux*" +test-command = [ + "uv pip install -r {project}/test_requirements.txt", + "pytest --pyargs {project} --color=yes -ra", +] + +[tool.cibuildwheel.linux] +archs = "x86_64" + +[tool.cibuildwheel.macos] +archs = "auto64" + +[tool.cibuildwheel.windows] +archs = "auto64"