[Python-ideas] Moving typing out of the stdlib in Python 3.7?

Chris Angelico rosuav at gmail.com
Sun Nov 5 18:08:57 EST 2017


On Mon, Nov 6, 2017 at 9:29 AM, Barry Scott <barry at barrys-emacs.org> wrote:
> On Saturday, 4 November 2017 20:22:25 GMT Guido van Rossum wrote:
>> On Sat, Nov 4, 2017 at 7:05 AM, Nick Coghlan <ncoghlan at gmail.com> wrote:
>> > Perhaps typing could switch to being a bundled module, such that it
>> > had its own version, independent of the Python standard library
>> > version, but was still present by default in new installations?
>>
>> This is beginning to sound like the most attractive solution. We could
>> possibly do away with typing_extensions. Are there precedents of how to
>> bundle a module in this way? Or is it going to be another special case like
>> pip?
>
> Is the outcome you want that you ship a version of typing with the python kit,
> but if you install from pip it overrides the one shipped in the python kit?
>
> That would be a matter of being having a suitable sys.path/site config I
> guess. pip folder before the bundled packages folder.
>
> If this is a mechanism that python kitting has then you would be able to
> bundle other packages like requests or six as well as typing, but because
> you can use pip to override the one shipped a user can optionally keep
> up with the latest versions.

If this were to happen, I would be inclined to put these "bootstrap"
modules into their own directory in sys.path, after the rest of the
stdlib. Then someone who's paranoid about stdlib shadowing could put
pip-installed modules after the bulk of the stdlib (thus preventing
any third-party package from overriding "import random", for instance)
but still update modules that are specifically intended for updating;
plus it'd mean you can get a directory listing of that, and go grab
all the "blessed by python.org as an extension of the stdlib"
packages.

ChrisA


More information about the Python-ideas mailing list