Skip to content

Commit

Permalink
Merge pull request #345 from neutrinoceros/tst/dep_locking
Browse files Browse the repository at this point in the history
TST: rewrite testing workflows around uv.lock
  • Loading branch information
neutrinoceros authored Dec 15, 2024
2 parents e8414f9 + b406475 commit 9ab135b
Show file tree
Hide file tree
Showing 7 changed files with 1,146 additions and 40 deletions.
20 changes: 8 additions & 12 deletions .github/workflows/bleeding-edge.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,22 +34,18 @@ jobs:
python-version: 3.13-dev

- uses: astral-sh/setup-uv@v4
with:
enable-cache: true
cache-dependency-glob: |
**/requirements/tests.txt
**/pyproject.toml
- name: Configure uv
run: |
echo "UV_PYTHON_PREFERENCE=only-system" >> $GITHUB_ENV
echo "UV_PYTHON=3.13" >> $GITHUB_ENV
echo "UV_PRERELEASE=allow" >> $GITHUB_ENV
echo "UV_EXTRA_INDEX_URL=https://pypi.anaconda.org/scientific-python-nightly-wheels/simple" >> $GITHUB_ENV
- name: Build
run: |
uv venv
uv sync --group test --extra HDF5 --no-editable
uv pip install git+https://github.com/yt-project/yt.git
uv pip install .
uv pip install --requirement requirements/tests.txt
- run: uv pip list
- name: Run Tests
run: |
source .venv/bin/activate
pytest --color=yes -ra
uv run --frozen --no-editable pytest --color=yes
36 changes: 12 additions & 24 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,42 +35,30 @@ jobs:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v4
with:
enable-cache: true
cache-dependency-glob: |
**/requirements/tests.txt
**/pyproject.toml
- name: Build
run: |
uv venv --python ${{ matrix.python-version }}
uv pip install . --no-deps
uv pip install --requirement pyproject.toml --no-build ${{ matrix.install-args }}
uv pip install --requirement requirements/tests.txt
- run: uv pip list
python-version: ${{ matrix.python-version }}

- name: run tests
run: |
source .venv/bin/activate
pytest --color=yes -ra
uv run --group test ${{ matrix.install-args }} \
pytest --color=yes
type-check:
runs-on: ubuntu-latest
name: type check

strategy:
matrix:
python-version:
- '3.10'
- '3.13'

steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v4
with:
enable-cache: true
cache-dependency-glob: |
**/requirements/typecheck.txt
**/pyproject.toml
python-version: ${{ matrix.python-version }}

- name: Run mypy
# Match minimal supported Python version
# to make sure we're not using unparseable syntax
- name: Typecheck
run: |
uvx --python 3.10 --with-requirements=requirements/typecheck.txt --with . \
mypy src/yt_idefix
uv run --frozen --group typecheck mypy src
5 changes: 5 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ repos:
- id: check-executables-have-shebangs
- id: check-toml

- repo: https://github.com/astral-sh/uv-pre-commit
rev: 0.5.8
hooks:
- id: uv-lock

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.6.9
hooks:
Expand Down
12 changes: 12 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,17 @@ Documentation = "https://yt-project.org/docs/dev/"
Source = "https://github.com/neutrinoceros/yt_idefix"
Tracker = "https://github.com/neutrinoceros/yt_idefix/issues"

[dependency-groups]
test = [
"more-itertools>=8.4.0",
"pyaml>=17.10.0",
"pytest>=7.0.0",
]

typecheck = [
"mypy>=1.13.0",
]

[tool.hatch.build.targets.sdist]
exclude = [".*"] # exclude dot files (.gitignore is still included)

Expand Down Expand Up @@ -103,6 +114,7 @@ warn_unreachable = true
show_error_context = true

[tool.pytest.ini_options]
addopts = "-ra"
filterwarnings = [
"error",
# already patched (but not released) upstream:
Expand Down
3 changes: 0 additions & 3 deletions requirements/tests.txt

This file was deleted.

1 change: 0 additions & 1 deletion requirements/typecheck.txt

This file was deleted.

Loading

0 comments on commit 9ab135b

Please sign in to comment.