Typeshed collects type annotations for Python builtins, the standard library, and many third-party packages for static analysis and type checking.
Overview
Typeshed is a collection of library stubs for Python. It includes annotations for builtins and the standard library, plus stubs for third-party libraries used in static analysis, type checking, inference, and editor autocompletion.
Major type checkers and language servers bundle the standard library stubs. Third-party stubs are published on PyPI, usually as packages named types- followed by the library name; checkers pick up those stubs when installed.
Stub package versions encode the target runtime package version and a release date. Typeshed documents strategies for pinning or bounding stub versions alongside runtime dependencies. Third-party stubs are removed when upstream packages ship their own types or become unsupported.
A small typeshed utility package exposes helper types for type checker users; imports from it are intended only under type-checking guards. Issues with stubs should be reported to Typeshed rather than to the upstream library.
Key features
- Standard library type stubs
- Third-party stub packages on PyPI
- Bundled with major type checkers
- types-* naming convention
- typeshed utility types package
- Documented stub versioning strategies
Use cases
- Static type checking Python code
- IDE autocompletion for libraries
- Publishing stubs for third-party packages
- Type checker standard library baselines