[Python-ideas] namespace for backported stdlib modules?

Georg Brandl g.brandl at gmx.net
Tue Oct 21 11:34:03 CEST 2014


On 10/21/2014 03:18 AM, Robert Collins wrote:
> I want to make the improvements in unittest (which transitively
> includes mock and traceback and perhaps inspect ...) available for
> folk that can't use 3.5 yet.
> 
> 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.
> 
> 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.
> 
> So we'd have e.g.
> stdlib.unittest
> stdlib.traceback
> stdlib.mock
> 
> And then using that would be done through the normal
> 
> try:
>     from stdlib import unitest
> except ImportError:
>     import unittest

Seeing this as a newcomer, I'd be wondering which one is the one that's
actually coming from the standard library.

Please don't commandeer "stdlib" for something that's *not* the stdlib.

Georg



More information about the Python-ideas mailing list