Skip to content

Commit 69eb650

Browse files
emmatypinggvanrossum
authored andcommitted
Change to -stubs over _stubs (#568)
Also note that a py.typed file is not needed for stub only packages.
1 parent 8c45639 commit 69eb650

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

pep-0561.rst

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -131,9 +131,10 @@ type information, it is preferred that the ``*.pyi`` stubs are alongside the
131131
corresponding ``*.py`` files. However, the stubs can also be put in a separate
132132
package and distributed separately. Third parties can also find this method
133133
useful if they wish to distribute stub files. The name of the stub package
134-
MUST follow the scheme ``foopkg_stubs`` for type stubs for the package named
135-
``foopkg``. The normal resolution order of checking ``*.pyi`` before ``*.py``
136-
will be maintained.
134+
MUST follow the scheme ``foopkg-stubs`` for type stubs for the package named
135+
``foopkg``. Note that for stub only packages adding a py.typed marker is not
136+
needed since the name ``*-stubs`` is enough to indicate it is a source of typing
137+
information.
137138

138139
Third parties seeking to distribute stub files are encouraged to contact the
139140
maintainer of the package about distribution alongside the package. If the
@@ -143,9 +144,13 @@ inline, then a third party stub only package can be created.
143144
In addition, stub-only distributions SHOULD indicate which version(s)
144145
of the runtime package are supported by indicating the runtime distribution's
145146
version(s) through normal dependency data. For example, the
146-
stub package ``flyingcircus_stubs`` can indicate the versions of the
147+
stub package ``flyingcircus-stubs`` can indicate the versions of the
147148
runtime ``flyingcircus`` distribution it supports through ``install_requires``
148-
in distutils-based tools, or the equivalent in other packaging tools.
149+
in distutils-based tools, or the equivalent in other packaging tools. Note that
150+
in pip 9.0, if you update ``flyingcircus-stubs``, it will update
151+
``flyingcircus``. In pip 9.0, you can use the
152+
``--upgrade-strategy=only-if-needed`` flag. In pip 10.0 this is the default
153+
behavior.
149154

150155

151156
Type Checker Module Resolution Order
@@ -161,7 +166,7 @@ resolve modules containing type information:
161166
stubs to use, and patch broken stubs/inline types from packages.
162167

163168
3. Stub packages - these packages can supersede the installed packages.
164-
They can be found at ``foopkg_stubs`` for package ``foopkg``.
169+
They can be found at ``foopkg-stubs`` for package ``foopkg``.
165170

166171
4. Inline packages - if there is nothing overriding the installed
167172
package, and it opts into type checking, inline types SHOULD be used.
@@ -176,6 +181,9 @@ of that Python version. This can be queried e.g.
176181
that the type checker allow for the user to point to a particular Python
177182
binary, in case it is not in the path.
178183

184+
The normal resolution order of checking ``*.pyi`` before ``*.py``
185+
will be maintained.
186+
179187

180188
Implementation
181189
==============
@@ -198,6 +206,12 @@ Smith, and Guido van Rossum.
198206
Version History
199207
===============
200208

209+
* 2018-02-02
210+
211+
* Change stub only package suffix to be -stubs not _stubs.
212+
* Note that py.typed is not needed for stub only packages.
213+
* Add note about pip and upgrading stub packages.
214+
201215
* 2017-11-12
202216

203217
* Rewritten to use existing tooling only

0 commit comments

Comments
 (0)