[Distutils] conventions or best practice to choose package names?

Benoît Bryon benoit at marmelune.net
Fri Jun 29 18:29:32 CEST 2012


Le 29/06/2012 17:59, Paul Moore a écrit :
> On 29 June 2012 14:05, Benoît Bryon<benoit at marmelune.net>  wrote:
>> I agree that "foo.ext.bar" seems nice... but it uses 3
>> namespace levels. It breaks the "avoid deep nesting"
>> rule, which recommends not more than two levels.
>> So the PEP can't recommend this pattern, or we will also have
>> to reconsider the "avoid deep nesting" rule.
> ??? I thought the PEP was about distribution naming (i.e., things
> published on PyPI.

It is about naming, limited to packaging, but not limited to things 
published on PyPI.

> If the package "foo" is published under that name
> on PyPI, I see no reason it can't (good taste permitting) use
> multi-level names like foo.bar.baz internally. That's a completely
> different question than whether a distribution named foo.bar.baz
> should be available for download from PyPI (presumably alongside
> foo.bar.bip and foo.bop.boop...)

I understood the foo.ext.bar example as:

* foo is a namespace package
* foo.ext is a namespace package
* foo project invites users to publish contributions as foo.ext.*

If foo is a project without namespace packages, then, yes, the PEP 
proposal doesn't cover its internal code organization.

> Maybe I'm misunderstanding the conversation here. We need to be
> *extremely* precise about the differences between distributions
> (things published to somewhere like PyPI, which can be installed
> independently, and have a version number, etc) and packages (which are
> things you import in Python). I've been just as vague as everyone else
> in this thread, so I'm not trying to blame anyone. But things are
> definitely getting muddled.

The terminology reference used in the PEP proposal is 
https://bitbucket.org/benoitbryon/cpython/src/doc-package-names/Doc/packaging/introduction.rst 
(which is http://docs.python.org/dev/packaging/introduction.html + some 
changes related to the PEP proposal).

The PEP proposal deals with :

* the "name" argument passed to packaging.core.setup() or 
setuptools.setup(), i.e. project name
* names of packages or modules being distributed, as a consequence of 
the "use a single name" rule


Benoit


More information about the Distutils-SIG mailing list