[Distutils] setuptools' "Feature" feature

Tres Seaver tseaver at palladion.com
Fri Jul 2 20:29:20 CEST 2010

Hash: SHA1

I haven't found any docs (outside the code) for the
setuptools.dist.Feature, or for how it operates with the rest of the
ecosystem.  Can somebody confirm or correct my understanding of them?

- - Feature instances represent optionally-included bits of the

- - Normally, features are disabled by default, and can be enabled
  by passing '--with-<featurename>' to setup.py.

- - Features declared as 'standard' are enabled by default, and can be
  disabled by passing '--without-<featurename>' to setup.py.

- - Features have an 'available' attribute, which can be set to False
  in setup.py to disable a feature based on runtime introspection
  (e.g., using sys.version_info or os.name).

- - It appears that it should be possible to pass an instance with
  a '__nonzero__' method as the 'available':  the code seems only
  to use it in boolean tests.

- - Features may depend on (force inclusion of) other features.

- - Enabled features do their actual work by adding **kwargs to
  the args passed directly to setup.py

- - Distributions created via an invocation to setup.py are not labeled
  in any way to indicate any '--with-<featurename>' (or '--without')
  passed to setup.py during their creation.

- - There is no way to enable / disable a feature when installing a
  distribution via easy_install.

The particular use case which led me to investigate Features was easing
packaging of projects with optional C extensions, such that they could
be installable on Jython, IronPython, Windows, or GAE.  It doesn't seem
possible to figure out whether a compiler actually exists:  jython's
distutils lies and creates a compiler which raises exceptions, for instance.

- --
Tres Seaver          +1 540-429-0999          tseaver at palladion.com
Palladion Software   "Excellence by Design"    http://palladion.com
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org


More information about the Distutils-SIG mailing list