[Python-ideas] namespace for backported stdlib modules?

Robert Collins robertc at robertcollins.net
Tue Oct 21 11:48:18 CEST 2014


On 21 October 2014 21:09, Victor Stinner <victor.stinner at gmail.com> wrote:
> Hi,
>
> 2014-10-21 3:18 GMT+02:00 Robert Collins <robertc at robertcollins.net>:
>> We've currently got the unittest2 and mock as modules on pypi, and
>> clearly we can add another e.g. traceback2 as a way to get the
>> traceback changes out there.
>
> Why not contributing to the unittest2 module instead of creating yet
> another project?

Huh, thats exactly what I'm doing. Remember: unittest2 *is* unittest,
just broken out and shipped on PyPI for older Python releases. I'm
talking purely about the mechanics of doing that distribution and
examining ways I might make it cheaper: unittest2 hasn't been updated
in ~2 years and if we're going to keep it up to date it needs to be
low overhead.

> Would it be possible to work on unittest2 and mock to make them "compatible"?

Not sure what you mean here.

>> I'm wondering though if perhaps putting up a namespace package on pypi
>> for things in the stdlib - e.g. 'stdlib' (or stdlib2 or something)
>> would make sense. In particular that might permit relative imports to
>> automatically pick up the other also backported modules without source
>> changes.
>
> In my experience, namespaces with Python < 3.3 only means pain. I only
> got issues with the "oslo" namespace created with a hack in a .pth
> file for oslo.config, oslo.rootwrap, etc.

Yeah, 3.3 makes it lovely, and I put some patches into importlib2
(same as unittest2 - a backport of importlib for older pythons) to
make that better, but its got a bit of a thorny issue to resolve
w.r.t. relative imports before it can be used as the default importer.

> FYI there a list on the Python wiki:
> https://wiki.python.org/moin/StandardLibraryBackports

Thanks. Turns out thats incomplete, I'll figure out a login for that
later and see about adding importlib2.

-Rob



-- 
Robert Collins <rbtcollins at hp.com>
Distinguished Technologist
HP Converged Cloud


More information about the Python-ideas mailing list