Changelog¶
All notable changes to stubpy are recorded here. The format follows Keep a Changelog.
0.1.1 — 2026-03-15¶
Fixed
*argsordering bug in_resolve_via_mro: when a child class had both typed*argsand**kwargs,*argswas incorrectly placed after any already-appended**kwargs, producing invalid Python syntax (e.g.def f(label, **kwargs, *items)). Fixed by inserting*argsbefore the first keyword-only parameter and before any trailing**kwargs, then appending**kwargsafterward.__qualname__replaced with__name__inannotation_to_str(_handle_plain_type) andgenerate_class_stub. Using__qualname__caused test-local classes to emit their full nested scope path (e.g.TestFoo.test_bar.<locals>.MyClass) instead of the simple nameMyClass.Fixed duplicate autodoc warnings in Sphinx build caused by
api/public.rstre-declaring symbols already documented in their own module pages.public.rstnow uses cross-references only.Fixed
resolver.rstreStructuredText*argsemphasis warning by escaping the leading*.
Added
New edge-case tests in
tests/test_integration.py:TestStaticMethods(5 tests) andTestArgsAndKwargsTogether(6 tests) covering*args+**kwargsin all inheritance combinations.Updated
docs/examples/kwargs_backtracing.rstwith all new*args/**kwargsedge cases documented with worked examples.
Changed
Private symbols (
_is_type_alias,_register,_detect_cls_call,_resolve_via_cls_call,_resolve_via_mro,_get_raw_params,_KW_SEP_NAME,_PUBLIC_DUNDERS,_TYPING_CANDIDATES,_SKIP_IMPORT_PREFIXES) removed from the public-facing API reference docs. Docstrings are retained in source for contributors.
0.1.0 — 2026-03-15¶
Initial release.
Added
generate_stub(filepath, output_path)— main public API.stubpyCLI with-o / --outputand--printflags.**kwargsbacktracing via full MRO walk.*argsbacktracing with explicit-annotation preservation.@classmethod cls(**kwargs)detection via AST; resolves againstcls.__init__rather than MRO siblings.Type-alias preservation for imported type sub-modules (
from pkg import typespattern).Cross-file import re-emission in
.pyiheaders.Keyword-only
*separator inserted automatically.Inline formatting for ≤ 2 params; multi-line with trailing commas for larger signatures.
StubContextdataclass replacing module-level globals — fully re-entrant.Dispatch-table
annotation_to_str— extensible without editing a chain.Support for: plain types, PEP 604 unions,
Optional,Union,Callable,Literal,Tuple,List,Dict,Sequence,Set,FrozenSet,Type,ClassVar, forward references,@property(with setter),@classmethod,@staticmethod.Complete pytest test suite (224 tests across 6 modules).
Sphinx documentation with Furo theme.