PEP 561: add typeshed if a package is partial (#676)

This commit is contained in:
Ethan Smith 2018-06-19 14:24:19 -07:00 committed by Guido van Rossum
parent 8857369e2a
commit fa86a3cd23
1 changed files with 13 additions and 6 deletions

View File

@ -188,13 +188,15 @@ Partial Stub Packages
Many stub packages will only have part of the type interface for libraries
completed, especially initially. For the benefit of type checking and code
editors, packages can be "partial". This means modules not found in the stub
package SHOULD be searched for in the corresponding runtime package.
package SHOULD be searched for in parts four and five of the module resolution
order above, namely inline packages and typeshed.
Type checkers should merge the stub package and runtime package directories.
This can be thought of as the functional equivalent of copying the stub package
into the same directory as the corresponding runtime package and type checking
the combined directory structure. Thus type checkers MUST maintain the normal
resolution order of checking ``*.pyi`` before ``*.py`` files.
Type checkers should merge the stub package and runtime package or typeshed
directories. This can be thought of as the functional equivalent of copying the
stub package into the same directory as the corresponding runtime package or
typeshed folder and type checking the combined directory structure. Thus type
checkers MUST maintain the normal resolution order of checking ``*.pyi`` before
``*.py`` files.
Stub packages can opt into declaring themselves as partial by including
``partial\n`` in the package's ``py.typed`` file.
@ -224,7 +226,12 @@ Vlasovskikh, Nathaniel Smith, and Guido van Rossum.
Version History
===============
* 2018-06-19
* Partial stub packages can look at typeshed as well as runtime packages
* 2018-05-15
* Add partial stub package spec.
* 2018-04-09