Skip to content

Commit

Permalink
MNT: migrate requirement files to PEP 735 dependency groups
Browse files Browse the repository at this point in the history
  • Loading branch information
neutrinoceros committed Oct 30, 2024
1 parent 13e7e3e commit 5443a41
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 72 deletions.
9 changes: 0 additions & 9 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
version: 2
updates:
- package-ecosystem: pip
directory: /requirements
schedule:
interval: monthly
groups:
actions:
patterns:
- '*'

- package-ecosystem: github-actions
directory: /.github/workflows
schedule:
Expand Down
21 changes: 6 additions & 15 deletions .github/workflows/bleeding-edge.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ jobs:
matrix:
os:
- ubuntu-latest
- macos-latest
# excluding windows for lack of wheels at the tim of writing

runs-on: ${{ matrix.os }}
name: Test nightly dependencies
Expand All @@ -35,36 +33,29 @@ jobs:
with:
fetch-depth: 0

- name: Set up Python Dev Version
uses: actions/setup-python@v5
with:
python-version: 3.13-dev
- uses: astral-sh/setup-uv@v3
with:
enable-cache: true
cache-dependency-glob: |
**/requirements/tests.txt
**/pyproject.toml
- name: Install dependencies
run: |
uv venv
uv venv -p 3.13
uv pip install --pre --no-build numpy matplotlib \
--extra-index-url \
https://pypi.anaconda.org/scientific-python-nightly-wheels/simple \
--index-strategy=unsafe-best-match
- name: Build library
# forcing bytecode compilation for colorspacious
# see https://github.com/astral-sh/uv/issues/4758
run: |
uv pip install .
uv pip install --compile -r requirements/tests.txt
run: uv pip install .

- name: Run test suite
# forcing bytecode compilation for colorspacious
# see https://github.com/astral-sh/uv/issues/4758
run: |
source .venv/bin/activate
pytest --color yes --mpl-results-path=test_results
uv run --no-editable --compile-bytecode --group test \
pytest --color yes --mpl-results-path=test_results
- uses: actions/upload-artifact@v4
if: failure()
Expand Down
64 changes: 21 additions & 43 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,8 @@ jobs:
python-version: '3.13'
- os: windows-latest
python-version: '3.10'
venv-loc: Script
- os: windows-latest
python-version: '3.13'
venv-loc: Script
- os: ubuntu-20.04
python-version: '3.10'
# 2023-09-15 is numpy 1.26.0's release date
Expand All @@ -48,30 +46,23 @@ jobs:
with:
enable-cache: true
cache-dependency-glob: |
**/requirements/tests.txt
**/pyproject.toml
# forcing bytecode compilation for colorspacious
# see https://github.com/astral-sh/uv/issues/4758
- run: |
uv venv --python ${{ matrix.python-version }}
uv pip install --compile -r requirements/tests.txt ${{ matrix.install-args }}
- name: Build library
run: uv pip install . ${{ matrix.install-args }}
run: |
uv venv -p ${{ matrix.python-version }}
uv pip install . ${{ matrix.install-args }}
- run: uv pip list

- name: Run test suite (UNIX)
if: matrix.os != 'windows-latest'
run: |
source .venv/bin/activate
pytest --color yes -ra
- name: Run test suite (Windows)
if: matrix.os == 'windows-latest'
- name: Run test suite
shell: bash # for windows compat
# forcing bytecode compilation for colorspacious
# see https://github.com/astral-sh/uv/issues/4758
#
run: |
.venv/Scripts/activate
pytest --color yes -ra
uv run --no-editable --compile-bytecode --group test ${{ matrix.install-args }} \
pytest --color yes -ra
- uses: actions/upload-artifact@v4
if: failure()
with:
Expand All @@ -83,40 +74,29 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.x
- uses: astral-sh/setup-uv@v3
with:
enable-cache: true
cache-dependency-glob: |
**/requirements/tests.txt
**/pyproject.toml
- name: Build library
- name: Run Image Tests
# forcing bytecode compilation for colorspacious
# see https://github.com/astral-sh/uv/issues/4758
run: |
uv venv
uv pip install .
uv pip install --compile -r requirements/tests.txt
- name: Run Image Tests
run: |
source .venv/bin/activate
pytest --color=yes --mpl -m mpl_image_compare \
--mpl-generate-summary=html \
--mpl-results-path=pytest_mpl_results \
--mpl-baseline-path=tests/baseline
uv run -p 3.13 --no-editable --compile-bytecode --group test \
pytest --color=yes --mpl -m mpl_image_compare \
--mpl-generate-summary=html \
--mpl-results-path=pytest_mpl_results \
--mpl-baseline-path=tests/baseline
- name: Generate new image baseline
if: failure()
run: |
source .venv/bin/activate
pytest --color=yes --mpl -m mpl_image_compare \
--mpl-generate-path=pytest_mpl_new_baseline \
--last-failed
uv run --no-editable --group test \
pytest --color=yes --mpl -m mpl_image_compare \
--mpl-generate-path=pytest_mpl_new_baseline \
--last-failed
# always attempt to upload artifacts, even
# (and especially) in case of failure.
Expand Down Expand Up @@ -156,10 +136,8 @@ jobs:
with:
enable-cache: true
cache-dependency-glob: |
**/requirements/typecheck.txt
**/pyproject.toml
- name: Run mypy
run: |
uvx --python ${{ matrix.python-version }} \
--with-requirements=requirements/typecheck.txt --with . \
uv run -p ${{ matrix.python-version }} --no-editable --group typecheck \
mypy cmyt
10 changes: 10 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,16 @@ Homepage = "https://yt-project.org/"
Source = "https://github.com/yt-project/cmyt/"
Tracker = "https://github.com/yt-project/cmyt/issues"

[dependency-groups]
typecheck = [
"mypy>=1.11.2",
]
test = [
"colorspacious>=1.1.2",
"pytest-mpl>=0.13",
"pytest>=6.2.4",
]

[tool.ruff.lint]
exclude = ["*__init__.py"]
ignore = ["E501"]
Expand Down
3 changes: 0 additions & 3 deletions requirements/tests.txt

This file was deleted.

2 changes: 0 additions & 2 deletions requirements/typecheck.txt

This file was deleted.

0 comments on commit 5443a41

Please sign in to comment.