Personal tools
You are here: Home Documentation Manuals Plone Core Developer Reference Conventions and professional practice Package naming conventions
Support

Get Help

Join our chat rooms or support forums if you have more specific questions.

Plone Training
Learn how to design, build, and deploy a website in Plone through one of the numerous Plone training sessions around the world.
Find Plone training…
 
Document Actions

2.1. Package naming conventions

Up one level
How to name Python packages that contain plain-Python or Zope 3 components and thus do not need to live in the 'Products' directory.

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.

  1. Download ez_setup.py from PEAK
  2. Run ez_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

  1. 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

  1. 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

by Martin Aspeli last modified August 6, 2006 - 15:11
Contributors: Martin Aspeli, Hanno Schlichting, Whit Morris
All content is copyright Plone Foundation and the individual contributors.

For any issues with the web site functionality, please file a ticket.

Please consult the policy on plone.org content if you want your content published on this site.

Servers and hosting by