[openstack-dev] [all] [glance] python namespaces considered harmful to development, lets not introduce more of them
Chris Dent
chdent at redhat.com
Wed Aug 27 15:10:21 UTC 2014
On Wed, 27 Aug 2014, Sean Dague wrote:
> Here is the problem when it comes to working with code from git, in
> python, that uses namespaces, it's kind of a hack that violates the
> principle of least surprise.
It's true this problem does happen...
> So I'd like us to revisit using a namespace for glance, and honestly,
> for other places in OpenStack, because these kinds of violations of the
> principle of least surprise is something that I'd like us to be actively
> minimizing.
...but on the otherhand using namespaces can be really handy. For
sake of example, the thing I used to work on (TiddlyWeb) using
namespace packages for plugins. The namespace is (surprise)
'tiddlywebplugins'[1].
To get around the issues you're describing, especially during
development, we cooked up an ugly hack called the "mangler" that
establishes the namespace properly. You can see a sample in Tank,
which is a plugin for TiddlyWeb:
https://github.com/cdent/tank/blob/master/mangler.py
Yes, it's ooogly, but if you want namespaces (and under the right
circumstances they can be "one honking great idea"), it helps. May
be something to steal there.
[1] I do think, when using namespaces, that you must have a namespace
for the extensions different from whatever the thing being
extended is using.
--
Chris Dent tw:@anticdent freenode:cdent
https://tank.peermore.com/tanks/cdent
More information about the OpenStack-dev
mailing list