[Framework-Team] PLIP #MIA - z3c.autoinclude
optilude at gmx.net
Thu Oct 9 20:48:55 UTC 2008
Ethan Jucovy wanted to propose a PLIP for 3.3, which I've seconded. He
has been having problems with plone.org and his laptop, but the text is
pasted below. We'll get it moved to a real PLIP soon, but I'd appreciate
it if you could review it.
Automate ZCML Loading for Plone Plug-ins
Enable automatic plugins for Plone with z3c.autoinclude
autoinclude: ``z3c.autoinclude``, a package
(http://pypi.python.org/pypi/z3c.autoinclude) for automatically
including ZCML files from dependencies and plugins.
Plugin package: a package providing some extended functionality to Plone
activated by execution of ZCML configuration.
Installation of packages that extend Plone's functionality is currently
somewhat burdensome. Most extension packages will provide ZCML that
must be loaded in order for the package to function properly. The
standard way of installing these plugin packages is to use ZCML slugs in
the package-includes directory, typically marked in a buildout.cfg file
for replicability. However, this is a burdensome process: editing the
installed plugins involves editing the buildout.cfg file and re-running
buildout, or adding and removing symlinks and files on the filesystem;
there is no straightforward way to share different permutations of
plugins without making nearly identical copies of buildout.cfg files;
and the process involves unnecessary repetition of package names as
requirements and plugins, a subtlety that integrators, particularly
beginners, might easily overlook. A more automated and implicit system
of loading plugins would eliminate this error-prone process.
Packages signal to autoinclude that they are plugin candidates by
setting a setuptools ``entry_point``, so plugin packages must be
packaged as setuptools eggs.
Explicitly invoke autoinclusion of plugins for Plone. This would look like:
``<includePlugins package="plone.app" />``
at the end of the CMFPlone/configure.zcml file, within the <configure>
Plugin packages would then signal that they should be included by adding
target = plone.app
to their setup.py file.
See Proposal above.
See Proposal above.
autoinclude computes the packages to include at Zope startup, when each
<include*> directive is executed, so it slows down the startup time.
The execution time of the algorithm used is dependent on the number of
entries in ``sys.path``, so this slowdown may become unacceptable in
environments with many eggs installed. This can be mitigated by future
improvements in z3c.autoinclude like optimizations to the algorithm or a
"freeze" script to compute autoinclusion packages once and output to a
Author of `Professional Plone Development`, a book for developers who
want to work with Plone. See http://martinaspeli.net/plone-book
More information about the Framework-Team