2.1.
Package naming conventions
Up one level
Going forward, there is consensus that we should use Zope 3 style
programming practices whenever possible. One part of that is that things
that don't need to be Zope 2 products shouldn't live in in
$INSTANCE_HOME/Products/ - instead, they should be simple Python
packages, living in $INSTANCE_HOME/lib/python or somewhere else on the
PYTHONPATH that Zope is given when it starts up.
In doing so, code that is part of Plone core should adhere to the following conventions
Generic components without specific Plone dependencies live
directly under the top-level plone namespace
A good example is the the Zope3-style plone.i18n.
It is desirable to factor out generic interfaces and code into such packages whenever possible, to foster re-use.
Packages should have as few dependencies as possible. Thus, if plain-Python will do, that is better than plain-Zope 3, which is better than code that depends on specific facets of Zope 2.
Extensions of such general components (or separate components)
that provide a tighter integration with Plone-the-application should
live in the secondary namespace plone.app
See for example plone.app.i18n.
Components that need to be Zope 2 products will most likely continue
to live in $INSTANCE_HOME/Products still, at least for now. If possible
(which it may not be), however, you should try to not depend on
components being Zope 2 products.
Packages in the svn repository should follow modern Python guidelines and provide the necessary information to be packagable as eggs
The easiest way of achieving this is to use the ZopeSkel paste deploy script, as follows.
- Download ez_setup.py from PEAK
-
Runez_setup.py in Python:$ python ez_setup.py
This will install the easy_install program, normally to the Place
where the Python binary is found. Look in the log messages of the
installation script to see where they land. For more information, see
the documentation
- Install ZopeSkel:
$ easy_install ZopeSkel==dev
This will install Paste Deploy and the paster script in the same
location as easy_install (again, watch the terminal output) and some
Zope skeletons to use with this tool. To see them, run:
$ paster create --list-templates
- To create a basic Plone package, run:
$ paster create -t plone
It will ask you a number of questions and then generate the basic
package layout. When asked for a project name, use the dotted name of
the package, e.g. plone.i18n.
To create a plone.app package instead, run:
$ paster create -t plone_app
When ready, import the package to the Plone svn repository.
To learn more about setuptools, see its documentation. In particular, see the documentation on development-mode