2025-03-21 15:48:10 +01:00
|
|
|
# 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.
|
|
|
|
|
|
2025-04-09 01:01:36 +02:00
|
|
|
## Why this is necessary
|
2025-03-21 15:48:10 +01:00
|
|
|
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
|
2025-04-09 01:01:36 +02:00
|
|
|
type-checked themselves and used as dependencies. See
|
|
|
|
|
`Lib/_pyrepl/mypy.ini` for a usage example.
|
2025-03-21 15:48:10 +01:00
|
|
|
|
2025-04-09 01:01:36 +02:00
|
|
|
## I want to add a new type-checked module
|
|
|
|
|
Add it to `typed-stdlib.txt` and run `make_symlinks.py --symlink`.
|
|
|
|
|
|
|
|
|
|
## I don't see any symlinks in this directory
|
|
|
|
|
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.
|