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
5 changes: 3 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": "6cca9704e02edc716fa4665258aa2eb4518be78e",
"commit": "cb7f635331b7fbf10150a978f8e18b0e082aa8cd",
"checkout": null,
"context": {
"cookiecutter": {
Expand All @@ -13,6 +13,7 @@
"github_repo": "cookiecutter-scverse-instance",
"license": "BSD 3-Clause License",
"ide_integration": true,
"issue_categorization": "labels",
"_copy_without_render": [
".github/workflows/build.yaml",
".github/workflows/test.yaml",
Expand All @@ -36,7 +37,7 @@
"trim_blocks": true
},
"_template": "/home/runner/work/cookiecutter-scverse/cookiecutter-scverse",
"_commit": "6cca9704e02edc716fa4665258aa2eb4518be78e"
"_commit": "cb7f635331b7fbf10150a978f8e18b0e082aa8cd"
}
},
"directory": null
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Bug report
description: Report something that is broken or incorrect
type: Bug
labels: bug
body:
- type: markdown
attributes:
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Feature request
description: Propose a new feature for cookiecutter-scverse-instance
type: Enhancement
labels: enhancement
body:
- type: textarea
id: description
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ jobs:
needs: get-environments
permissions:
id-token: write # for codecov OIDC
contents: read

strategy:
fail-fast: false
Expand Down Expand Up @@ -80,12 +81,12 @@ jobs:
run: uvx hatch run ${{ matrix.env.name }}:run-cov -v --color=yes -n auto
- name: generate coverage report
run: |
# See https://coverage.readthedocs.io/en/latest/config.html#run-patch
# See https://coverage.readthedocs.io/page/config.html#run-patch
test -f .coverage || uvx hatch run ${{ matrix.env.name }}:cov-combine
uvx hatch run ${{ matrix.env.name }}:cov-report # report visibly
uvx hatch run ${{ matrix.env.name }}:coverage xml # create report for upload
- name: Upload coverage
uses: codecov/codecov-action@v5
uses: codecov/codecov-action@v6
with:
fail_ci_if_error: true
use_oidc: true
Expand Down
11 changes: 8 additions & 3 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ default_stages:
minimum_pre_commit_version: 2.16.0
repos:
- repo: https://github.com/biomejs/pre-commit
rev: v2.4.13
rev: v2.5.2
hooks:
- id: biome-format
exclude: ^\.cruft\.json$ # inconsistent indentation with cruft - file never to be modified manually.
- repo: https://github.com/tox-dev/pyproject-fmt
rev: v2.21.1
rev: v2.25.1
hooks:
- id: pyproject-fmt
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.15.12
rev: v0.15.20
hooks:
- id: ruff-check
types_or: [python, pyi, jupyter]
Expand All @@ -36,3 +36,8 @@ repos:
# Check that there are no merge conflicts (could be generated by template sync)
- id: check-merge-conflict
args: [--assume-in-merge]

- repo: https://github.com/zizmorcore/zizmor-pre-commit
rev: v1.24.1
hooks:
- id: zizmor
2 changes: 1 addition & 1 deletion .readthedocs.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# https://docs.readthedocs.io/en/stable/config-file/v2.html
# https://docs.readthedocs.io/page/config-file/v2.html
version: 2
build:
os: ubuntu-24.04
Expand Down
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog][],
and this project adheres to [Semantic Versioning][].

[keep a changelog]: https://keepachangelog.com/en/1.0.0/
[semantic versioning]: https://semver.org/spec/v2.0.0.html
[keep a changelog]: https://keepachangelog.com/
[semantic versioning]: https://semver.org/

## [Unreleased]

Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[![Documentation][badge-docs]][documentation]

[badge-tests]: https://img.shields.io/github/actions/workflow/status/scverse/cookiecutter-scverse-instance/test.yaml?branch=main
[badge-docs]: https://img.shields.io/readthedocs/cookiecutter-scverse-instance
[badge-docs]: https://app.readthedocs.org/projects/cookiecutter-scverse-instance/badge/

An example repo generated from the `cookiecutter-scverse` template.

Expand Down Expand Up @@ -52,6 +52,6 @@ If you found a bug, please use the [issue tracker][].
[issue tracker]: https://github.com/scverse/cookiecutter-scverse-instance/issues
[tests]: https://github.com/scverse/cookiecutter-scverse-instance/actions/workflows/test.yaml
[documentation]: https://cookiecutter-scverse-instance.readthedocs.io
[changelog]: https://cookiecutter-scverse-instance.readthedocs.io/en/latest/changelog.html
[api documentation]: https://cookiecutter-scverse-instance.readthedocs.io/en/latest/api.html
[changelog]: https://cookiecutter-scverse-instance.readthedocs.io/page/changelog.html
[api documentation]: https://cookiecutter-scverse-instance.readthedocs.io/page/api.html
[pypi]: https://pypi.org/project/cookiecutter-scverse-instance
6 changes: 3 additions & 3 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# https://www.sphinx-doc.org/page/usage/configuration.html

