[Cubicweb] CWEP 0004 - Cubes as distributions

Christophe de Vienne christophe at unlish.com
Thu Oct 23 11:40:04 CEST 2014


Le 23/10/2014 11:02, Nicolas Chauvat a écrit :
> On Thu, Oct 23, 2014 at 10:51:14AM +0200, Christophe de Vienne wrote:
>>> Looking at the debian packages for Mercurial, I see mercurial
>>> extensions are put into dist-packages/hgext/ and can be imported
>>> individually.
>> Yes. But IIRC hgext is not a namespace.
> $ l /usr/lib/python2.7/dist-packages/hgext/__*py
> /usr/lib/python2.7/dist-packages/hgext/__init__.py
>
> Looks like it is.
I meant, it is not a setuptools namespace package. You cannot have 
multiple "hgext" directories across your filesystem acting like a single 
package.

>
> What is wrong with namespaces by the way?
>
> $ python -c "import this" | grep space
> Namespaces are one honking great idea -- let's do more of those!
>

namespaces are great indeed.

But here we would need to split the namespace "cubes" across multiple 
directories. This is made possible by PEP420 [1] in python 3.4.
For older python versions, the solution is to use setuptools namespace 
packages [2]

And this is were the trouble may start. I do not say it must be avoided, 
just that it will add some difficulties along the way.

Christophe


[1] http://legacy.python.org/dev/peps/pep-0420/
[2] https://pythonhosted.org/setuptools/setuptools.html#namespace-packages



More information about the Cubicweb mailing list