[Grok-dev] Re: Autoincluding ZCML for package dependencies
Tres Seaver
tseaver at palladion.com
Tue Jan 22 11:56:58 EST 2008
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Martijn Faassen wrote:
> Hey Ethan,
>
> Ethan Jucovy wrote:
>> My colleague Robert Marianski and I are at the Snow Sprint and we've
>> been having a lot of fun looking at Grok. We've been working with
>> Martijn for the past couple of days on a package to automatically
>> include ZCML for a project's required dependencies (by looking at
>> `install_requires`) to eliminate the need for redundant "<include
>> package='...'>"s. I've just written a blog post about this code and
>> our work on it which I thought some of you might be interested in
>> (here: http://www.openplans.org/projects/opencore/blog/2008/01/21/automatic-inclusion-of-zcml/
>> ).
>
> For people following along, we hope to land this feature in Grok at some
> point (post-sprint, probably, but perhaps pre-1.0?). This feature will
> allow people to just add dependencies to their setup.py without having
> to worry managing includes of ZCML. This should make reuse of existing
> components a bit easier -- it's one less thing to forget --, and that's
> good, right?
Right up to the point that it is hell (like Zope2's DWIM), Can we do
this by adding a setuptools plugin / entry point handler which at least
requires an explicit gesture in the setup.py? We wouldn't be repeating
ourselves (by requiring an <include/> tag in the ZCML), but it would be
explicit. E.g.:
from setuptools import setup
setup(# ...
configure_dependency_zcml=True,
)
If the plugin is installed, it would look for the keyword in the
arguments to setup, and do the Right THing. Or perhaps it could be
signalled via an import:
try:
import megrok.majyk
except ImportError:
pass # extension not installed, user must manually configure ZCML
Or setup.py could declare a convention for entry points which signalled
that dependencies were to be automagically configured:
setup(#...
entry_points={
'grok.zcml_majyk': '*',
}
)
The last would likely be handled by registering a subscriber for
application startup, which would then use pkg_reousces to query the
named entry points and find the dependencies.
Tres.
- --
===================================================================
Tres Seaver +1 540-429-0999 tseaver at palladion.com
Palladion Software "Excellence by Design" http://palladion.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
iD8DBQFHliBZ+gerLs4ltQ4RAmtmAKDSDXrsb4rShq94y1iCQvoOKrdL2wCgnPek
0IPtNbd/RQL0Lzwo3A/QLUQ=
=zi/P
-----END PGP SIGNATURE-----
More information about the Grok-dev
mailing list