# -- Path setup --------------------------------------------------------------
import shutil
Expand Down Expand Up @@ -97,8 +97,8 @@

intersphinx_mapping = {
"python": ("https://docs.python.org/3", None),
"anndata": ("https://anndata.readthedocs.io/en/stable/", None),
"scanpy": ("https://scanpy.readthedocs.io/en/stable/", None),
"anndata": ("https://anndata.scverse.org/en/stable/", None),
"scanpy": ("https://scanpy.scverse.org/en/stable/", None),
"numpy": ("https://numpy.org/doc/stable/", None),
}

Expand Down
28 changes: 15 additions & 13 deletions docs/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ the [scientific Python tutorials][], or the [scanpy developer guide][].

[pyopensci tutorials]: https://www.pyopensci.org/learn.html
[scientific Python tutorials]: https://learn.scientific-python.org/development/tutorials/
[scanpy developer guide]: https://scanpy.readthedocs.io/en/latest/dev/index.html
[scanpy developer guide]: https://scanpy.scverse.org/page/dev/

:::{tip} The *hatch* project manager

Expand Down Expand Up @@ -138,21 +138,22 @@ The `.venv` directory is typically automatically discovered by IDEs such as VS C

## Code-style

This package uses [pre-commit][] to enforce consistent code-styles.
On every commit, pre-commit checks will either automatically fix issues with the code, or raise an error message.
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`.
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 pre-commit locally, simply run
To enable the checks locally, install [prek][] (e.g. with `uv tool install prek`) and run

```bash
pre-commit install
prek install
```

in the root of the repository.
Pre-commit will automatically download all dependencies when it is run for the first time.
prek will automatically download all dependencies when it is run for the first time.

Alternatively, you can rely on the [pre-commit.ci][] service enabled on GitHub.
If you didn’t run `pre-commit` before pushing changes to GitHub it will automatically commit fixes to your pull request, or show an error message.
If you didn’t run the checks before pushing changes to GitHub it will automatically commit fixes to your pull request, or show an error message.

If pre-commit.ci added a commit on a branch you still have been working on locally, simply use

Expand All @@ -161,12 +162,13 @@ git pull --rebase
```

to integrate the changes into yours.
While the [pre-commit.ci][] is useful, we strongly encourage installing and running pre-commit locally first to understand its usage.
While the [pre-commit.ci][] is useful, 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/
[pre-commit.ci]: https://pre-commit.ci/
[ruff-editors]: https://docs.astral.sh/ruff/integrations/
[biome-editors]: https://biomejs.dev/guides/integrate-in-editor/
Expand Down Expand Up @@ -275,11 +277,11 @@ This project uses [sphinx][] with the following features:

See scanpy’s {doc}`scanpy:dev/documentation` for more information on how to write your own.

[sphinx]: https://www.sphinx-doc.org/en/master/
[myst]: https://myst-parser.readthedocs.io/en/latest/intro.html
[myst-nb]: https://myst-nb.readthedocs.io/en/latest/
[numpydoc-napoleon]: https://www.sphinx-doc.org/en/master/usage/extensions/napoleon.html
[numpydoc]: https://numpydoc.readthedocs.io/en/latest/format.html
[sphinx]: https://www.sphinx-doc.org/
[myst]: https://myst-parser.readthedocs.io/page/intro.html
[myst-nb]: https://myst-nb.readthedocs.io/
[numpydoc-napoleon]: https://www.sphinx-doc.org/page/usage/extensions/napoleon.html
[numpydoc]: https://numpydoc.readthedocs.io/page/format.html
[sphinx-autodoc-typehints]: https://github.com/tox-dev/sphinx-autodoc-typehints

