Skip to main content

ftw.autofeature automatically registers ZCML features.

Project description

ftw.autofeature automatically registers ZCML features.

Extras features

The autofeature:extras directive automatically registers ZCML features for each extra (extras_requires) of your package. The feature for an extra is automatically provided when each dependency of the extra is installed.


When having a like this:

from setuptools import setup, find_packages


          'tests': ['unittest2'],
          'foo': ['foo', 'foo-compat'],
          'bar': ['bar', 'bar-compat']})

you can let ftw.autofeature automatically declare features for your extras:


    <include package="ftw.autofeature" file="meta.zcml" />
    <autofeature:extras />

    <configure zcml:condition="have my.package:foo">
        <!-- foo things -->

    <configure zcml:condition="have my.package:bar">
        <!-- bar things -->

    <configure zcml:condition="have my.package:foo:bar">
        <!-- foo and bar things -->


The feature my.package:foo is only registered when the extras is installed. When installing both, foo and bar, multiple features are registered so that it easy to combine extras with AND:

  • my.package:foo
  • my.package:foo:bar
  • my.package:bar
  • my.package:bar:foo


We cannot really detect whether the extras was explictly used on installation time. We therefore test whether each dependency in the extras is installed. When each dependency is installed but not the extras explicitly, this will thus also register the feature.

Dump feature

The autofeature:dump directive dumps the currently registered ZCML features to the standard out. Simply use the directive to dump the features at any point in the ZCML:


    <include package="ftw.autofeature" file="meta.zcml" />
    <autofeature:dump />



1.1.0 (2019-09-25)

  • Add Plone 5 support. [jone]

1.0.0 (2015-08-24)

  • Initial implementation [jone]

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for ftw.autofeature, version 1.1.0
Filename, size File type Python version Upload date Hashes
Filename, size ftw.autofeature-1.1.0.tar.gz (13.9 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page