Skip to content

Commit e0926ca

Browse files
authored
build: sync with cookiecutter-scverse template, adopt mypy (#2577)
Co-authored-by: Philipp A. <flying-sheep@web.de>
1 parent 318c93b commit e0926ca

98 files changed

Lines changed: 3081 additions & 1876 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.cruft.json

Lines changed: 42 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,44 @@
11
{
2-
"template": "https://github.com/scverse/cookiecutter-scverse",
3-
"commit": "d383d94fadff9e4e6fdb59d77c68cb900d7cedec",
4-
"checkout": "v0.6.0",
5-
"context": {
6-
"cookiecutter": {
7-
"project_name": "anndata",
8-
"package_name": "anndata",
9-
"project_description": "Annotated data.",
10-
"author_full_name": "Philipp Angerer",
11-
"author_email": "philipp.angerer@helmholtz-munich.de",
12-
"github_user": "scverse",
13-
"github_repo": "anndata",
14-
"license": "BSD 3-Clause License",
15-
"ide_integration": true,
16-
"_copy_without_render": [
17-
".github/workflows/build.yaml",
18-
".github/workflows/test.yaml",
19-
"docs/_templates/autosummary/**.rst"
20-
],
21-
"_exclude_on_template_update": [
22-
"CHANGELOG.md",
23-
"LICENSE",
24-
"README.md",
25-
"docs/api.md",
26-
"docs/index.md",
27-
"docs/notebooks/example.ipynb",
28-
"docs/references.bib",
29-
"docs/references.md",
30-
"src/**",
31-
"tests/**"
32-
],
33-
"_render_devdocs": false,
34-
"_jinja2_env_vars": {
35-
"lstrip_blocks": true,
36-
"trim_blocks": true
37-
},
38-
"_template": "https://github.com/scverse/cookiecutter-scverse",
39-
"_commit": "d383d94fadff9e4e6fdb59d77c68cb900d7cedec"
40-
}
41-
},
42-
"directory": null
2+
"template": "https://github.com/scverse/cookiecutter-scverse",
3+
"commit": "707f3faab836f9272912f92188b63b31da70c064",
4+
"checkout": "main",
5+
"context": {
6+
"cookiecutter": {
7+
"project_name": "anndata",
8+
"package_name": "anndata",
9+
"project_description": "Annotated data.",
10+
"author_full_name": "Philipp Angerer",
11+
"author_email": "philipp.angerer@helmholtz-munich.de",
12+
"github_user": "scverse",
13+
"github_repo": "anndata",
14+
"license": "BSD 3-Clause License",
15+
"ide_integration": true,
16+
"issue_categorization": "issue types",
17+
"_copy_without_render": [
18+
".github/workflows/build.yaml",
19+
".github/workflows/test.yaml",
20+
"docs/_templates/autosummary/**.rst"
21+
],
22+
"_exclude_on_template_update": [
23+
"CHANGELOG.md",
24+
"LICENSE",
25+
"README.md",
26+
"docs/api.md",
27+
"docs/index.md",
28+
"docs/notebooks/example.ipynb",
29+
"docs/references.bib",
30+
"docs/references.md",
31+
"src/**",
32+
"tests/**"
33+
],
34+
"_render_devdocs": false,
35+
"_jinja2_env_vars": {
36+
"lstrip_blocks": true,
37+
"trim_blocks": true
38+
},
39+
"_template": "https://github.com/scverse/cookiecutter-scverse",
40+
"_commit": "707f3faab836f9272912f92188b63b31da70c064"
41+
}
42+
},
43+
"directory": null
4344
}

.editorconfig

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
root = true
22

33
[*]
4-
charset = utf-8
4+
indent_style = space
5+
indent_size = 4
56
end_of_line = lf
6-
insert_final_newline = true
7+
charset = utf-8
78
trim_trailing_whitespace = true
9+
insert_final_newline = true
810
max_line_length = 88
9-
indent_size = 4
10-
indent_style = space
1111

12-
[*.{yml,yaml}]
12+
# TOML is formatted by taplo, which is configured for 4 spaces in .taplo.toml
13+
[{*.{yml,yaml},.cruft.json}]
1314
indent_size = 2
15+
16+
[Makefile]
17+
indent_style = tab

.github/dependabot.yml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,18 @@
11
version: 2
22
updates:
3+
- package-ecosystem: pre-commit
4+
directory: /
5+
schedule:
6+
interval: weekly
7+
labels:
8+
- no milestone
9+
- skip-gpu-ci
10+
cooldown:
11+
default-days: 7
12+
groups:
13+
pre-commit:
14+
patterns:
15+
- "*"
316
- package-ecosystem: github-actions
417
directory: /
518
schedule:
@@ -9,3 +22,7 @@ updates:
922
- skip-gpu-ci
1023
cooldown:
1124
default-days: 7
25+
groups:
26+
actions-deps:
27+
patterns:
28+
- "*"

.github/workflows/codespell.yml

Lines changed: 0 additions & 23 deletions
This file was deleted.

.github/workflows/test-cpu.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,12 +130,34 @@ jobs:
130130
python -m build --sdist --wheel .
131131
twine check dist/*
132132
133+
lint:
134+
name: Pre-commit checks
135+
runs-on: ubuntu-latest
136+
permissions: {}
137+
steps:
138+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
139+
with:
140+
fetch-depth: 0
141+
filter: blob:none
142+
persist-credentials: false
143+
144+
- name: Install UV
145+
uses: astral-sh/setup-uv@c771a70e6277c0a99b617c7a806ffedaca235ff9 # v9.0.0
146+
with:
147+
enable-cache: true
148+
149+
- run: uv tool install hatch
150+
151+
- name: Run pre-commit hooks
152+
run: uvx prek run --all-files --show-diff-on-failure --color=always
153+
133154
check:
134155
if: always()
135156
needs:
136157
- get-environments
137158
- test
138159
- build
160+
- lint
139161
permissions:
140162
actions: read
141163
runs-on: ubuntu-latest

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ __pycache__/
88
/node_modules/
99
/data/
1010
/venv/
11+
.venv/
12+
/uv.lock
1113

1214
# Distribution / packaging
1315
/dist/

.pre-commit-config.yaml

Lines changed: 35 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,54 @@
1-
ci:
2-
autoupdate_commit_msg: "ci: pre-commit autoupdate"
3-
1+
fail_fast: false
2+
default_stages:
3+
- pre-commit
4+
- pre-push
5+
minimum_pre_commit_version: 2.16.0
46
repos:
5-
- repo: https://github.com/astral-sh/ruff-pre-commit
6-
rev: v0.16.1
7-
hooks:
8-
- id: ruff-check
9-
args: ["--fix"]
10-
- id: ruff-format
117
- repo: https://github.com/biomejs/pre-commit
128
rev: v2.5.6
139
hooks:
1410
- id: biome-format
11+
exclude: ^\.cruft\.json$ # inconsistent indentation with cruft - file never to be modified manually.
1512
- repo: https://github.com/ComPWA/taplo-pre-commit
1613
rev: v0.9.3
1714
hooks:
1815
- id: taplo-format
16+
- repo: https://github.com/astral-sh/ruff-pre-commit
17+
rev: v0.16.1
18+
hooks:
19+
- id: ruff-check
20+
types_or: [python, pyi, jupyter]
21+
args: [--fix, --exit-non-zero-on-fix]
22+
- id: ruff-format
23+
types_or: [python, pyi, jupyter]
24+
- repo: local
25+
hooks:
26+
- id: mypy
27+
name: mypy
28+
entry: hatch check types
29+
language: system
30+
types: [python]
31+
files: ^(src|tests)/
32+
require_serial: true
33+
pass_filenames: false
1934
- repo: https://github.com/pre-commit/pre-commit-hooks
2035
rev: v6.0.0
2136
hooks:
22-
- id: trailing-whitespace
23-
- id: end-of-file-fixer
37+
- id: detect-private-key
38+
- id: check-ast
2439
- id: check-added-large-files
25-
- id: check-case-conflict
2640
- id: check-toml
2741
- id: check-yaml
42+
- id: end-of-file-fixer
43+
- id: mixed-line-ending
44+
args: [--fix=lf]
45+
- id: trailing-whitespace
46+
- id: check-case-conflict
47+
# Check that there are no merge conflicts (could be generated by template sync)
2848
- id: check-merge-conflict
29-
- id: detect-private-key
49+
args: [--assume-in-merge]
3050
- id: no-commit-to-branch
31-
args: ["--branch=main"]
51+
args: [--branch=main]
3252
- repo: https://github.com/codespell-project/codespell
3353
rev: v2.4.3
3454
hooks:
@@ -39,3 +59,4 @@ repos:
3959
rev: v1.29.0
4060
hooks:
4161
- id: zizmor
62+
args: [--no-progress, --fix]

benchmarks/benchmarks/dataset2d.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,8 @@ def setup(
7070
if store_type == "h5ad"
7171
else zarr.open(f"data_{array_type}.zarr")
7272
)
73+
assert isinstance(self.store, h5py.File | zarr.Group), self.store
74+
assert isinstance(self.store["df"], h5py.Group | zarr.Group), self.store["df"]
7375
self.ds = ad.experimental.read_elem_lazy(self.store["df"], chunks=chunks)
7476
self.n_obs = self.ds.shape[0]
7577

benchmarks/benchmarks/sparse_dataset.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@ def setup_cache(self):
5959

6060
def setup(self, index: str, use_dask: bool): # noqa: FBT001
6161
g = zarr.open(self.filepath)
62+
assert isinstance(g, zarr.Group), g
63+
assert isinstance(g["X"], zarr.Group), g["X"]
6264
self.x = read_elem_lazy(g["X"]) if use_dask else sparse_dataset(g["X"])
6365
self.adata = AnnData(self.x)
6466
self.index = self._indexers[index]

biome.jsonc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
2-
"$schema": "https://biomejs.dev/schemas/2.1.1/schema.json",
2+
"$schema": "https://biomejs.dev/schemas/2.2.0/schema.json",
3+
"vcs": { "enabled": true, "clientKind": "git", "useIgnoreFile": true },
34
"formatter": { "useEditorconfig": true },
45
"overrides": [
56
{

0 commit comments

Comments
 (0)