feat: check type hints in CI against a baseline

Every signature carries annotations and nothing read them. mypy 1.18.2
over install.py and scripts/ reports 993 errors today, among them the
six pack helpers typed zipfile.ZipFile that every caller also hands a
PackRecord. The errors sit in mypy-baseline.txt and the schema job fails
on any error outside it, or on an entry that no longer occurs. Third-party
packages are left out so the result does not depend on the machine: 6 s
locally, run twice and on 3.12 and 3.13 with the same errors.
This commit is contained in:
Abdessamad Derraz committed 2026-11-06 14:47:20 +01:00
1 parent a99682beeb
commit b56ec21728
5 files changed
+1091

No files matched your search

+25
View File
@@ -37,9 +37,34 @@ dev = [
# installs only in its isolated build environment and 3.12 no longer
# bundles: without it the guard skipped on every CI run.
"setuptools>=61",
# The type check CI runs, pinned: another mypy reports other errors
# than the ones mypy-baseline.txt holds.
"mypy==1.18.2",
"mypy-baseline==0.7.4",
]
# The site is built by Astro Starlight from website/package.json and its
# lockfile (npm ci --prefix website): no Python package builds it.
[project.urls]
Repository = "https://github.com/Abdess/retrobios"
# The annotations are checked, not only written. Third-party packages are left
# out (no_site_packages) so the result does not depend on what the machine
# has installed: yaml, jsonschema and the rest read as Any everywhere. The
# errors the code carried when the check started sit in mypy-baseline.txt.
# CI fails on an error that is not there and on an entry that no longer
# occurs: `mypy > out.txt`, then `mypy-baseline filter < out.txt`, and
# `mypy-baseline sync < out.txt` once the fix is in.
[tool.mypy]
files = ["install.py", "scripts"]
python_version = "3.9"
explicit_package_bases = true
ignore_missing_imports = true
no_site_packages = true
disable_error_code = ["import-untyped"]
cache_dir = "tmp/mypy_cache"
[tool.mypy-baseline]
baseline_path = "mypy-baseline.txt"
ignore_categories = ["note"]
sort_baseline = true