Skip to content

Commit a192f33

Browse files
committed
Automated template update to v0.6.0
1 parent 4753534 commit a192f33

File tree

9 files changed

+238
-87
lines changed

9 files changed

+238
-87
lines changed

.cruft.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"template": "https://github.com/scverse/cookiecutter-scverse",
3-
"commit": "94ef9fb6f9ad8cfe65a3d9575679c03c80c49cd1",
4-
"checkout": "v0.5.0",
3+
"commit": "d383d94fadff9e4e6fdb59d77c68cb900d7cedec",
4+
"checkout": "v0.6.0",
55
"context": {
66
"cookiecutter": {
77
"project_name": "cell-annotator",
@@ -36,7 +36,7 @@
3636
"trim_blocks": true
3737
},
3838
"_template": "https://github.com/scverse/cookiecutter-scverse",
39-
"_commit": "94ef9fb6f9ad8cfe65a3d9575679c03c80c49cd1"
39+
"_commit": "d383d94fadff9e4e6fdb59d77c68cb900d7cedec"
4040
}
4141
},
4242
"directory": null

.github/workflows/test.yaml

Lines changed: 62 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,27 +18,48 @@ defaults:
1818
shell: bash -euo pipefail {0}
1919

2020
jobs:
21+
# Get the test environment from hatch as defined in pyproject.toml.
22+
# This ensures that the pyproject.toml is the single point of truth for test definitions and the same tests are
23+
# run locally and on continuous integration.
24+
# Check [[tool.hatch.envs.hatch-test.matrix]] in pyproject.toml and https://hatch.pypa.io/latest/environment/ for
25+
# more details.
26+
get-environments:
27+
runs-on: ubuntu-latest
28+
outputs:
29+
envs: ${{ steps.get-envs.outputs.envs }}
30+
steps:
31+
- uses: actions/checkout@v4
32+
with:
33+
filter: blob:none
34+
fetch-depth: 0
35+
- name: Install uv
36+
uses: astral-sh/setup-uv@v5
37+
- name: Get test environments
38+
id: get-envs
39+
run: |
40+
ENVS_JSON=$(uvx hatch env show --json | jq -c 'to_entries
41+
| map(
42+
select(.key | startswith("hatch-test"))
43+
| {
44+
name: .key,
45+
label: (if (.key | contains("pre")) then .key + " (PRE-RELEASE DEPENDENCIES)" else .key end),
46+
python: .value.python
47+
}
48+
)')
49+
echo "envs=${ENVS_JSON}" | tee $GITHUB_OUTPUT
50+
51+
# Run tests through hatch. Spawns a separate runner for each environment defined in the hatch matrix obtained above.
2152
test:
22-
runs-on: ${{ matrix.os }}
53+
needs: get-environments
2354

2455
strategy:
2556
fail-fast: false
2657
matrix:
27-
include:
28-
- os: ubuntu-latest
29-
python: "3.10"
30-
- os: ubuntu-latest
31-
python: "3.12"
32-
- os: ubuntu-latest
33-
python: "3.12"
34-
pip-flags: "--pre"
35-
name: PRE-RELEASE DEPENDENCIES
36-
37-
name: ${{ matrix.name }} Python ${{ matrix.python }}
38-
39-
env:
40-
OS: ${{ matrix.os }}
41-
PYTHON: ${{ matrix.python }}
58+
os: [ubuntu-latest]
59+
env: ${{ fromJSON(needs.get-environments.outputs.envs) }}
60+
61+
name: ${{ matrix.env.label }}
62+
runs-on: ${{ matrix.os }}
4263

4364
steps:
4465
- uses: actions/checkout@v4
@@ -48,12 +69,35 @@ jobs:
4869
- name: Install uv
4970
uses: astral-sh/setup-uv@v5
5071
with:
72+
python-version: ${{ matrix.env.python }}
5173
cache-dependency-glob: pyproject.toml
74+
- name: create hatch environment
75+
run: uvx hatch env create ${{ matrix.env.name }}
5276
- name: run tests using hatch
5377
env:
5478
MPLBACKEND: agg
5579
PLATFORM: ${{ matrix.os }}
5680
DISPLAY: :42
57-
run: uvx hatch test --cover --python ${{ matrix.python }}
81+
run: uvx hatch run ${{ matrix.env.name }}:run-cov -v --color=yes -n auto
82+
- name: generate coverage report
83+
run: |
84+
# See https://coverage.readthedocs.io/en/latest/config.html#run-patch
85+
test -f .coverage || uvx hatch run ${{ matrix.env.name }}:cov-combine
86+
uvx hatch run ${{ matrix.env.name }}:cov-report # report visibly
87+
uvx hatch run ${{ matrix.env.name }}:coverage xml # create report for upload
5888
- name: Upload coverage
59-
uses: codecov/codecov-action@v4
89+
uses: codecov/codecov-action@v5
90+
91+
# Check that all tests defined above pass. This makes it easy to set a single "required" test in branch
92+
# protection instead of having to update it frequently. See https://github.com/re-actors/alls-green#why.
93+
check:
94+
name: Tests pass in all hatch environments
95+
if: always()
96+
needs:
97+
- get-environments
98+
- test
99+
runs-on: ubuntu-latest
100+
steps:
101+
- uses: re-actors/alls-green@release/v1
102+
with:
103+
jobs: ${{ toJSON(needs) }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ __pycache__/
1414
# Tests and coverage
1515
/data/
1616
/node_modules/
17+
/.coverage*
1718

1819
# docs
1920
/docs/generated/

.pre-commit-config.yaml

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,24 +7,24 @@ default_stages:
77
minimum_pre_commit_version: 2.16.0
88
repos:
99
- repo: https://github.com/biomejs/pre-commit
10-
rev: v1.9.4
10+
rev: v2.2.4
1111
hooks:
1212
- id: biome-format
1313
exclude: ^\.cruft\.json$ # inconsistent indentation with cruft - file never to be modified manually.
1414
- repo: https://github.com/tox-dev/pyproject-fmt
15-
rev: v2.5.1
15+
rev: v2.6.0
1616
hooks:
1717
- id: pyproject-fmt
1818
- repo: https://github.com/astral-sh/ruff-pre-commit
19-
rev: v0.11.2
19+
rev: v0.13.2
2020
hooks:
21-
- id: ruff
21+
- id: ruff-check
2222
types_or: [python, pyi, jupyter]
2323
args: [--fix, --exit-non-zero-on-fix]
2424
- id: ruff-format
2525
types_or: [python, pyi, jupyter]
2626
- repo: https://github.com/pre-commit/pre-commit-hooks
27-
rev: v5.0.0
27+
rev: v6.0.0
2828
hooks:
2929
- id: detect-private-key
3030
- id: check-ast
@@ -36,12 +36,3 @@ repos:
3636
# Check that there are no merge conflicts (could be generated by template sync)
3737
- id: check-merge-conflict
3838
args: [--assume-in-merge]
39-
- repo: local
40-
hooks:
41-
- id: forbid-to-commit
42-
name: Don't commit rej files
43-
entry: |
44-
Cannot commit .rej files. These indicate merge conflicts that arise during automated template updates.
45-
Fix the merge conflicts manually and remove the .rej files.
46-
language: fail
47-
files: '.*\.rej$'

.readthedocs.yaml

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
# https://docs.readthedocs.io/en/stable/config-file/v2.html
22
version: 2
33
build:
4-
os: ubuntu-20.04
4+
os: ubuntu-24.04
55
tools:
6-
python: "3.10"
7-
sphinx:
8-
configuration: docs/conf.py
9-
# disable this for more lenient docs builds
10-
fail_on_warning: true
11-
python:
12-
install:
13-
- method: pip
14-
path: .
15-
extra_requirements:
16-
- doc
6+
python: "3.12"
7+
jobs:
8+
create_environment:
9+
- asdf plugin add uv
10+
- asdf install uv latest
11+
- asdf global uv latest
12+
build:
13+
html:
14+
- uvx hatch run docs:build
15+
- mv docs/_build $READTHEDOCS_OUTPUT

biome.jsonc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
{
2-
"$schema": "https://biomejs.dev/schemas/1.9.4/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
{
6-
"include": ["./.vscode/*.json", "**/*.jsonc"],
7+
"includes": ["./.vscode/*.json", "**/*.jsonc"],
78
"json": {
89
"formatter": { "trailingCommas": "all" },
910
"parser": {

docs/Makefile

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

0 commit comments

Comments
 (0)