Distutils/Metadata¶
Legacy Wiki Page
This page was migrated from the old MoinMoin-based wiki. Information may be outdated or no longer applicable. For current documentation, see python.org.
This page describes the work done in order to change the Distutils Metadata.
PEP References :
PEP 241 Metadata 1.0 for Python Software Packages
PEP 314 Metadata 1.1 for Python Software Packages
PEP 345 Draft Metadata 1.2 for Python Software Packages
We are working on a new version for PEP 345. Jim started a branch (jim-update-345)
what has been said:
deprecate Requires/Provides/Obsolete.
add install_requires
deprecate the MANIFEST.in template system in favor of a more powerful package_data
list all the arguments that are passed to vairous commands through setup.py that should land into the new metadata description
see if we want to have a new âpython versionâ metadata (itâs a trove classifier right now)
David Lyonâs comments¶
Package MetaData needs to include:
the documentation file ie index.html / readme.txt etcâŠ
name/location of the examples directory
list of program executeables - (eg define the location of ez_install.exe) otherwise itâs easy for programs to get lost.
name/location of the configuration file (in the case of a ConfigParser compatable config file)
name/location of the tests directory
name/location of data files
The above two are so that the files could be placed in the âcorrectâ location.
For example.. in Windows.. config and data files should go to :
\Documents and Settings\user\Application Data\program name
in linuxâŠ
/home/user/.program name
By making this information available in the metadata, it provides for a cross platform friendly system where the setup.py could conceivably copy all the files into the ârightâ locations.
A Package Manager program could conceivably make this information readily available to the user. Alternatively, in the most conservative case, IDLE, PythonWin, Eclipse would be able to utilise this information and render it to the python user.
Jim Fultonâs comments¶
Having looked at this and spoken to folks over the last few days I have a numbner of observations:
It could be argued that Requires/Provides and install_requires are complementary. At worst, they talk about different things. It is probably still best to deprecate requires and provides as they are likely to be confusing.
(Note that I think it would be valuable to have some way of saying that a package provides a required feature that can be provided by multiple packages, and that could be required by other packages. This should probably be out of scope of the current effort.)
I think that install_requires is the only thing that needs to be added. setuptools provides a number of additional features that people might find useful, but they can still use setuptools to provide those features.
I donât think thet deprecating the existing MANIFEST.in template system needs to be in scope of this effort. I think we should take small incremental steps.
The Python version dependency is already in PEP 345. (Incidentally, I was under the mis-impression that PEP 345 introduced Requires/Provides, but they were introduced in PEP 314.)
To make progress, I donât think it is necessary to release distutils externally. I think it would be enough to get install_requires into Python 2.7 and, if possible 3.1. Since it is compatible with setuptools, people who want it in earlier Python versions can use setuptools as it is now. Iâm not opposed to someone making a separate distutils release, but I donât think the benefit is worth the effort.
I do think it would be very valuable to get install_requires data into PyPI. This raises the question of what to do about dependencies of dependencies on different Python versions.
I think we need a way to handle meta-data extensions. Two use cases:
extra down-stream meta data
entry points
Tres Seaverâs comments¶
After working with Matthias Klose, I honestly cannot see any reason not to just appropriate the âRequires:â, âObsoletes:â, and âProvides:â fields already implemented in PEP 314. There are no other *real* semantics for those fields besides the ones we want.
Note that we need to keep the âPKG-INFOâ fieldnames / semantics distinct from the values passed to âsetup()â: in particular, the âinstall_requiresâ argument could easily map onto the âRequires:â field.
My proposal:
Get the list of existing packages on PyPI which spell âRequires:â, âProvides:â, and âObsoletes:â, and look at the values which are present. See Martin v. Loewisâs stats here:
Update the not-yet-released PEP 345, documenting the desired semantics for the âRequires:â, âProvides:â, and âObsoletes:â fields. In particular, note that the names in these fields are preferentially distutils projects, rather than package / module names. Document the semantics of the version strings according to the consensus proposal
from PyCon (the âverlib.pyâ version).
Update distutils, adding an API for querying values stored in PKG-INFO fields (avoiding running âsetup.pyâ).
Update setuptools such that its âinstall_requiresâ arguments get passed through to the âdistutils.core.Distributionâ constructor as ârequiresâ.
Update setuptools to do âsoftâ requirements on names found in PKG-INFOâs âRequires:â: if no distribution matches the project name, then fall back to assuming that it refers to a package / module.