Skip to content
Open
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": "/home/runner/work/cookiecutter-scverse/cookiecutter-scverse",
"commit": "31733e798d89018e590c2586962c153d38057dad",
"commit": "ba8ba4359df21973a17be78d182f4a7361727098",
"checkout": null,
"context": {
"cookiecutter": {
Expand Down Expand Up @@ -37,7 +37,7 @@
"trim_blocks": true
},
"_template": "/home/runner/work/cookiecutter-scverse/cookiecutter-scverse",
"_commit": "31733e798d89018e590c2586962c153d38057dad"
"_commit": "ba8ba4359df21973a17be78d182f4a7361727098"
}
},
"directory": null
Expand Down
11 changes: 8 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,37 +11,42 @@ repos:
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.25.3
hooks:
- id: pyproject-fmt
groups: [format]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.22
hooks:
- id: ruff-check
types_or: [python, pyi, jupyter]
args: [--fix, --exit-non-zero-on-fix]
- id: ruff-format
types_or: [python, pyi, jupyter]
groups: [format]
- repo: local
hooks:
- id: mypy
name: mypy
entry: uv run --group test mypy src tests
entry: hatch check types
language: system
types: [python]
files: ^(src|tests)/
require_serial: true
pass_filenames: false
groups: [typecheck]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: detect-private-key
- id: check-ast
- id: end-of-file-fixer
groups: [format]
- id: mixed-line-ending
args: [--fix=lf]
groups: [format]
- id: trailing-whitespace
groups: [format]
- id: check-case-conflict
# Check that there are no merge conflicts (could be generated by template sync)
- id: check-merge-conflict
Expand Down
6 changes: 4 additions & 2 deletions docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,12 @@ We recommend running them with [prek][], a fast, drop-in replacement for `pre-co
On every commit, the checks will either automatically fix issues with the code, or raise an error message.
See [pre-commit checks](template_usage.md#pre-commit-checks) for a full list of checks enabled for this repository.

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.
Expand Down
2 changes: 1 addition & 1 deletion docs/template_usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ This template uses a number of pre-commit checks.
In this section we'll detail what is used, where they're defined, and how to modify these checks.

To run the checks locally, we recommend [prek][], a fast, drop-in replacement for `pre-commit` that reads the same `.pre-commit-config.yaml`.
Install it (e.g. with `uv tool install prek`) and run `prek install` once to set up the git hook, then `prek run --all-files` to check the whole repository.
Set up the git hook once by running `prek install` (e.g. `uvx prek install`), then `hatch check --fix` to format and check the whole repository.


### Overview of pre-commit hooks used by the template
Expand Down
15 changes: 13 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,6 @@ urls.Source = "https://github.com/scverse/cookiecutter-scverse-instance"

[dependency-groups]
dev = [
"mypy",
"prek",
"twine>=4.0.2",
]
test = [
Expand All @@ -57,6 +55,10 @@ doc = [
"sphinxcontrib-katex",
"sphinxext-opengraph",
]
typecheck = [
"mypy",
# add any stub packages that you might need here
]

[tool.hatch]
envs.default.installer = "uv"
Expand All @@ -77,6 +79,15 @@ 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-fix = "prek run -a --group=format --no-group=typecheck"
envs.hatch-check-code.dependencies = [ "prek" ]
envs.hatch-check-code.scripts.lint-fix = "prek run -a --no-group=format --no-group=typecheck"
envs.hatch-check-types.dependencies = [ "mypy" ]
envs.hatch-check-types.scripts.check = [ "mypy" ]

[tool.mypy]
files = [ "src", "tests" ]

[tool.ruff]
line-length = 120
Expand Down
Loading