[Linaro-validation] On top-level API (lava.something) and namespace packages

Michael Hudson-Doyle michael.hudson at canonical.com
Tue Jan 24 22:39:47 UTC 2012

On Tue, 24 Jan 2012 12:36:38 +0100, Zygmunt Krynicki <zygmunt.krynicki at linaro.org> wrote:
> For the past few weeks I've been consistently using namespace packages
> (like zope does if you are familiar with that) to streamline LAVA
> APIs. From the end user's point of view there is no difference, for
> developers it is a bit easier as everything comes from a nested lava
> package, like this:
> >>> from lava.serial.console import xxx
> >>> from lava.utils.data_tables.backends import ...
> Technically this means that any python package (thing with a setup.py
> file) can add modules to a shared "lava" namespace. Currently I've
> setup two namespaces: lava. and lava.utils. Eventually I'd like to
> move each lava module there (after a grace period, with possible
> eternal backwards compatibility modules). Unless there is a strong
> voice against adopting this pattern across all new code I'd like to
> request this to be the standard way of writing new modules.

I like the idea, but in the past the implementation of namespace
packages has always seemed like a hack.  The fact that we're no longer
providing debian packages probably helps here.  I don't think s/_/./
makes much difference one way or the other :-)

> For some tips/guides on how to do this please refer to the following
> resources: [1], [2], [3], also, you can look at lava-serial and
> lava-server (the new parts)
> [1]: http://stackoverflow.com/questions/1675734/how-do-i-create-a-namespace-package-in-python
> [2]: http://www.python.org/dev/peps/pep-0382/
> [3]: http://peak.telecommunity.com/DevCenter/setuptools#namespace-packages


More information about the linaro-validation mailing list