From ec404ff23cb8cc63353fd70da2f126c9ac8e323e Mon Sep 17 00:00:00 2001 From: Phil Schaf Date: Mon, 21 Sep 2026 11:58:49 +0200 Subject: [PATCH 1/2] chore: cruft update --- .cruft.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.cruft.json b/.cruft.json index 3390957..9a7fac7 100644 --- a/.cruft.json +++ b/.cruft.json @@ -1,6 +1,6 @@ { "template": "https://github.com/scverse/cookiecutter-scverse", - "commit": "31733e798d89018e590c2586962c153d38057dad", + "commit": "948ea324f7aa5f1f6b8b58a5e648e283a8e92fb4", "checkout": null, "context": { "cookiecutter": { @@ -37,7 +37,7 @@ "trim_blocks": true }, "_template": "https://github.com/scverse/cookiecutter-scverse", - "_commit": "31733e798d89018e590c2586962c153d38057dad" + "_commit": "948ea324f7aa5f1f6b8b58a5e648e283a8e92fb4" } }, "directory": null From 1f0f48cfa3c7851f385f06921a4e45e23d9f47d5 Mon Sep 17 00:00:00 2001 From: Phil Schaf Date: Mon, 21 Sep 2026 12:03:18 +0200 Subject: [PATCH 2/2] chore: cruft update --- .cruft.json | 4 ++-- .github/workflows/autofix.yaml | 29 +++++++++++++++++++++++++++++ .gitignore | 1 + .pre-commit-config.yaml | 8 ++++---- docs/contributing.md | 14 ++++++++------ pyproject.toml | 21 +++++++++++---------- src/scverse_doc/py.typed | 0 7 files changed, 55 insertions(+), 22 deletions(-) create mode 100644 .github/workflows/autofix.yaml create mode 100644 src/scverse_doc/py.typed diff --git a/.cruft.json b/.cruft.json index 9a7fac7..efd7265 100644 --- a/.cruft.json +++ b/.cruft.json @@ -1,6 +1,6 @@ { "template": "https://github.com/scverse/cookiecutter-scverse", - "commit": "948ea324f7aa5f1f6b8b58a5e648e283a8e92fb4", + "commit": "9345e6250d37a482c0bed3ecfd2ffb082f123bc3", "checkout": null, "context": { "cookiecutter": { @@ -37,7 +37,7 @@ "trim_blocks": true }, "_template": "https://github.com/scverse/cookiecutter-scverse", - "_commit": "948ea324f7aa5f1f6b8b58a5e648e283a8e92fb4" + "_commit": "9345e6250d37a482c0bed3ecfd2ffb082f123bc3" } }, "directory": null diff --git a/.github/workflows/autofix.yaml b/.github/workflows/autofix.yaml new file mode 100644 index 0000000..1ed0347 --- /dev/null +++ b/.github/workflows/autofix.yaml @@ -0,0 +1,29 @@ +# The workflow name is mandated by autofix.ci. +# It needs to be a dedicated workflow, as autofix.ci times out on long runs. +name: autofix.ci + +on: + pull_request: + branches: [main] + +permissions: + contents: read + +jobs: + lint: + name: Pre-commit checks + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + with: + fetch-depth: 0 + filter: blob:none + persist-credentials: false + - uses: astral-sh/setup-uv@20cfd1bf945f4377ade1205e4dbc17946fc9a30d # v10.0.1 + with: + enable-cache: true + - run: uv tool install hatch + - name: Run pre-commit hooks + run: uvx prek run --all-files --show-diff-on-failure --color=always + - uses: autofix-ci/action@c5b2d67aa2274e7b5a18224e8171550871fc7e4a # v1.3.4 + if: '!cancelled()' diff --git a/.gitignore b/.gitignore index 032590b..da69f80 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ buck-out/ # Compiled files .venv/ +uv.lock __pycache__/ .*cache/ diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e4b1b60..3f83aa7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -7,18 +7,18 @@ default_stages: minimum_pre_commit_version: 2.16.0 repos: - repo: https://github.com/biomejs/pre-commit - rev: v2.5.7 + rev: v2.5.11 hooks: - id: biome-format exclude: ^\.cruft\.json$ # inconsistent indentation with cruft - file never to be modified manually. groups: [format] - repo: https://github.com/tox-dev/pyproject-fmt - rev: v2.27.0 + rev: v2.29.2 hooks: - id: pyproject-fmt groups: [format] - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.16.2 + rev: v0.16.5 hooks: - id: ruff-check args: [--fix, --exit-non-zero-on-fix] @@ -53,7 +53,7 @@ repos: args: [--assume-in-merge] - repo: https://github.com/zizmorcore/zizmor-pre-commit - rev: v1.29.0 + rev: v1.30.0 hooks: - id: zizmor args: [--no-progress, --fix] diff --git a/docs/contributing.md b/docs/contributing.md index e2875bf..ea25db6 100644 --- a/docs/contributing.md +++ b/docs/contributing.md @@ -148,26 +148,28 @@ The `.venv` directory is typically automatically discovered by IDEs such as VS C ## Code-style -This package uses [pre-commit][]-style hooks to enforce consistent code-styles. -We recommend running them with [prek][], a fast, drop-in replacement for `pre-commit` that reads the same `.pre-commit-config.yaml`. +This package uses Git hooks to enforce consistent code-styles. +They are defined in `.pre-commit-config.yaml` and run with [prek][]. On every commit, the checks will either automatically fix issues with the code, or raise an error message. -To enable the checks locally, install [prek][] (e.g. with `uv tool install prek`) and run +To enable the checks locally, run ```bash -prek install +hatch run hatch-check-code:prek install +# or +uvx prek install ``` in the root of the repository. prek will automatically download all dependencies when it is run for the first time. -If you didn’t run the checks locally, the `Pre-commit checks` job of the GitHub Actions CI runs them on your pull request and reports any failures. +If you didn’t run the checks locally, the `Pre-commit checks` job of the GitHub Actions CI runs them on your pull request, +pushes the automatic fixes back to your branch, and reports any remaining failures. We strongly encourage installing and running the checks locally first to understand their usage. Finally, most editors have an _autoformat on save_ feature. Consider enabling this option for [ruff][ruff-editors] and [biome][biome-editors]. -[pre-commit]: https://pre-commit.com/ [prek]: https://prek.j178.dev/ [ruff-editors]: https://docs.astral.sh/ruff/integrations/ [biome-editors]: https://biomejs.dev/guides/integrate-in-editor/ diff --git a/pyproject.toml b/pyproject.toml index 5176a9e..5642bd1 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -23,6 +23,7 @@ classifiers = [ "Programming Language :: Python :: 3.12", "Programming Language :: Python :: 3.13", "Programming Language :: Python :: 3.14", + "Typing :: Typed", ] dependencies = [ "myst-nb>=1.1", @@ -41,7 +42,6 @@ entry-points."sphinx.html_themes".scverse = "scverse_doc.theme" [dependency-groups] dev = [ - "prek", "twine>=4.0.2", ] test = [ @@ -60,12 +60,21 @@ doc = [ typecheck = [ "mypy" ] [tool.hatch] +build.targets.sdist.exclude = [ "/docs", "/tests" ] envs.default.installer = "uv" envs.default.dependency-groups = [ "dev" ] envs.docs.scripts.build = "sphinx-build -M html docs docs/_build -W {args}" envs.docs.scripts.clean = "git clean -fdX -- {args:docs}" envs.docs.scripts.open = "python -m webbrowser -t docs/_build/html/index.html" envs.docs.dependency-groups = [ "doc" ] +envs.hatch-check-code.dependencies = [ "prek" ] +envs.hatch-check-code.scripts.lint-check = "echo 'try `hatch check code --fix`'; false" +envs.hatch-check-code.scripts.lint-fix = "prek run -a --no-group=format --no-group=typecheck" +envs.hatch-check-fmt.dependencies = [ "prek" ] +envs.hatch-check-fmt.scripts.format-check = "echo 'try `hatch check fmt --fix`'; false" +envs.hatch-check-fmt.scripts.format-fix = "prek run -a --group=format --no-group=typecheck" +envs.hatch-check-types.scripts.check = [ "mypy" ] +envs.hatch-check-types.dependency-groups = [ "typecheck", "doc", "test" ] envs.hatch-test.matrix = [ # Test the lowest and highest supported Python versions with normal deps { deps = [ "stable" ], python = [ "3.12", "3.14" ] }, @@ -78,14 +87,6 @@ envs.hatch-test.overrides.matrix.deps.env-vars = [ { value = "allow", key = "UV_PRERELEASE", if = [ "pre" ] }, ] envs.hatch-test.dependency-groups = [ "dev", "test" ] -envs.hatch-check-fmt.dependencies = [ "prek" ] -envs.hatch-check-fmt.scripts.format-check = "echo 'try `hatch check fmt --fix`'; false" -envs.hatch-check-fmt.scripts.format-fix = "prek run -a --group=format --no-group=typecheck" -envs.hatch-check-code.dependencies = [ "prek" ] -envs.hatch-check-code.scripts.lint-check = "echo 'try `hatch check code --fix`'; false" -envs.hatch-check-code.scripts.lint-fix = "prek run -a --no-group=format --no-group=typecheck" -envs.hatch-check-types.scripts.check = [ "mypy" ] -envs.hatch-check-types.dependency-groups = [ "typecheck", "doc", "test" ] [tool.ruff] line-length = 120 @@ -137,11 +138,11 @@ strict = true testpaths = [ "tests" ] [tool.coverage] +run.source = [ "scverse_doc" ] run.omit = [ "**/test_*.py", ] run.patch = [ "subprocess" ] -run.source = [ "scverse_doc" ] [tool.cruft] skip = [ diff --git a/src/scverse_doc/py.typed b/src/scverse_doc/py.typed new file mode 100644 index 0000000..e69de29