[openstack-dev] [all] [glance] python namespaces considered harmful to development, lets not introduce more of them

Flavio Percoco flavio at redhat.com
Thu Aug 28 11:13:58 UTC 2014

On 08/28/2014 12:50 PM, Radomir Dopieralski wrote:
> On 28/08/14 12:41, Radomir Dopieralski wrote:
>> On 27/08/14 16:31, Sean Dague wrote:
>> [snip]
>>> In python 2.7 (using pip) namespaces are a bolt on because of the way
>>> importing modules works. And depending on how you install things in a
>>> namespace will overwrite the base __init__.py for the top level part of
>>> the namespace in such a way that you can't get access to the submodules.
>>> It's well known, and every conversation with dstuft that I've had in the
>>> past was "don't use namespaces".
>> I think this is actually a solved problem. You just need a single line
>> in your __init__.py files:
>> https://bitbucket.org/thomaswaldmann/xstatic-jquery/src/tip/xstatic/__init__.py
> More on that at
> http://pythonhosted.org/setuptools/setuptools.html?namespace-packages#namespace-packages

This is not solved. In fact, we already declare the namespace in the
__init__ files. The problem, as Sean mentioned, is the way pip and
setuptools will install this packages, which ends up overwriting the
base __init__ file.

Thanks for the links, though.

Flavio Percoco

More information about the OpenStack-dev mailing list