[Python-Dev] Discussing the Great Library Reorganization

Brett Cannon brett at python.org
Wed Mar 29 23:39:03 CEST 2006

While this is going to require a PEP (which I am willing to write),
the discussion of adding pysqlite has brought forth some discussion on
naming and packaging in the stdlub.  Perhaps it's time to start
discussing the Great Library Reorganization that has been discussed
for eons.

Here is a place I think we can take a queue from Java.  I think we
should have a root package, 'py', and then have subpackages within
that.  Those subpackages would group the existing modules that are not
already in a nice package hierarchy.  In other words, try to make it
so that importing an actual module takes no more than three dots in
the general case: ``from py.dev import pdb``, etc.

I do think it is okay to put things without proper classification just
under 'py' without being in a subpackage.  The three dots idea is not
hard.  We could, for instance, have a py.dist subpackage and have
pkgutil and distutils under it.  That will make the modules in
distutils take four dots, but that's just life and I think within
reason for something that is not used directly by a large number of

I also have no issue taking certain names from existing modules and
making them both a module directly (as in putting what exists in a
module into __init__.py for the subpackage with the same name) on top
of putting more modules in the subpackage.  The issue I see with this,
though, is people doing something like ``from py import pickle;
pickle.pickletools.dis()``, not realizing they need to import
pickletools directly instead of getting to it through py.pickle .

I don't want to spark a subpackage grouping discussion yet since we
should decide on a general strategy of how we want the basic stdlib
organized.  I also don't want to argue over module renaming directly
since that can be based on what subpackages there might be.


More information about the Python-Dev mailing list