initpyi
initpyi is a term used in Python typing circles to refer to a type stub file that specifies the public API of a package’s initialization module. It is typically named __init__.pyi and resides in the package directory alongside the actual implementation. The purpose is to provide static type information to type checkers without running package code, which can help avoid side effects during type checking and improve the accuracy of API typings for packages with complex initialization logic.
The main role of an initpyi is to declare the types of objects that the package exposes
In practice, initpyi works with type checkers such as mypy and Pyright and is part of the
Maintainers must keep initpyi in sync with the actual runtime API to avoid false positives or negatives