PEP 561: Clarify 4th step in Module Resolution Order (#2960)
This commit is contained in:
parent
26d2f2bff8
commit
d8ce90756f
13
pep-0561.rst
13
pep-0561.rst
|
@ -182,6 +182,7 @@ laid out as follows::
|
||||||
└── hexagon
|
└── hexagon
|
||||||
└── __init__.pyi
|
└── __init__.pyi
|
||||||
|
|
||||||
|
.. _mro:
|
||||||
|
|
||||||
Type Checker Module Resolution Order
|
Type Checker Module Resolution Order
|
||||||
------------------------------------
|
------------------------------------
|
||||||
|
@ -200,8 +201,10 @@ resolve modules containing type information:
|
||||||
3. Stub packages - these packages SHOULD supersede any installed inline
|
3. Stub packages - these packages SHOULD supersede any installed inline
|
||||||
package. They can be found at ``foopkg-stubs`` for package ``foopkg``.
|
package. They can be found at ``foopkg-stubs`` for package ``foopkg``.
|
||||||
|
|
||||||
4. Inline packages - if there is nothing overriding the installed
|
4. Packages with a ``py.typed`` marker file - if there is nothing overriding
|
||||||
package, *and* it opts into type checking, inline types SHOULD be used.
|
the installed package, *and* it opts into type checking, the types
|
||||||
|
bundled with the package SHOULD be used (be they in ``.pyi`` type
|
||||||
|
stub files or inline in ``.py`` files).
|
||||||
|
|
||||||
5. Typeshed (if used) - Provides the stdlib types and several third party
|
5. Typeshed (if used) - Provides the stdlib types and several third party
|
||||||
libraries.
|
libraries.
|
||||||
|
@ -274,6 +277,12 @@ Vlasovskikh, Nathaniel Smith, and Guido van Rossum.
|
||||||
Version History
|
Version History
|
||||||
===============
|
===============
|
||||||
|
|
||||||
|
* 2023-01-13
|
||||||
|
|
||||||
|
* Clarify that the 4th step of the :ref:`Module Resolution Order <mro>` applies
|
||||||
|
to any package with a ``py.typed`` marker file (and not just
|
||||||
|
inline packages).
|
||||||
|
|
||||||
* 2021-09-20
|
* 2021-09-20
|
||||||
|
|
||||||
* Clarify expectations and typechecker behavior for stub-only namespace packages
|
* Clarify expectations and typechecker behavior for stub-only namespace packages
|
||||||
|
|
Loading…
Reference in New Issue