PEP 561: Point to mypy implementation and clarify stub package priority. (#613)

This commit is contained in:
Ethan Smith 2018-04-10 09:18:42 -07:00 committed by Brett Cannon
parent 27becbf714
commit 18b869d1ce
1 changed files with 17 additions and 6 deletions

View File

@ -165,8 +165,8 @@ resolve modules containing type information:
checkers SHOULD provide this to allow the user complete control of which checkers SHOULD provide this to allow the user complete control of which
stubs to use, and patch broken stubs/inline types from packages. stubs to use, and patch broken stubs/inline types from packages.
3. Stub packages - these packages can supersede the installed packages. 3. Stub packages - these packages SHOULD supersede any installed inline
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. Inline packages - if there is nothing overriding the installed
package, and it opts into type checking, inline types SHOULD be used. package, and it opts into type checking, inline types SHOULD be used.
@ -189,10 +189,13 @@ Implementation
============== ==============
The proposed scheme of indicating support for typing is completely backwards The proposed scheme of indicating support for typing is completely backwards
compatible, and requires no modification to tooling. A sample package with compatible, and requires no modification to package tooling. A sample package
inline types is available [typed_pkg]_, as well as a sample package checker with inline types is available [typed_pkg]_, as well as a sample package
[pkg_checker]_ which reads the metadata of installed packages and reports on checker [pkg_checker]_ which reads the metadata of installed packages and
their status as either not typed, inline typed, or a stub package. reports on their status as either not typed, inline typed, or a stub package.
The mypy type checker has an implementation of PEP 561 searching which can be
read about in the mypy docs [4]_.
Acknowledgements Acknowledgements
@ -206,6 +209,11 @@ Smith, and Guido van Rossum.
Version History Version History
=============== ===============
* 2018-04-09
* Add reference to mypy implementation
* Clarify stub package priority.
* 2018-02-02 * 2018-02-02
* Change stub only package suffix to be -stubs not _stubs. * Change stub only package suffix to be -stubs not _stubs.
@ -252,6 +260,9 @@ References
.. [3] PEP 426 definitions .. [3] PEP 426 definitions
(https://www.python.org/dev/peps/pep-0426/) (https://www.python.org/dev/peps/pep-0426/)
.. [4] Example implementation in a type checker
(https://mypy.readthedocs.io/en/latest/installed_packages.html)
.. [typed_pkg] Sample typed package .. [typed_pkg] Sample typed package
(https://github.com/ethanhs/sample-typed-package) (https://github.com/ethanhs/sample-typed-package)