[Distutils] namespace packages ok to contain code?

"Martin v. Löwis" martin at v.loewis.de
Tue Dec 14 00:57:41 CET 2010


Am 14.12.2010 00:11, schrieb Brad Allen:
> Where I work we're considering a change to moving a group of packages
> to using namespaces. We want the namespace paths to reflect a
> dependency hierarchy, and the current plan requires putting some
> source code into actual module distributions at the level of some of
> the namespace packages.
> 
> Example:
> 
> toplevel.midlevel
> toplevel.midlevel.a
> toplevel.midlevel.b
> 
> Each of these three is a separate module distribution We want to put
> core library code in the midlevel.

This I don't understand. What would be the module name of the core
library?

> Some have warned this is not usually done, but no specific problems
> with this approach have been identified. Any guidance on this would be
> appreciated.

You can't put code into __init__.py of any of the namespace packages.
Otherwise, having additional modules in any of these packages is fine.

Regards,
Martin


More information about the Distutils-SIG mailing list