← Back to team overview

maas-devel team mailing list archive

Python code reorganization

 

Gavin and I are thinking about reorganising the python packages
structure a bit.  The main goal or this reorganisation to stop the
proliferation of python packages in src/.  Instead of having top-level
python packages 'maasserver', 'metadataserver', etc. we would have only
one top-level python package (named 'maas') which would contain
'maasserver', 'metadataserver', etc. (i.e 'from metadataserver.models
import NodeKey' → 'from maas.metadataserver.models import NodeKey').

= Current situation =

Right now src/ contains:
- 'apiclient', the MAAS OAuth API connection library.
- 'maas', the Django project (that is the code which contains all the
configuration to make the Django applications work together and provide
the MAAS web application)
- 'maasserver', Django application which contains the MAAS web/api code.
- 'maastesting', Helper package which contains code to help testing MAAS
(ex. test object factory, utilities to test JS code, etc.)
- 'metadataserver', Django application which contains the metadata code.
- 'provisioningserver', Python library which contains all the code to
talk to cobbler and the more recent celery tasks code.

All these packages but 'maastesting' and 'maas' will become top-level
python packages when one will install the 'maas' Ubuntu package.

- 'maastesting' isn't shipped in the package because it simply contains
utilities useful for testing the code.
- 'maas' is the Django project and it contains only configuration
information about how to glue the Django applications (maasserver and
metadataserver) together.  Practically, that package (not being on the
general python path) is loaded dynamically by the wsgi utility script.

= Proposed reorganisation =

South makes it tricky to rename South-enabled applications so right now
our focus is to reorganise the code without changing the names of the
Django applications.

The first change is to rename 'maas' to 'maasapp'.  This is much more
logical because, as I said earlier, this package is the home of the wsgi
MAAS application.  Because it is not a top-level python package, no one
should have to manually import from this so the main goal of this rename
is to move it out of the way.

The second change would be to move 'apiclient', 'maasserver' and
'metadataserver' inside src/maas.  This would mean that all the code for
the MAAS server would be inside a single package called 'maas'.

'provisioningserver' is a little bit special because it contains the
code of the workers and in the near future it will need to be also
packaged in a different package (something like 'maas-worker').  We
might want to keep it a separate package but rename it to
'maasprovision' (we want to have 'maas' as a prefix for all the
maas-related modules).


Thoughts?

R.


Follow ups