[Distutils] Setuptools: omit namespace package directories?
Jim Fulton
jim at zope.com
Thu Feb 8 19:24:42 CET 2007
On Feb 8, 2007, at 11:05 AM, Thomas Lotze wrote:
> Hi,
>
> when using namespace packages, the corresponding package
> directories and
> __init__.py files must physically exist in the source tree, even
> though
> they can't, by definition of a namespace package, contain anything
> other
> than subordinate directories and a fixed stanza of Python code, resp.
>
> This gets annoying, especially when using nested namespaces. For
> example,
> when writing a buildout recipe, the cleanest thing is to use several
> namespaces, like zc.recipe.egg does.
I don't agree that this is cleanest. I made a mistake by introducing
the recipe namespace. New recipes I write won't use this. "Flat is
better than nested." Also, for smaller projects, I'm avoiding
intermediate src directories to avoid the annoying nesting. (I'm a
little uneasy about this, but can't see a serious downside other than
setup being importable in develop mode.)
> However, you end up jumping through
> essentially empty directories all the time while working on the
> source.
Yup
> There's evidence that this problem is a real one: buildout recipes
> registered with PyPI tend to omit the "recipe" part at the expense of
> namespace hygiene and PEP 8 compliance, for example gocept.download or
> buildout_script.
IMO, the only needed hygiene is the top-level namespace. (Maybe a
huge organization would need sub namespaces, but we don't.)
> Since there's basically not information in those boilerplate
> directories
> and __init__.py files that couldn't be inferred from a keyword
> parameter
> to setup(), would it be a sensible feature request that setuptools do
> without the physical namespace directories in the future?
I would love to see this. I haven't been able to think of a good way
to do it reliably, especially considering the important use case of
develop eggs, which want to run directly from a checkout.
Again, for smaller project, the pain can be mitigated by skipping the
src directory and avoiding nested namespaces.
Jim
--
Jim Fulton mailto:jim at zope.com Python Powered!
CTO (540) 361-1714 http://www.python.org
Zope Corporation http://www.zope.com http://www.zope.org
More information about the Distutils-SIG
mailing list