stubpy¶
stubpy generates .pyi stub files for Python modules — complete with
full **kwargs / *args MRO backtracing, type-alias preservation,
Generic and overload support, and cross-file import resolution.
pip install stubpy
stubpy mymodule.py # → mymodule.pyi
stubpy mypackage/ # → stubs entire package tree
Why stubpy?
Most stub generators leave **kwargs as **kwargs. stubpy walks the
entire class MRO to expand **kwargs into the concrete named parameters
that the method actually accepts — giving IDEs full auto-complete even across
deep inheritance hierarchies.
At a glance
|
Walks MRO to emit every concrete kwarg, including pos-only promotion |
Function-level forwarding |
Module-level functions that forward |
TypeVar / Generic / overload |
TypeVar, TypeAlias, NewType, Generic[T], @overload all preserved |
TypedDict / Enum / dataclass |
Dedicated clean stubs for every special class form |
Type-alias preservation |
|
Cross-file imports |
Base-class and annotation imports auto-added to the .pyi header |
Package batch generation |
One call stubs an entire directory tree |
Custom annotation handlers |
Extend the dispatch table with |
Zero runtime dependencies |
stdlib only |
Getting Started
Examples
API Reference
Project