|
| 1 | +# zarr-python developer task runner (https://github.com/casey/just). |
| 2 | +# |
| 3 | +# `just` is a thin verb-runner over uv; uv owns the environments. Each recipe is |
| 4 | +# the single source of truth for a dev/CI task — CI calls the same recipes (via |
| 5 | +# `uvx --from rust-just just <recipe>`), so local and CI behavior cannot drift. |
| 6 | +# |
| 7 | +# Install just: uv tool install rust-just (or `brew install just`, `cargo install just`) |
| 8 | +# List recipes: just (or `just --list`) |
| 9 | +# |
| 10 | +# The matrix lives in GitHub Actions; pass the Python version via UV_PYTHON |
| 11 | +# (setup-uv sets it from `python-version`). Locally, override per call, e.g. |
| 12 | +# UV_PYTHON=3.13 just test-optional |
| 13 | + |
| 14 | +# Extras + groups that make up the "optional" (full integration) test environment. |
| 15 | +optional_deps := "--extra remote --extra optional --extra cli --extra cast-value-rs --group remote-tests" |
| 16 | + |
| 17 | +[private] |
| 18 | +default: |
| 19 | + @just --list |
| 20 | + |
| 21 | +[doc("Run the unit tests with the minimal dependency set")] |
| 22 | +test-minimal *args: |
| 23 | + #!/usr/bin/env bash |
| 24 | + set -euo pipefail |
| 25 | + uv sync --locked --no-default-groups --group test |
| 26 | + if [ -n "${CI:-}" ]; then uv pip list; fi |
| 27 | + uv run --no-sync coverage run --source=src -m pytest --ignore tests/benchmarks \ |
| 28 | + --junitxml=junit.xml -o junit_family=legacy {{args}} |
| 29 | + uv run --no-sync coverage xml |
| 30 | +
|
| 31 | +[doc("Run the unit tests with the full (optional) integration dependency set")] |
| 32 | +test-optional *args: |
| 33 | + #!/usr/bin/env bash |
| 34 | + set -euo pipefail |
| 35 | + uv sync --locked --no-default-groups --group test {{optional_deps}} |
| 36 | + if [ -n "${CI:-}" ]; then uv pip list; fi |
| 37 | + uv run --no-sync coverage run --source=src -m pytest --ignore tests/benchmarks \ |
| 38 | + --junitxml=junit.xml -o junit_family=legacy {{args}} |
| 39 | + uv run --no-sync coverage xml |
| 40 | +
|
| 41 | +[doc("Generate an HTML coverage report (optional deps); open htmlcov/index.html")] |
| 42 | +coverage-html *args: |
| 43 | + #!/usr/bin/env bash |
| 44 | + set -euo pipefail |
| 45 | + uv sync --locked --no-default-groups --group test {{optional_deps}} |
| 46 | + uv run --no-sync coverage run --source=src -m pytest --ignore tests/benchmarks {{args}} |
| 47 | + uv run --no-sync coverage html |
| 48 | +
|
| 49 | +[doc("Run the slow Hypothesis property tests")] |
| 50 | +hypothesis *args: |
| 51 | + #!/usr/bin/env bash |
| 52 | + set -euo pipefail |
| 53 | + uv sync --locked --no-default-groups --group test {{optional_deps}} |
| 54 | + if [ -n "${CI:-}" ]; then uv pip list; fi |
| 55 | + uv run --no-sync coverage run --source=src -m pytest -nauto --run-slow-hypothesis \ |
| 56 | + tests/test_properties.py tests/test_store/test_stateful* {{args}} |
| 57 | + uv run --no-sync coverage xml |
| 58 | +
|
| 59 | +[doc("Validate executable code blocks in the docs (tests/test_docs.py)")] |
| 60 | +doctest *args: |
| 61 | + #!/usr/bin/env bash |
| 62 | + set -euo pipefail |
| 63 | + uv sync --locked --no-default-groups --extra remote --group remote-tests |
| 64 | + if [ -n "${CI:-}" ]; then uv pip list; fi |
| 65 | + uv run --no-sync --with pytest-examples pytest tests/test_docs.py -v {{args}} |
| 66 | +
|
| 67 | +[doc("Run the benchmark suite (minimal deps)")] |
| 68 | +benchmark *args: |
| 69 | + #!/usr/bin/env bash |
| 70 | + set -euo pipefail |
| 71 | + uv sync --locked --no-default-groups --group test |
| 72 | + uv run --no-sync pytest --benchmark-enable tests/benchmarks {{args}} |
| 73 | +
|
| 74 | +[doc("Run the tests against the lowest supported direct dependency versions")] |
| 75 | +min_deps *args: |
| 76 | + #!/usr/bin/env bash |
| 77 | + set -euo pipefail |
| 78 | + # uv derives the floors from the `>=` constraints in pyproject.toml. |
| 79 | + uv sync --resolution lowest-direct --no-default-groups \ |
| 80 | + --group test --group remote-tests --extra remote --extra optional |
| 81 | + if [ -n "${CI:-}" ]; then uv pip list; fi |
| 82 | + uv run --no-sync coverage run --source=src -m pytest --ignore tests/benchmarks \ |
| 83 | + --junitxml=junit.xml -o junit_family=legacy {{args}} |
| 84 | + uv run --no-sync coverage xml |
| 85 | +
|
| 86 | +[doc("Run the tests against bleeding-edge (nightly + git main) dependencies")] |
| 87 | +upstream *args: |
| 88 | + #!/usr/bin/env bash |
| 89 | + set -euo pipefail |
| 90 | + uv sync --no-default-groups --group test --group remote-tests --extra remote |
| 91 | + uv pip install --prerelease=allow \ |
| 92 | + --index https://pypi.anaconda.org/scientific-python-nightly-wheels/simple/ \ |
| 93 | + --extra-index-url https://pypi.org/simple/ \ |
| 94 | + numpy \ |
| 95 | + "packaging @ git+https://github.com/pypa/packaging" \ |
| 96 | + "numcodecs @ git+https://github.com/zarr-developers/numcodecs" \ |
| 97 | + "s3fs @ git+https://github.com/fsspec/s3fs" \ |
| 98 | + "universal_pathlib @ git+https://github.com/fsspec/universal_pathlib" \ |
| 99 | + "typing_extensions @ git+https://github.com/python/typing_extensions" \ |
| 100 | + "donfig @ git+https://github.com/pytroll/donfig" \ |
| 101 | + "obstore @ git+https://github.com/developmentseed/obstore@main#subdirectory=obstore" |
| 102 | + if [ -n "${CI:-}" ]; then uv pip list; fi |
| 103 | + uv run --no-sync coverage run --source=src -m pytest --ignore tests/benchmarks \ |
| 104 | + --junitxml=junit.xml -o junit_family=legacy {{args}} |
| 105 | + uv run --no-sync coverage xml |
| 106 | +
|
| 107 | +[doc("Run the GPU tests (requires CUDA + a GPU); `pytest -m gpu`")] |
| 108 | +gpu *args: |
| 109 | + #!/usr/bin/env bash |
| 110 | + set -euo pipefail |
| 111 | + uv sync --locked --no-default-groups --group test --extra gpu --extra optional |
| 112 | + uv pip install pytest-examples |
| 113 | + if [ -n "${CI:-}" ]; then uv pip list; fi |
| 114 | + uv run --no-sync coverage run --source=src -m pytest -m gpu --ignore tests/benchmarks \ |
| 115 | + --junitxml=junit.xml -o junit_family=legacy {{args}} |
| 116 | + uv run --no-sync coverage xml |
| 117 | +
|
| 118 | +[doc("Build the documentation (strict: warnings are errors)")] |
| 119 | +docs-build *args: |
| 120 | + #!/usr/bin/env bash |
| 121 | + set -euo pipefail |
| 122 | + uv sync --locked --no-default-groups --extra remote --group docs |
| 123 | + DISABLE_MKDOCS_2_WARNING=true NO_MKDOCS_2_WARNING=true \ |
| 124 | + uv run --no-sync mkdocs build --strict {{args}} |
| 125 | +
|
| 126 | +[doc("Serve the documentation locally with live reload at http://0.0.0.0:8000/")] |
| 127 | +docs-serve *args: |
| 128 | + #!/usr/bin/env bash |
| 129 | + set -euo pipefail |
| 130 | + uv sync --locked --no-default-groups --extra remote --group docs |
| 131 | + DISABLE_MKDOCS_2_WARNING=true NO_MKDOCS_2_WARNING=true \ |
| 132 | + uv run --no-sync mkdocs serve --watch src {{args}} |
| 133 | +
|
| 134 | +[doc("Run all pre-commit hooks (ruff, codespell, mypy, repo-review, ...)")] |
| 135 | +lint *args: |
| 136 | + prek run --all-files {{args}} |
| 137 | + |
| 138 | +[doc("Check that uv.lock is in sync with pyproject.toml")] |
| 139 | +lock-check: |
| 140 | + uv lock --check |
0 commit comments