Skip to content

Update template to v0.8.0 - #137

Closed
scverse-bot wants to merge 2 commits into
theislab:mainfrom
scverse-bot:template-update-v2-theislab-DRVI-v0.8.0
Closed

scverse-bot wants to merge 2 commits into
theislab:mainfrom
scverse-bot:template-update-v2-theislab-DRVI-v0.8.0

Conversation

@scverse-bot

Copy link
Copy Markdown
Contributor

cookiecutter-scverse released v0.8.0.

Changes

This release comes with a bunch of smaller fixes and changes to the template, and a lot of under-the-hood changes reducing friction with template sync and initialization.

Changes

The most notable change is the introduction of zizmor as pre-commit hook for hardening github actions against supply-chain attacks. Github actions will be pinned to an immutable hash instead of a version number. Dependabot will take care of updating them (by @ilan-gold, @grst, @ilia-kats in scverse/cookiecutter-scverse#498).

Additionally, we introduced a helper package, scverse-misc, that contains utility code shared across scverse core and ecosystem packages. As an initial step, we moved custom sphinx extensions that were previously part of the template into scverse-misc (by @ilia-kats in scverse/cookiecutter-scverse#529). Rollout of additional features (shared logging and settings) will follow in the next release.

The remaining changes are listed below:

Updates to the template

Template sync, docs, and initialization (changes do not affect instance repos)

Additional remarks

  • unsubscribe: If you don’t want to receive these PRs in the future,
    add skip: true to template-repos.yml using a PR or,
    if you never want to sync from the template again, delete the .cruft.json file in the root of your repository.
  • If there are merge conflicts, you need to resolve them manually.
  • The scverse template works best when the pre-commit.ci, readthedocs and codecov services are enabled.
    Make sure to activate those apps if you haven't already.

@moinfar

moinfar commented Sep 14, 2026

Copy link
Copy Markdown
Collaborator

Closed in favor of #140

@moinfar moinfar closed this Sep 14, 2026
moinfar added a commit that referenced this pull request Sep 17, 2026
* Update template to v0.8.0

Applies the cookiecutter-scverse v0.8.0 template update (#137) via `cruft update`,
resolving conflicts by hand since the automated PR was based on the pristine
template baseline instead of current main.

- Pin GitHub Actions to immutable commit hashes and add zizmor as a pre-commit
  hook to harden CI against supply-chain attacks
- Migrate from pre-commit to prek, and add mypy type checking (with overrides
  for currently-untyped third-party deps and pre-existing type errors, to be
  cleaned up incrementally)
- Migrate docs from sphinx-tabs to sphinx-design and move shared sphinx
  extensions into scverse-misc
- Add an autofix.ci workflow, list installed packages in test CI output, and
  other minor CI/docs housekeeping from the template release

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Fix all mypy errors instead of suppressing them

Removes the blanket ignore_errors overrides added when wiring up mypy from
the template and actually resolves the 15 real type errors they were
masking, across _cmap, _generative_mixin, _module, _metrics, _interpretability,
_latent, and porting. Only the ignore_missing_imports override for untyped
third-party deps (scanpy/scipy/scvi/sklearn) remains.

Notable fixes:
- _cmap.py: give each colormap dict its own name and a Literal-keyed type
  instead of reusing one dynamically-retyped `cmap_data` variable
- _generative_mixin.py: declare the attributes SparseLatentMixin expects
  from the model classes it's combined with, under TYPE_CHECKING
- _metrics.py: annotate torchmetrics state/buffer attributes so they're
  seen as Tensor rather than the generic Module fallback
- _latent.py: add an _as_frame() helper to narrow anndata's `DataFrame |
  Dataset2D` to a concrete DataFrame, since this module's operations
  (groupby/query/sort_values/mutation) require an in-memory AnnData anyway

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

* Use cast-based narrowing for the mypy fixes

Reworks the previous commit's type fixes to be less intrusive and more honest
about what is actually known:

- _latent.py: `_as_df`/`_as_array` now narrow anndata's `.obs`/`.var`/`.X`
  annotations with `typing.cast` instead of an isinstance check that raised.
  The raise added an untested error path (and a repeated name string at every
  call site) for a change that is only about types.
- _generative_mixin.py: declare the attributes the mixin expects from its
  sibling base class as `Callable`, rather than fabricating full signatures
  for an upstream (untyped) scvi API that mypy cannot verify them against.
- _cmap.py: keep the per-colormap data dicts private; `plotting.cmap` is a
  public module, so they should not become API.
- _interpretability.py: lift `_dim_number` out of the plotting function body
  and raise `ValueError` rather than assert.
- porting.py: express the terminal chain entry as `if migration := ...`
  (None means "no parameter change"), which the dict already means, instead
  of asserting it away.
- Drop the two `# type: ignore` comments and the bare asserts these replace.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* Add changelog entries for the template sync

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

* Skip the mypy hook on pre-commit.ci

The hook shells out to `hatch`, which pre-commit.ci cannot provide: mypy needs
the project's dependencies installed, and pre-commit.ci has no network access
while running hooks. It failed there with "Executable `hatch` not found" while
every other hook passed.

mypy still runs locally through prek and on CI in the `Pre-commit checks` job,
which installs hatch first.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants