Search code examples
plonesetuptoolsbuildoutdexteritygrok

Developing grok-style Dexterity add-ons in Plone 4.3


According to:

To use grok-style declarations in Plone 4.3 one must install Dexterity via buildout with setuptools extras requirements: grok and relations (referring to extras_require definitions in plone.app.dexterity's setup.py). But what should add-on developers who want to perform this configuration on behalf of end users do?

With my collective.project add-on, I have copied the extras_require from plone.app.dexterity:

setup(
    author='Alex Clark',
    author_email='[email protected]',
    description='Demo app: project management with dexterity content types.',
    entry_points={
        'z3c.autoinclude.plugin': 'target = plone',
    },
    extras_require = {
        'test': [
            'plone.app.testing',
            'unittest2'
            ],
        'grok': [
            'five.grok',
            'plone.directives.dexterity',
            'plone.directives.form >=1.1dev',
            ],
        'relations': [
            'plone.app.relationfield',
            'plone.app.intid',
            'z3c.relationfield',
            ]
    },

This allows end users to install collective.project simply by adding to a list of eggs e.g.

[plone]
recipe = plone.recipe.zope2instance
eggs =
  Pillow
  Plone
  collective.project

Is this a reasonable approach?


Solution

  • No, it is not. Do not copy the extras_require from plone.app.dexterity, it doesn't help (though maybe including the extras_require as install_requires would work, but that would defeat the purpose of extras_require)

    However, you can use a similar syntax as Buildout uses to specify extras_require in setup.py:

    install_requires=[
        'setuptools',
        'plone.app.dexterity[grok]',
    ],