Using namespace packages? READ THIS
Conversely, if you're not using namespace packages with setuptools, you don't need to read this. Remain calm, everything is fine. :) If you do use them, please read on. Most of what's in here will probably not affect most people anyway, even if they do use namespace packages. But just take a few moments to check and make sure these issues don't apply to you. I just checked in a fix for the issue with namespace packages in system package installation scenarios. This fix unfortunately puts some significant limitations on what you can have in a namespace package __init__.py. Basically, *all* you should have in *every* namespace package __init__.py is: __import__('pkg_resources').declare_namespace(__name__) because the __init__.py files are now *not installed* when using --root or --single-version-externally-managed. So anything else you put in these files, is just not going to work in that case. Now, if you're doing what the ll-libs were doing, where you have one project containing the __init__.py, and the others not containing an __init__.py, and the main package doesn't declare a namespace but the others do, then that scenario will still work. If you don't know what this means, don't worry about it. :) Here's the really goofy part, that you need to deal with if you are currently distributing any win32.exe installers for a project that uses namespace packages: If you build a win32.exe with the latest setuptools in SVN, and your users use easy_install to install it, they *must* upgrade to the latest setuptools as well, or they will get a bunch of stuff about easy_install not knowing how to process various files, and the install will fail. (This is because setuptools now includes additional .pth files to munge namespace package stuff, and the old .exe-to-.egg conversion doesn't know how to handle it.) So anyway, if you care about this scenario (you distribute bdist_wininst win32.exe files but *not* win32.egg files), you should make sure you and your users are on the same setuptools version. But if you provide win32.egg files or do *not* provide win32.exe files, everything's cool.
[Phillip J. Eby wrote]
I just checked in a fix for the issue with namespace packages in system package installation scenarios. This fix unfortunately puts some significant limitations on what you can have in a namespace package __init__.py.
Basically, *all* you should have in *every* namespace package __init__.py is:
__import__('pkg_resources').declare_namespace(__name__)
Pardon my ignorance here. I'd just like to make sure this doesn't affect me if I move my stuff to setuptools. Is a "namespace package __init__.py" file different than, say, the "__init__.py" used in my personal (and mythical) "logging" alternative package: flogging/ __init__.py <---- this guy handlers.py ... ? Trent -- Trent Mick TrentM@ActiveState.com
On Mar 17, 2006, at 5:31 PM, Trent Mick wrote:
[Phillip J. Eby wrote]
I just checked in a fix for the issue with namespace packages in system package installation scenarios. This fix unfortunately puts some significant limitations on what you can have in a namespace package __init__.py.
Basically, *all* you should have in *every* namespace package __init__.py is:
__import__('pkg_resources').declare_namespace(__name__)
Pardon my ignorance here. I'd just like to make sure this doesn't affect me if I move my stuff to setuptools. Is a "namespace package __init__.py" file different than, say, the "__init__.py" used in my personal (and mythical) "logging" alternative package:
flogging/ __init__.py <---- this guy handlers.py ...
Namespace packages support scenarios like zope or twisted where you have a bunch of different packages (zope.interfaces, etc.) that share a common top-level namespace but are distributed separately. zope would be the namespace package. Normal packages, like your theoretical flogging package, are not normally going to be namespace packages. -bob
At 05:31 PM 3/17/2006 -0800, Trent Mick wrote:
Pardon my ignorance here. I'd just like to make sure this doesn't affect me if I move my stuff to setuptools. Is a "namespace package __init__.py" file different than, say, the "__init__.py" used in my personal (and mythical) "logging" alternative package:
flogging/ __init__.py <---- this guy handlers.py ...
Yes, it's different. If you don't know what a namespace package is, you're not using one and don't need to worry. :) Sorry for the false alarm. (A namespace package is one whose contents are distributed as separately-installed components, and it's something that's somewhat tricky to do with the distutils by themselves.)
participants (3)
-
Bob Ippolito -
Phillip J. Eby -
Trent Mick