[Python-Dev] Edits to Metadata 1.2 to add extras (optional dependencies)

Daniel Holth dholth at gmail.com
Wed Aug 15 16:49:42 CEST 2012

I've drafted some edits to Metadata 1.2 with valuable feedback from
distutils-sig (special thanks to Erik Bray), which seems to have no
more comments on the issue after about 6 weeks. Let me know if you
have an opinion, or if you will have one during some bounded time in
the future.

Metadata 1.2 (PEP 345), a non-final PEP that has been adopted by
approximately 10 of the latest sdists from pypy, cannot represent the
setuptools "extras" (optional dependencies) feature. This is a problem
because about 1600+ or 10% of the packages hosted on pypy define
"extras" as measured in May of this year.

The edit implements the extras feature by adding a new condition
"extra == 'name'" to the Metadata 1.2 environment markers.
Requirements with this marker are only installed when the named
optional feature is requested. Valid extras for a package must be
declared with Provides-Extra: name.

It also adds Setup-Requires-Dist as a way to specify requirements
needed during an install as opposed to during runtime.

Abbreviated highlights:

Setup-Requires-Dist (multiple use)

Like Requires-Dist, but names dependencies needed while the
distributions's distutils / packaging `setup.py` / `setup.cfg` is run.

Provides-Extra (multiple use)

A string containing the name of an optional feature.


    Requires-Dist: reportlab; extra == 'pdf'

    Requires-Dist: nose; extra == 'test'

    Requires-Dist: sphinx; extra == 'doc'

(full changeset on


Daniel Holth

More information about the Python-Dev mailing list