### Tutorials with myst-nb and jupyter notebooks
Expand Down
5 changes: 4 additions & 1 deletion docs/notebooks/example.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,10 @@
"\n",
"Again, check the raw markdown of this cell to see how each of these links are specified.\n",
"\n",
"You can read more about this in the [intersphinx page](https://www.sphinx-doc.org/en/master/usage/extensions/intersphinx.html) and the [myst page](https://myst-parser.readthedocs.io/en/v0.15.1/syntax/syntax.html#roles-an-in-line-extension-point)."
"You can read more about this in the [intersphinx page] and the [myst page].\n",
"\n",
"[intersphinx page]: https://www.sphinx-doc.org/page/usage/extensions/intersphinx.html\n",
"[myst page]: https://myst-parser.readthedocs.io/page/syntax/roles-and-directives.html#roles-an-in-line-extension-point"
]
},
{
Expand Down
18 changes: 11 additions & 7 deletions docs/template_usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ While the repository at this point can be directly used, there are few remaining

Modern Python package management uses a `pyproject.toml` that was first introduced in [PEP 518](https://peps.python.org/pep-0518/).
This file contains build system requirements and information, which are used by pip to build the package, and tool configurations.
For more details please have a look at [pip's description of the pyproject.toml file](https://pip.pypa.io/en/stable/reference/build-system/pyproject-toml/).
For more details please have a look at [pip's description of the pyproject.toml file](https://pip.pypa.io/page/reference/build-system/).
It also serves as a single point of truth to define test environments and how docs are built by leveraging
the [hatch][] project manager, but more about that in the [contributing guide](contributing.md).

Expand Down Expand Up @@ -113,10 +113,10 @@ On the RTD dashboard choose "Import a Project" and follow the instructions to ad
For more information, please refer to the [official RTD documentation][rtd-prs].

If your project is private, there are ways to enable docs rendering on [readthedocs.org][] but it is more cumbersome and requires a different RTD subscription.
See a guide [here](https://docs.readthedocs.io/en/stable/guides/importing-private-repositories.html).
See a guide [here](https://docs.readthedocs.io/page/guides/importing-private-repositories.html).

[readthedocs.org]: https://readthedocs.org/
[rtd-prs]: https://docs.readthedocs.io/en/stable/pull-requests.html
[rtd-prs]: https://docs.readthedocs.io/page/pull-requests.html

(github-actions)=

Expand Down Expand Up @@ -179,6 +179,9 @@ the project will be published only once you release your package for the first t
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.


### Pre-commit CI

Expand Down Expand Up @@ -299,8 +302,9 @@ add it to Ruff’s [`external = [...]`][ruff-external] setting to prevent `RUF10

[biome]: https://biomejs.dev/
[pre-commit]: https://pre-commit.com/
[prek]: https://prek.j178.dev/
[pre-commit.ci]: https://pre-commit.ci/
[pyproject-fmt]: https://pyproject-fmt.readthedocs.io/en/latest/index.html
[pyproject-fmt]: https://pyproject-fmt.readthedocs.io/
[ruff]: https://docs.astral.sh/ruff/
[ruff-config]: https://docs.astral.sh/ruff/configuration/
[ruff-error-suppression]: https://docs.astral.sh/ruff/linter/#error-suppression
Expand All @@ -322,7 +326,7 @@ there may also be good reasons to choose a different approach, e.g. using an obj

[anndata]: https://github.com/scverse/anndata
[mudata]: https://github.com/scverse/mudata
[scanpy-api]: https://scanpy.readthedocs.io/en/stable/usage-principles.html
[scanpy-api]: https://scanpy.scverse.org/page/usage-principles.html
[spatialdata]: https://github.com/scverse/spatialdata

(vcs-based-versioning)=
Expand Down Expand Up @@ -393,7 +397,7 @@ The following hints may be useful to work with the template sync:

If you prefer to check for and apply the pre-release template updates manually, or if you are working on a private repository not tracked by the bot, you can use cruft. Simply:

- Make sure cruft and pre-commit are installed.
- Make sure cruft and prek are installed.
- Make sure your git directory is clean (no unstaged/uncommitted files).
- Run `cruft update` in the root of your repository.

Expand All @@ -417,7 +421,7 @@ Here's one way how to do it:

```bash
mkdir template && cd template
uvx --with pre-commit cruft create https://github.com/scverse/cookiecutter-scverse
uvx --with prek cruft create https://github.com/scverse/cookiecutter-scverse
```

4. remove everything from the existing repo
Expand Down
14 changes: 7 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ urls.Source = "https://github.com/scverse/cookiecutter-scverse-instance"

[dependency-groups]
dev = [
"pre-commit",
"prek",
"twine>=4.0.2",
]
test = [
Expand All @@ -60,11 +60,10 @@ doc = [
[tool.hatch]
envs.default.installer = "uv"
envs.default.dependency-groups = [ "dev" ]
envs.docs.dependency-groups = [ "doc" ]
envs.docs.scripts.build = "sphinx-build -M html docs docs/_build -W {args}"
envs.docs.scripts.open = "python -m webbrowser -t docs/_build/html/index.html"
envs.docs.scripts.clean = "git clean -fdX -- {args:docs}"
envs.hatch-test.dependency-groups = [ "dev", "test" ]
envs.docs.scripts.open = "python -m webbrowser -t docs/_build/html/index.html"
envs.docs.dependency-groups = [ "doc" ]
envs.hatch-test.matrix = [
# Test the lowest and highest supported Python versions with normal deps
{ deps = [ "stable" ], python = [ "3.11", "3.14" ] },
Expand All @@ -74,8 +73,9 @@ envs.hatch-test.matrix = [
# If the matrix variable `deps` is set to "pre",
# set the environment variable `UV_PRERELEASE` to "allow".
envs.hatch-test.overrides.matrix.deps.env-vars = [
{ key = "UV_PRERELEASE", value = "allow", if = [ "pre" ] },
{ value = "allow", key = "UV_PRERELEASE", if = [ "pre" ] },
]
envs.hatch-test.dependency-groups = [ "dev", "test" ]

[tool.ruff]
line-length = 120
Expand Down Expand Up @@ -116,11 +116,11 @@ lint.per-file-ignores."tests/*" = [ "D" ]
lint.pydocstyle.convention = "numpy"

[tool.pytest]
strict = true
testpaths = [ "tests" ]
addopts = [
"--import-mode=importlib", # allow using test files with same name
]
strict = true
testpaths = [ "tests" ]

[tool.coverage]
run.omit = [
Expand Down