[Python-Dev] Re: Christmas Wishlist (original) (raw)
Fred L. Drake, Jr. fred at zope.com
Mon Dec 15 15:51:27 EST 2003
- Previous message: [Python-Dev] Re: Christmas Wishlist
- Next message: [Python-Dev] Re: Christmas Wishlist
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Barry Warsaw writes:
Jim uses the term "pure container package" to describe top-level packages that contain no real content in the package except subpackages. "zope" and "zodb" are examples of this in Zope 3. IWBNI Python had better/easier support for weaving together pure container package contents where subdirectories live in different locations on the file system.
+1
The .pth files processed by site.py support two interesting kinds of lines:
directories that should be added to sys.path, and
import statements
The later alone is interesting enough, since it allows arbitrary initialization code to run when the import is executed. This still happens before all the .pth files have been processed; I suspect we really want the container package to be a little more flexible than that, at least allowing their path to be computed after all .pth files have been processed.
Perhaps it would be nice to have a hook (probably in sys) that gets called after site/sitecustomize are done? A "pure container package" could use a .pth file using "import mypackage", and the package's init.py would register a hook function in sys that searches sys.path for whatever directories should be used in mypackage.path. This also avoids the code being too specific to one way of thinking about packages.
-Fred
-- Fred L. Drake, Jr. PythonLabs at Zope Corporation
- Previous message: [Python-Dev] Re: Christmas Wishlist
- Next message: [Python-Dev] Re: Christmas Wishlist
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]