stubpy¶
stubpy generates
.pyi stub files for Python modules
with full **kwargs / *args MRO backtracing,
type-alias preservation, and cross-file import resolution.
Key features
kwargs backtracing — walks the entire MRO to expand
**kwargsinto concrete, named parameters at every inheritance level.cls() detection —
@classmethodmethods that forward**kwargsintocls(...)are resolved againstcls.__init__, not the MRO.Typed *args preserved — explicitly annotated
*args(e.g.*elements: Element) always survive the resolution chain.Type-alias preservation —
types.Lengthstaystypes.Lengthrather than expanding tostr | float | int.Cross-file imports — base classes and annotation types from other local modules are re-emitted in the
.pyiheader automatically.Zero dependencies — stdlib only at runtime.
Getting Started
Examples
API Reference
Project