Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MNT: migrate requirement files to PEP 735 dependency groups #183

Merged
merged 1 commit into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 9 additions & 26 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,25 +24,17 @@ jobs:
os:
- ubuntu-latest
- macos-latest
- windows-latest
python-version:
- '3.10'
- '3.11'
- '3.12'
- '3.13'
test-args: [viscm>=0.10]

include:
- os: ubuntu-20.04
python-version: '3.10'
oldestdeps: true
- os: windows-latest
python-version: '3.10'
- os: windows-latest
python-version: '3.11'
- os: windows-latest
python-version: '3.12'
- os: windows-latest
python-version: '3.13'

concurrency:
group: ${{ github.ref }}-${{ matrix.os }}-${{ matrix.python-version }}-build
Expand All @@ -61,22 +53,18 @@ jobs:
run: |
echo "UV_RESOLUTION=lowest-direct" >> $GITHUB_ENV

- name: Build
run: |
uv venv
uv pip install .
uv pip install -r requirements/dev.txt ${{ matrix.test-args }}

- run: uv pip list

- name: Test package (no coverage)
if: ${{ !startsWith( matrix.os , 'ubuntu' ) }}
run: uv run --no-editable pytest --color=yes --mpl
shell: bash # windows compat
run: |
uv run --no-editable --group test \
pytest --color=yes --mpl

- name: Test package (with coverage)
if: startsWith( matrix.os , 'ubuntu' )
run: |
uv run --no-editable coverage run --parallel-mode -m pytest --color=yes --mpl
uv run --no-editable --group test --group covcheck \
coverage run --parallel-mode -m pytest --color=yes --mpl

- name: Upload coverage data
# only using reports from ubuntu because
Expand All @@ -98,15 +86,12 @@ jobs:
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: astral-sh/setup-uv@38f3f104447c67c051c4a08e39b64a148898af3a # v4.2.0
- run: | # uv sync --only-group covcheck
uv venv
uv pip install -r requirements/dev.txt

- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
pattern: cmasher_coverage_data-*
merge-multiple: true

- run: uv sync --only-group covcheck
- name: Check coverage
run: |
uv run --no-project coverage combine
Expand Down Expand Up @@ -144,9 +129,7 @@ jobs:
cache-dependency-glob: pyproject.toml

- name: Run mypy
run: |
uvx --with-requirements=requirements/typecheck.txt --with . \
mypy src/cmasher
run: uv run --no-editable --group typecheck mypy src/cmasher

docs:
name: Build docs
Expand Down
32 changes: 30 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ requires-python = ">=3.10, <4"
dependencies = [
"colorspacious>=1.1.0",
"matplotlib>=3.5",
"numpy>=1.21.2",
"numpy>=1.21.2, <2.2.0", # upper bound is temporary
]

[project.urls]
Expand All @@ -45,6 +45,35 @@ Documentation = "https://cmasher.readthedocs.io"
[project.scripts]
cmr = "cmasher.cli_tools:main"

[dependency-groups]
test = [
"pyqt5>=5.15.6",
"pytest>=8.1.1",
"pytest-mpl>=0.13.0",

# TODO: lift the constraint on python_version:
# only tests with minimal requirements fail, but that's probably solved by
# requiring a more recent version of other dependencies (colorspacious or numpy)
"viscm>=0.10 ; platform_system != 'Windows' and python_version > '3.10'",

# TODO: move these constraints to a lockfile
# or even drop them if possible
# context: PyQt5-Qt5 is a required dependency to pyqt5 but
# it only comes in wheels. 5.15.2 is the only version with windows wheels,
# and *that* version doesn't have macOS arm64 wheels.
# 5.15.14 is the first version with wheels for both Linux and MacOS+arm64
"PyQt5-Qt5==5.15.2 ; platform_system == 'Windows'",
"PyQt5-Qt5>=5.15.14 ; platform_system != 'Windows'",
]
covcheck = [
"coverage[toml]>=7.6.4 ; python_version < '3.11'",
"coverage>=7.6.4 ; python_version >= '3.11'",
]
typecheck = [
"mypy==1.7.1",
"pytest==8.1.1",
]

[tool.hatch.build.targets.sdist]
include = [
"src/cmasher/*.py",
Expand All @@ -54,7 +83,6 @@ include = [
"LICENSE",
"CITATION",
"README.rst",
"requirements/*.txt",
"conftest.py",
"tests",
]
Expand Down
4 changes: 0 additions & 4 deletions requirements/dev.txt

This file was deleted.

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

This file was deleted.

Loading