Skip to content

Commit

Permalink
Merge pull request #105 from neutrinoceros/tst/uv_pip
Browse files Browse the repository at this point in the history
TST: speed up env resolution with uv
  • Loading branch information
neutrinoceros committed Jul 2, 2024
2 parents acd1cb6 + 7e6eb81 commit 3eca600
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 34 deletions.
21 changes: 11 additions & 10 deletions .github/workflows/bleeding-edge.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
19 changes: 10 additions & 9 deletions .github/workflows/build-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
31 changes: 16 additions & 15 deletions .github/workflows/wheels.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]
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
Expand Down Expand Up @@ -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
Expand Down
19 changes: 19 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

0 comments on commit 3eca600

Please sign in to comment.