Adopt the current scverse cookiecutter template - #411
Open
Zethson wants to merge 2 commits into
Open
Conversation
Sync the repository with cookiecutter-scverse@707f3fa, including the mypy-based type checking the template now ships, and record the template state in `.cruft.json` so future syncs work. Packaging and tooling: - Drop Python 3.11 (SPEC 0, and `spatialdata` already requires >=3.12) and advertise 3.12-3.14 plus `Typing :: Typed`. - Replace the `dev`/`doc`/`test`/`pre` extras with dependency groups, and drive testing from a hatch matrix (3.12/3.14 stable, 3.14 pre-release) so local and CI runs share a single definition. - Adopt the template's ruff, coverage and pytest configuration, `biome.jsonc`, `.editorconfig`, `.gitignore`, `.codecov.yaml` and `CHANGELOG.md`, and delete the now-duplicated `.github/codecov.yml` and the broken `.bumpversion.cfg` (the version comes from git tags via hatch-vcs). - Rebuild the CI on the template's workflows: hatch-driven tests, a package build check, trusted publishing on release, pre-commit checks as a CI job, Dependabot for hooks and actions, and issue templates. The test-data artifact download is kept and now runs for every environment, so the 3.12 and pre-release jobs exercise the readers too. - Switch pre-commit to biome, pyproject-fmt, ruff-check and zizmor, and pin every action to a SHA so zizmor passes on `prepare_test_data.yaml` as well. Documentation: - Adopt the template's `conf.py` (scverse-misc, katex, opengraph, custom CSS) and drop the vendored `typed_returns` extension and autosummary template that scverse-misc replaces. - Merge the template's development guide into `docs/contributing.md` ahead of the existing reader-contribution guide, and describe the tag-based release flow instead of editing a version number. - `docs/changelog.md` now includes `CHANGELOG.md`. - Order `sphinx_click` before `sphinx_autodoc_typehints`: the latter imports `sphinx.ext.autodoc.mock` as a submodule, which shadows the callable of the same name that sphinx-click binds at import time. - Fix the references that made the strict build fail (`imageio.v2.imread`, the stereoseq `Notes` underline, the missing `Virshup_2023` entry) and inline `spatialdata`'s undocumented `Chunks_t` alias in `generic.image`, so the docs build clean with no nitpick exceptions. Typing: - Ship a `py.typed` marker and type-check `src` and `tests` with mypy, with no `# type: ignore`, no casts and no mypy settings beyond `ignore_missing_imports` for the dependencies that ship neither inline types nor stubs. Stubs are used wherever they exist (pandas, scipy, geopandas, shapely, tqdm, PyYAML, xmltodict). - This surfaced three real bugs: `cosmx`, `merscope` and `mcmicro` passed the `dtype=` argument that anndata removed in 0.11, so those readers raised `TypeError` at runtime; `mcmicro` now casts via `to_numpy(dtype=float)` to keep the previous behaviour. - `_get_translations` returned floats despite declaring `dict[str, int]`, which would have failed when used as `da.pad` widths. - Replace the remaining `# type: ignore` comments in `dbit` with real checks, and narrow the blind `except Exception` in `macsima` to the errors `parse_physical_size` actually raises. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #411 +/- ##
==========================================
- Coverage 63.41% 63.15% -0.26%
==========================================
Files 26 26
Lines 3217 3257 +40
==========================================
+ Hits 2040 2057 +17
- Misses 1177 1200 +23
🚀 New features to boost your workflow:
|
Under Python 3.14's dependency resolution, numpy types `ndarray.mean()` as `np.float64`, so mypy inferred that for the variable and rejected the `int` default in the other branch. Annotating the variable keeps both branches valid without changing the value or the log message. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Syncs the repo with
cookiecutter-scverse@707f3fa, including the mypy type checking the template now ships..cruft.jsonis recorded so futurecruft updateruns work.Breaking: Python 3.11 is dropped (SPEC 0;
spatialdatais already>=3.12).biome.jsonc,CHANGELOG.md,.codecov.yaml,.editorconfig,.gitignore. Removes the duplicate.github/codecov.ymland the broken.bumpversion.cfg; the version still comes from git tags via hatch-vcs.conf.py(scverse-misc, katex, opengraph); drops the vendoredtyped_returnsextension and autosummary template it replaces. Template dev guide merged above the existing reader-contribution guide.py.typedshipped;mypy src testsruns as a hook. No# type: ignore, no casts, no nitpick ignores, and no mypy settings beyondignore_missing_importsfor the deps that ship neither types nor stubs.Bugs this found
cosmx,merscopeandmcmicropasseddtype=toAnnData(...), removed in anndata 0.11 — those readers raisedTypeErrorat runtime.macsima._get_translationsreturned floats despite declaringdict[str, int]; the values are used asda.padwidths.# type: ignores indbithid that_check_pathcan returnNoneand thatpath=Nonesilently listed the working directory.Notes
.mypy.inipinnedpython_version = 3.10, so mypy aborted on numpy's stubs before checking anything.maincurrently fails the strict docs build (spatialdata.models.chunks_utils.TypeAliasTypehas no link target), which breaks RTD. Fixed at the source by inlining that alias ingeneric.image, plusimageio.v2.imread, a stereoseq section underline and the missingVirshup_2023entry.sphinx_clickis ordered beforesphinx_autodoc_typehints, which importssphinx.ext.autodoc.mockas a submodule and shadows the callable sphinx-click binds at import time. No version pin.[tool.pytest] strict = truerejects markers used by third-party test modules thatanndata.tests.helpersandspatialdata.testingimport, so four of them are declared inpyproject.toml.Verification
prek run --all-files,mypy src testsandsphinx -Wall clean on 3.14.pytestis 53 passed / 13 skipped / 22 failed, identical tomainlocally — the 22 areassert f.is_dir()on test data only CI has.