[Python-Dev] PEP 561 rework (original) (raw)
Nathaniel Smith njs at pobox.com
Sun Nov 12 23:07:12 EST 2017
- Previous message (by thread): [Python-Dev] PEP 561 rework
- Next message (by thread): [Python-Dev] PEP 561 rework
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Sun, Nov 12, 2017 at 11:21 AM, Ethan Smith <ethan at ethanhs.me> wrote:
On Sun, Nov 12, 2017 at 9:53 AM, Jelle Zijlstra <jelle.zijlstra at gmail.com> wrote:
2017-11-12 3:40 GMT-08:00 Ethan Smith <ethan at ethanhs.me>: The name of the stub package MUST follow the scheme
pkgstubs
for type stubs for the package namedpkg
. The normal resolution order of checking*.pyi
before*.py
will be maintained. This is very minor, but what do you think of using "pkg-stubs" instead of "pkgstubs" (using a hyphen rather than an underscore)? This would make the name illegal to import as a normal Python package, which makes it clear that it's not a normal package. Also, there could be real packages named "stubs". I suppose this makes sense. I checked PyPI and as of a few weeks ago there were no packages with the name pattern, but I like the idea of making it explicitly non-runtime importable. I cannot think of any reason not to do it, and the avoidance of confusion about the package being importable is a benefit. I will make the change with my next round of edits.
PyPI doesn't distinguish between the names 'foo-stubs' and 'foo_stubs' -- they get normalized together. So even if you use 'foo-stubs' as the directory name on sys.path to avoid collisions at import time, it still won't allow someone to distribute a separate 'foo_stubs' package on PyPI.
If you do go with a fixed naming convention like this, the PEP should probably also instruct the PyPI maintainers that whoever owns 'foo' automatically has the right to control the name 'foo-stubs' as well. Or maybe some tweak to PEP 541 is needed.
-n
-- Nathaniel J. Smith -- https://vorpus.org
- Previous message (by thread): [Python-Dev] PEP 561 rework
- Next message (by thread): [Python-Dev] PEP 561 rework
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]