LazrStyleGuide

Not logged in - Log In / Register

Revision 1 as of 2009-03-13 21:26:10

Clear message

Style Guide for Lazr Projects

Lazr projects are a collection of the open-sourced stand-alone components that Canonical releases.

Lazr projects generally follow the guidelines described in the Hacking document.

__version__ number

The __init__.py should have a __version__ string for the package that is used by setup.py for the packages version.

Guidelines for re-exporting

Sometimes a package wants to re-export code in its __init__.py file. For instance, if your package is essentially a module with tests and documentation, it may be quite ugly to have your users import your code with from foo.bar.bar import Bar. You would prefer to have your code canonically available as foo.bar.Bar.

However, the __init__.py should have a __version__, as described above; when the setup.py tries to import it, it may get an import error when it is trying to build. And coders looking at your package will generally not expect to find much code in your init.py file.

Our compromise is the following: