Skip to content

ci: unbreak the lint jobs (mypy python_version, dead doc links) - #848

Merged
Marius1311 merged 2 commits into
mainfrom
ci/fix-mypy-python-version
Aug 25, 2026
Merged

ci: unbreak the lint jobs (mypy python_version, dead doc links)#848
Marius1311 merged 2 commits into
mainfrom
ci/fix-mypy-python-version

Conversation

@Marius1311

@Marius1311 Marius1311 commented Aug 24, 2026

Copy link
Copy Markdown
Collaborator

Both legs of the Lint workflow have been failing on main since 2026-07-27, at the same SHA and for reasons unrelated to any code change — the last green run was 2026-07-06. Neither failure is caused by moscot code. The Test workflow is separately red on 3.12 (see below).

Lint code

The mypy hook aborts inside numpy's own stubs:

numpy/__init__.pyi:737:45: error: Type statement is only supported in Python 3.12 and greater  [syntax]
Found 1 error in 1 file (errors prevented further checking)

numpy's stubs now use PEP 695 (type X = …), which needs python_version >= 3.12, while [tool.mypy] still pins python_version = "3.10". mypy therefore never reaches any moscot source — it has effectively not type-checked the project for a month.

  • Bump to python_version = "3.12". The project requires >=3.11, so this only means checking under 3.12 semantics; no supported interpreter is dropped.
  • Drop plugins = "numpy.typing.mypy_plugin", deprecated in NumPy 2.3 and slated for removal.

With mypy actually running again, five type: ignore comments are reported as unnecessary (warn_unused_ignores = true) — three in __init__.py, one in base/cost.py (only the type-var code was stale, arg-type is kept), one in problems/time/_mixins.py. They are removed, after checking moscot.__version__/__author__ still resolve. mypy src is then clean: no issues found in 50 source files.

The hook's environment installs only numpy (additional_dependencies: [numpy>=1.25.0]), so this is exactly what CI checks. Running mypy in a fully populated environment surfaces ~140 further errors from third-party stubs; that is a separate discussion and this PR does not touch it.

Lint docs

lint-docs builds with SPHINXOPTS = -W -q --keep-going, so anything that warns fails it. Two causes:

  1. Dead links. make linkcheck reported two upstream 404s — muon.atac.tl.lsi and an openproblems dataset page — both from 600_tutorial_translation.ipynb, which lives in the docs/notebooks submodule and so cannot be fixed here. They join the existing linkcheck_ignore list, in its established commented style.
  2. Nine broken references. Every remaining warning was py:func reference target not found: scanpy.read. These come from dataset docstrings saying "Keyword arguments for :func:scanpy.read" — but _load_dataset_from_url forwards **kwargs to anndata.read_h5ad (or mudata.read_h5mu), never to scanpy.read, which scanpy also no longer documents. Retargeted to :func:~anndata.io.read_h5ad, which fixes a factual error in the docs as well as the build. (pancreas_multiome already documented the right functions and is untouched.)

After this, the job has no broken links and no warnings left to trip -W.

Not fixed here

The Test workflow fails on ubuntu-3.12 and macOS-3.12 with 27 failures (3.11 passes) in test_annotation_mapping and test_set_graph_xy. Those are pre-existing and orthogonal to lint: this PR touches only mypy config, linkcheck_ignore and docstrings, and reproduces the identical 27 failures. I also reproduced them locally with and without an unrelated source change and got identical counts. Worth its own issue.

Verification

  • mypy src under the hook's exact dependency set (mypy 1.15.0 + numpy only): clean.
  • black, isort, ruff, rstcheck, doc8 and the remaining hooks: pass (prettier needs Node, which I don't have locally — untouched by this diff).
  • pytest tests/solvers tests/utils: 56 passed.
  • anndata.io.read_h5ad confirmed present in anndata's intersphinx inventory.

Split out of #846, which is blocked on the same red lint.

🤖 Generated with Claude Code

Both legs of the `Lint` workflow have been red on `main` since 2026-07-27, for reasons
unrelated to any change:

* **`Lint code`** - the `mypy` hook dies inside numpy's own stubs:

      numpy/__init__.pyi:737:45: error: Type statement is only supported in Python 3.12 and greater

  numpy's stubs now use PEP 695 syntax, while `[tool.mypy]` pins `python_version = "3.10"`,
  so mypy aborts before checking any moscot code. Bump it to `3.12` (the project requires
  `>=3.11`, and no supported interpreter is affected by checking under 3.12 semantics) and
  drop `plugins = "numpy.typing.mypy_plugin"`, which numpy deprecated in 2.3 and will remove.

  With mypy running again, five `type: ignore` comments turn out to be unnecessary
  (`warn_unused_ignores` is on); they are removed. `mypy src` is then clean.

* **`Lint docs`** - `make linkcheck` fails on two external links that moved, both from a
  tutorial in the `docs/notebooks` submodule, so they cannot be fixed from this repo. They
  join the existing `linkcheck_ignore` list.

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

codecov Bot commented Aug 24, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 50.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 76.62%. Comparing base (915643e) to head (e2bcc57).

Files with missing lines Patch % Lines
src/moscot/base/cost.py 0.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@           Coverage Diff           @@
##             main     #848   +/-   ##
=======================================
  Coverage   76.62%   76.62%           
=======================================
  Files          36       36           
  Lines        4175     4175           
  Branches      670      670           
=======================================
  Hits         3199     3199           
  Misses        679      679           
  Partials      297      297           
Files with missing lines Coverage Δ
src/moscot/datasets.py 61.00% <ø> (ø)
src/moscot/problems/time/_mixins.py 63.84% <100.00%> (ø)
src/moscot/base/cost.py 75.00% <0.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

`_load_dataset_from_url` forwards `**kwargs` to `anndata.read_h5ad`, but nine dataset
docstrings advertised :func:`scanpy.read`, which scanpy no longer documents - so every one
of them raised `py:func reference target not found`, and `lint-docs` builds with `-W`.

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

Copy link
Copy Markdown
Collaborator Author

@selmanozleyen, merging this, it's just linting stuff.

@Marius1311
Marius1311 merged commit e7a0567 into main Aug 25, 2026
8 of 11 checks passed
@Marius1311
Marius1311 deleted the ci/fix-mypy-python-version branch August 25, 2026 10:54
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.

1 participant