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

TST: rewrite CI around uv.lock #181

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
9 changes: 3 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
enable-cache: true
cache-dependency-glob: pyproject.toml

- name: Set UV_RESOLUTION
if: ${{ matrix.oldestdeps }}
Expand All @@ -62,8 +61,9 @@ jobs:
- name: Test package (with coverage)
if: startsWith( matrix.os , 'ubuntu' )
# cannot use --frozen flag here because it would nullify UV_RESOLUTION
run: |
uv run --no-editable --group test --group covcheck \
uv run --group test --group covcheck \
coverage run --parallel-mode -m pytest --color=yes --mpl
- name: Upload coverage data
Expand Down Expand Up @@ -96,7 +96,7 @@ jobs:
run: |
uv run --no-project coverage combine
uv run --no-project coverage html --skip-covered --skip-empty
uv run --no-project coverage report --fail-under=100
uv run --no-project coverage report --fail-under=98
- name: Upload HTML report if check failed.
uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
Expand Down Expand Up @@ -126,7 +126,6 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
enable-cache: true
cache-dependency-glob: pyproject.toml

- name: Run mypy
run: uv run --no-editable --group typecheck mypy src/cmasher
Expand All @@ -145,7 +144,6 @@ jobs:
with:
python-version: '3.13'
enable-cache: true
cache-dependency-glob: pyproject.toml

- name: Build
run: |
Expand All @@ -166,7 +164,6 @@ jobs:
- uses: astral-sh/setup-uv@38f3f104447c67c051c4a08e39b64a148898af3a # v4.2.0
with:
enable-cache: true
cache-dependency-glob: pyproject.toml
- run: uv build
- run: uvx twine check dist/*
- run: uv run scripts/check_dist.py
Expand Down
41 changes: 20 additions & 21 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@ keywords = ["cmasher perceptually uniform sequential colormaps plotting python v
requires-python = ">=3.10, <4"

dependencies = [
"colorspacious>=1.1.0",
"colorspacious>=1.1.2",
"matplotlib>=3.5",
"numpy>=1.21.2, <2.2.0", # upper bound is temporary
"numpy>=1.21.2",
]

[project.urls]
Expand All @@ -51,19 +51,12 @@ test = [
"pytest>=8.1.1",
"pytest-mpl>=0.13.0",

# TODO: bump requirement and uncomment when the following upstream PR is merged and released:
# https://github.com/matplotlib/viscm/pull/82
# 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'",
#"viscm>=0.10 ; platform_system != 'Windows' and python_version > '3.10'",
]
covcheck = [
"coverage[toml]>=7.6.4 ; python_version < '3.11'",
Expand Down Expand Up @@ -110,9 +103,23 @@ filterwarnings = [
'ignore:datetime\.datetime\.utcfromtimestamp\(\) is deprecated:DeprecationWarning',
]

[tool.coverage.run]
# branch = true
source = [
"src/cmasher",
"tests",
]
omit = [
"scripts/*",
"src/cmasher/__version__*",
"src/cmasher/app_usage.py",
"src/cmasher/cli_tools.py",
"*_test_copy.py",
]

[tool.coverage.report]
show_missing = true
skip_covered = true
skip_covered = false
exclude_lines = [
# a more strict default pragma
"\\# pragma: no cover\\b",
Expand All @@ -127,14 +134,6 @@ exclude_lines = [
"-> ['\"]?NoReturn['\"]?:",
]

[tool.coverage.run]
omit = [
"scripts/*",
"src/cmasher/__version__*",
"src/cmasher/app_usage.py",
"*_test_copy.py",
]

[tool.ruff.lint]
ignore = [
"E501",
Expand Down
Loading
Loading