Skip to content
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
4 changes: 2 additions & 2 deletions .cruft.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"template": "https://github.com/scverse/cookiecutter-scverse",
"commit": "31733e798d89018e590c2586962c153d38057dad",
"commit": "9345e6250d37a482c0bed3ecfd2ffb082f123bc3",
"checkout": null,
"context": {
"cookiecutter": {
Expand Down Expand Up @@ -37,7 +37,7 @@
"trim_blocks": true
},
"_template": "https://github.com/scverse/cookiecutter-scverse",
"_commit": "31733e798d89018e590c2586962c153d38057dad"
"_commit": "9345e6250d37a482c0bed3ecfd2ffb082f123bc3"
}
},
"directory": null
Expand Down
29 changes: 29 additions & 0 deletions .github/workflows/autofix.yaml
Original file line number Diff line number Diff line change
@@ -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()'
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ buck-out/

# Compiled files
.venv/
uv.lock
__pycache__/
.*cache/

Expand Down
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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]
14 changes: 8 additions & 6 deletions docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand Down
21 changes: 11 additions & 10 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -41,7 +42,6 @@ entry-points."sphinx.html_themes".scverse = "scverse_doc.theme"

[dependency-groups]
dev = [
"prek",
"twine>=4.0.2",
]
test = [
Expand All @@ -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" ] },
Expand All @@ -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
Expand Down Expand Up @@ -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 = [
Expand Down
Empty file added src/scverse_doc/py.typed
Empty file.
Loading