[Python-Dev] Keyword meanings [was: Accept just PEP-0426] (original) (raw)

Daniel Holth dholth at gmail.com
Thu Dec 6 14:39:56 CET 2012


On Thu, Dec 6, 2012 at 6:33 AM, Donald Stufft <donald.stufft at gmail.com>wrote:

On Thursday, December 6, 2012 at 6:28 AM, Vinay Sajip wrote:

Donald Stufft <donald.stufft gmail.com> writes: Never mind the "Obsoletes" information - even the more useful "Requires-Dist" information is not exposed via PyPI, even though it appears to be stored in the database. (Or if it is, please point me to where - I must have missed it.) Requires-Dist doesn't exist for more than a handful of packages. But PyPI exposes it via the XMLRPC API, possibly the JSON api as well.

Even if this were to be made available, it's presumably obtained from PKG-INFO. As I understand, this data is not considered reliable - for example, pip runs egginfo on downloaded packages to get updated information when determining dependencies to be downloaded. If the Requires-Dist info in PKG-INFO can't be relied on, surely less critical information such as Obsoletes can't be relied on, either? pip runs egginfo because setuptools does not write out to PKG-INFO what the dependencies are (it does write it out to a different text file though). But IIRC that text file is not guaranteed to exist in the distribution. There's also the history where pip was trying to preserve as much backwards compat with easyinstall as it could, and if you used the file that egginfo writes out then you'll only get the requirements for the system that the distribution was packaged on. Any if statements that affect the dependencies won't be in effect.

It will be Obsoleted-By:. The "drop in replacement" requirement will be removed. The package manager will say "you are using these obsolete packages; check out these non-obsolete ones" but will not automatically pull the replacement without a Requires tag.

I will probably add the unambiguous Conflicts: tag "uninstall this other package if I am installed".

Many packages (IIRC more than half) have the pre-Metadata-1.2 equivalent of Requires-Dist: which is the very easy to parse requires.txt. This information is not reliable because it could depend on conditions in setup.py. Someone should write a setup.py compiler that determines whether a package's requirements are conditional or not.

Environment markers (limited Python expressions at the end of Requires-Dist lines) attempt to make Requires-Dist reliable. You can execute them safely in your environment to determine whether a requirement is right for you:

Requires-Dist: pywin32 (>1.0); sys.platform == 'win32'

The wheel implementation makes sure all the metadata (the .dist-info directory) is at the end of the .zip archive. It's possible to read the metadata with a single HTTP partial request for the end of the archive without downloading the entire archive. -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.python.org/pipermail/python-dev/attachments/20121206/287a6031/attachment.html>



More information about the Python-Dev mailing list