cpython/Misc/mypy
Miss Islington (bot) 0458554482
[3.13] gh-133117: Run mypy on `tomllib` in CI (GH-133118) (#133192)
gh-133117: Run mypy on `tomllib` in CI (GH-133118)
(cherry picked from commit 5ea9010e89)

Co-authored-by: sobolevn <mail@sobolevn.me>
2025-04-30 12:57:57 +00:00
..
README.md [3.13] gh-131507: Add a way to recreate the `Misc/mypy` symlinks if missing (GH-132274) (#132293) 2025-04-09 01:37:26 +02:00
_colorize.py
_pyrepl
make_symlinks.py [3.13] gh-131507: Add a way to recreate the `Misc/mypy` symlinks if missing (GH-132274) (#132293) 2025-04-09 01:37:26 +02:00
tomllib [3.13] gh-133117: Run mypy on `tomllib` in CI (GH-133118) (#133192) 2025-04-30 12:57:57 +00:00
typed-stdlib.txt [3.13] gh-133117: Run mypy on `tomllib` in CI (GH-133118) (#133192) 2025-04-30 12:57:57 +00:00

README.md

Mypy path symlinks

This directory stores symlinks to standard library modules and packages that are fully type-annotated and ready to be used in type checking of the rest of the stdlib or Tools/ and so on.

Why this is necessary

Due to most of the standard library being untyped, we prefer not to point mypy directly at Lib/ for type checking. Additionally, mypy as a tool does not support shadowing typing-related standard libraries like types, typing, and collections.abc.

So instead, we set mypy_path to include this directory, which only links modules and packages we know are safe to be type-checked themselves and used as dependencies. See Lib/_pyrepl/mypy.ini for a usage example.

I want to add a new type-checked module

Add it to typed-stdlib.txt and run make_symlinks.py --symlink.

The symlinks in this directory are skipped in source tarballs in Python releases. This ensures they don't end up in the SBOM. To recreate them, run the make_symlinks.py --symlink script.