[Import-SIG] Bundling importlib2 with Python 2.7.x?

Nick Coghlan ncoghlan at gmail.com
Mon Jul 6 04:31:38 CEST 2015

On 6 July 2015 at 12:23, Donald Stufft <donald at stufft.io> wrote:
> On July 5, 2015 at 10:18:07 PM, Nick Coghlan (ncoghlan at gmail.com) wrote:
>> What do folks think of the idea of proposing bundling importlib2 with
>> Python 2.7.x (via pip), such that issues like
>> https://bitbucket.org/pypa/setuptools/issue/250/ can be addressed by
>> telling people to enable the Python 3 style import system?
>> That is, Python 2 would still use the legacy import system by default,
>> but Python 3 style imports would just be an "import importlib2;
>> importlib2.install_import_hooks()" away?
>> The main risk I see with the idea is projects deciding to install
>> those hooks as a side effect of their own import.
> If you’re already installing a third party module, isn’t installing
> a second third party module a pretty small amount of additional work?
> IOW, bundling pip made sense because of the bootstrapping problems,
> but once you have pip, directing people to depend on importlib2 isn’t
> very hard if they’re already installing hypotheticalthingthatwoulduseit?

Aye, a docs-only approach could work, and would definitely be easier
to maintain. It may just be a matter of pushing in that direction on
the PyPA side of things, by considering "requires importlib2 on Python
2.7" to be a reasonable requirement for getting some kinds of
operations to work smoothly.


Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia

More information about the Import-SIG mailing list