Fwd: PEP 426 is now the draft spec for distribution metadata 2.0
FYI ---------- Forwarded message ---------- From: Nick Coghlan <ncoghlan@gmail.com> Date: Sun, Feb 17, 2013 at 8:10 PM Subject: PEP 426 is now the draft spec for distribution metadata 2.0 To: "DistUtils mailing list\"\"" <distutils-sig@python.org> The latest draft of PEP 426 is up at http://www.python.org/dev/peps/pep-0426/ Major changes since the last draft: 1. Metadata-Version is 2.0 rather than 1.3, and the field now has the same major.minor semantics as are defined for wheel versions in PEP 427 (i.e. if a tool sees a major version number it doesn't recognise, it should give up rather than trying to guess what to do with it, while it's OK to process a higher minor version) 2. The "Private-Version" field is added, and several examples are given showing how to use it in conjunction with translated public versions when a project wants to use a version numbering scheme that the standard installation tools won't understand. 3. The environment markers section more clearly covers the need to handle parentheses (this was mentioned in the text, but not the pseudo-grammar), and the fields which support those markers have an explicit cross-reference to that section of the spec. 4. Leading/trailing whitespace and date based versioning are explicitly excluded from valid public versions 5. Version compatibility statistics are provided for this PEP relative to PEP 386 (the analysis script has been added to the PEP repo if anyone wants to check my numbers) 6. I have reclaimed BDFL-Delegate status (with Guido's approval) Since getting wheel support into pip no longer depends on this version of the metadata spec, I plan to leave it open for comment for another week, and then accept it next weekend if I don't hear any significant objections. Regards, Nick. ========================== PEP: 426 Title: Metadata for Python Software Packages 2.0 Version: $Revision$ Last-Modified: $Date$ Author: Daniel Holth <dholth@fastmail.fm>, Donald Stufft <donald@stufft.io>, Nick Coghlan <ncoghlan@gmail.com> BDFL-Delegate: Nick Coghlan <ncoghlan@gmail.com> Discussions-To: Distutils SIG Status: Draft Type: Standards Track Content-Type: text/x-rst Created: 30 Aug 2012 Post-History: 14 Nov 2012, 5 Feb 2013, 7 Feb 2013, 9 Feb 2013 Abstract ======== This PEP describes a mechanism for adding metadata to Python distributions. It includes specifics of the field names, and their semantics and usage. This document specifies version 2.0 of the metadata format. Version 1.0 is specified in PEP 241. Version 1.1 is specified in PEP 314. Version 1.2 is specified in PEP 345. Version 2.0 of the metadata format adds fields designed to make third-party packaging of Python Software easier and defines a formal extension mechanism. It also adds support for optional features of distributions and allows the description to be placed into a payload section. Finally, this version addresses several issues with the previous iteration of the standard version identification scheme. Metadata files ============== The syntax defined in this PEP is for use with Python distribution metadata files. The file format is a simple UTF-8 encoded Key: value format with case-insensitive keys and no maximum line length, optionally followed by a blank line and a payload containing a description of the distribution. This format is parseable by the ``email`` module with an appropriate ``email.policy.Policy()``. When ``metadata`` is a Unicode string, ```email.parser.Parser().parsestr(metadata)`` is a serviceable parser. There are three standard locations for these metadata files: * the ``PKG-INFO`` file included in the base directory of Python source distribution archives (as created by the distutils ``sdist`` command) * the ``{distribution}-{version}.dist-info/METADATA`` file in a ``wheel`` binary distribution archive (as described in PEP 425, or a later version of that specification) * the ``{distribution}-{version}.dist-info/METADATA`` files in a local Python installation database (as described in PEP 376, or a later version of that specification) Other tools involved in Python distribution may also use this format. Encoding ======== Metadata 2.0 files are UTF-8 with the restriction that keys must be ASCII. Parser implementations should be aware that older versions of the Metadata specification do not specify an encoding. Metadata header fields ======================= This section specifies the names and semantics of each of the supported fields in the metadata header. In a single Metadata 2.0 file, fields marked with "(optional)" may occur 0 or 1 times. Fields marked with "(multiple use)" may be specified 0, 1 or more times. Only "Metadata-Version", "Name", "Version", and "Summary" must appear exactly once. The fields may appear in any order within the header section of the file. Metadata-Version ---------------- Version of the file format; "2.0" is the only legal value. Automated tools should warn if ``Metadata-Version`` is greater than the highest version they support, and must fail if ``Metadata-Version`` has a greater major version than the highest version they support. Example:: Metadata-Version: 2.0 Name ---- The name of the distribution. Example:: Name: BeagleVote Version ------- The distribution's public version identifier. Public versions are designed for consumption by automated tools and are strictly ordered according to a defined scheme. See `Version scheme`_ below. Example:: Version: 1.0a2 Summary ------- A one-line summary of what the distribution does. Example:: Summary: A module for collecting votes from beagles. Private-Version (optional) -------------------------- An arbitrary private version label. Private version labels are intended for internal use by a project, and cannot be used in version specifiers. See `Compatibility with other version schemes`_ below. Examples:: Private-Version: 1.0.0-alpha.1 Private-Version: 1.3.7+build.11.e0f985a Private-Version: v1.8.1.301.ga0df26f Private-Version: 2013.02.17.dev123 Description (optional, deprecated) ---------------------------------- Starting with Metadata 2.0, the recommended place for the description is in the payload section of the document, after the last header. The description does not need to be reformatted when it is included in the payload. See `Describing the Distribution`_ for more information on the expected contents of this field. Since a line separator immediately followed by another line separator indicates the end of the headers section, any line separators in a ``Description`` header field must be suffixed by whitespace to indicate continuation. It is an error to provide both a ``Description`` header and a metadata payload. Keywords (optional) ------------------- A list of additional whitespace separated keywords to be used to assist searching for the distribution in a larger catalog. Example:: Keywords: dog puppy voting election Home-page (optional) -------------------- A string containing the URL for the distribution's home page. Example:: Home-page: http://www.example.com/~cschultz/bvote/ Download-URL (optional) ----------------------- A string containing the URL from which this version of the distribution can be downloaded. (This means that the URL can't be something like ".../BeagleVote-latest.tgz", but instead must be ".../BeagleVote-0.45.tgz".) Project-URL (multiple use) -------------------------- A string containing a label and a browsable URL for the project, separated by the last occurrence of comma and space ", ". The label consists of any permitted header text, including commas. Example:: Bug, Issue Tracker, http://bitbucket.org/tarek/distribute/issues/ Author (optional) ----------------- A string containing the author's name at a minimum; additional contact information may be provided. Example:: Author: C. Schultz, Universal Features Syndicate, Los Angeles, CA <cschultz@peanuts.example.com> Author-email (optional) ----------------------- A string containing the author's e-mail address. It contains a name and e-mail address in the RFC 5322 recommended ``Address Specification`` format. Example:: Author-email: "C. Schultz" <cschultz@example.com> Maintainer (optional) --------------------- A string containing the maintainer's name at a minimum; additional contact information may be provided. Note that this field is intended for use when a project is being maintained by someone other than the original author: it should be omitted if it is identical to ``Author``. Example:: Maintainer: C. Schultz, Universal Features Syndicate, Los Angeles, CA <cschultz@peanuts.example.com> Maintainer-email (optional) --------------------------- A string containing the maintainer's e-mail address. It has the same format as ``Author-email``. Note that this field is intended for use when a project is being maintained by someone other than the original author: it should be omitted if it is identical to ``Author-email``. Example:: Maintainer-email: "C. Schultz" <cschultz@example.com> License (optional) ------------------ Text indicating the license covering the distribution where the license is not a selection from the "License" Trove classifiers. See "Classifier" below. This field may also be used to specify a particular version of a license which is named via the ``Classifier`` field, or to indicate a variation or exception to such a license. Examples:: License: This software may only be obtained by sending the author a postcard, and then the user promises not to redistribute it. License: GPL version 3, excluding DRM provisions The full text of the license would normally be included in a separate file. Classifier (multiple use) ------------------------- Each entry is a string giving a single classification value for the distribution. Classifiers are described in PEP 301 [2]. `Environment markers`_ may be used with this field. Examples:: Classifier: Development Status :: 4 - Beta Classifier: Environment :: Console (Text Based) Provides-Dist (multiple use) ---------------------------- Each entry contains a string naming a requirement that is satisfied by installing this distribution. These strings must be of the form ``Name`` or ``Name (Version)``, following the formats of the corresponding field definitions. A distribution may provide additional names, e.g. to indicate that multiple projects have been merged into and replaced by a single distribution or to indicate that this project is a substitute for another. For instance, distribute (a fork of setuptools) can include a ``Provides-Dist: setuptools`` entry to prevent the conflicting package from being downloaded and installed when distribute is already installed. A distribution that has been merged with another might ``Provides-Dist`` the obsolete name(s) to satisfy any projects that require the obsolete distribution's name. A distribution may also provide a "virtual" project name, which does not correspond to any separately-distributed project: such a name might be used to indicate an abstract capability which could be supplied by one of multiple projects. E.g., multiple projects might supply RDBMS bindings for use by a given ORM: each project might declare that it provides ``ExampleORM-somedb-bindings``, allowing other projects to depend only on having at least one of them installed. A version declaration may be supplied and must follow the rules described in `Version scheme`_. The distribution's version identifier will be implied if none is specified. `Environment markers`_ may be used with this field. Examples:: Provides-Dist: ThisProject Provides-Dist: AnotherProject (3.4) Provides-Dist: virtual_package Provides-Extra (multiple use) ----------------------------- A string containing the name of an optional feature. Must be printable ASCII, not containing whitespace, comma (,), or square brackets []. May be used to make a dependency conditional on whether the optional feature has been requested. See `Optional Features`_ for details on the use of this field. Example:: Name: beaglevote Provides-Extra: pdf Requires-Dist: reportlab; extra == 'pdf' Requires-Dist: nose; extra == 'test' Requires-Dist: sphinx; extra == 'doc' Obsoleted-By (optional) ----------------------- Indicates that this project is no longer being developed. The named project provides a substitute or replacement. A version declaration may be supplied and must follow the rules described in `Version specifiers`_. Possible uses for this field include handling project name changes and project mergers. Examples:: Name: BadName Obsoleted-By: AcceptableName Name: SeparateProject Obsoleted-By: MergedProject (>=4.0.0) Requires-Dist (multiple use) ---------------------------- Each entry contains a string naming some other distutils project required by this distribution. The format of a requirement string is identical to that of a distribution name (e.g., as found in the ``Name:`` field) optionally followed by a version declaration within parentheses. The distribution names should correspond to names as found on the `Python Package Index`_; often the same as, but distinct from, the module names as accessed with ``import x``. `Environment markers`_ may be used with this field. Version declarations must follow the rules described in `Version specifiers`_ Distributions may also depend on optional features of other distributions. See `Optional Features`_ for details. Examples:: Requires-Dist: pkginfo Requires-Dist: PasteDeploy Requires-Dist: zope.interface (>3.5.0) Dependencies mentioned in ``Requires-Dist`` may be installed exclusively at run time and are not guaranteed to be available when creating or installing a package. If a dependency is needed during distribution creation or installation *and* at run time, it should be listed under both ``Requires-Dist`` and ``Setup-Requires-Dist``. Setup-Requires-Dist (multiple use) ---------------------------------- Like ``Requires-Dist``, but names dependencies needed in order to build, package or install the distribution -- in distutils, a dependency imported by ``setup.py`` itself. Commonly used to bring in extra compiler support or a package needed to generate a manifest from version control. Examples:: Setup-Requires-Dist: custom_setup_command Dependencies mentioned in ``Setup-Requires-Dist`` may be installed exclusively for setup and are not guaranteed to be available at run time. If a dependency is needed during distribution creation or installation *and* at run time, it should be listed under both ``Requires-Dist`` and ``Setup-Requires-Dist``. Requires-Python (multiple use) ------------------------------ This field specifies the Python version(s) that the distribution is guaranteed to be compatible with. `Environment markers`_ may be used with this field. Version declarations must be in the format specified in `Version specifiers`_. Examples:: Requires-Python: 3.2 Requires-Python: >3.1 Requires-Python: >=2.3.4 Requires-Python: >=2.5,<2.7 If specified multiple times, the Python version must satisfy all such constraints to be considered compatible. This is most useful in combination with appropriate `Environment markers`_. For example, if a feature was initially introduced to Python as a Unix-specific addition, and then Windows support was added in the subsequent release, this could be indicated with the following pair of entries:: Requires-Python: >= 3.1 Requires-Python: >= 3.2; sys.platform == 'win32' Requires-External (multiple use) -------------------------------- Each entry contains a string describing some dependency in the system that the distribution is to be used. This field is intended to serve as a hint to downstream project maintainers, and has no semantics which are meaningful to the ``distutils`` distribution. The format of a requirement string is a name of an external dependency, optionally followed by a version declaration within parentheses. `Environment markers`_ may be used with this field. Because they refer to non-Python software releases, version identifiers for this field are **not** required to conform to the format described in `Version scheme`_: they should correspond to the version scheme used by the external dependency. Notice that there is no particular rule on the strings to be used. Examples:: Requires-External: C Requires-External: libpng (>=1.5) Platform (multiple use) ----------------------- A Platform specification describing an operating system supported by the distribution which is not listed in the "Operating System" Trove classifiers. See `Classifier`__ above. __ `Classifier (multiple use)`_ Examples:: Platform: ObscureUnix Platform: RareDOS Supported-Platform (multiple use) --------------------------------- Binary distributions containing a metadata file will use the Supported-Platform field in their metadata to specify the OS and CPU for which the binary distribution was compiled. The semantics of the Supported-Platform field are not specified in this PEP. Example:: Supported-Platform: RedHat 7.2 Supported-Platform: i386-win32-2791 Extension (multiple use) ------------------------ An ASCII string, not containing whitespace or the ``/`` character, that indicates the presence of extended metadata. The additional fields defined by the extension are then prefixed with the name of the extension and the ``/`` character. For example:: Extension: Chili Chili/Type: Poblano Chili/Heat: Mild To avoid name conflicts, it is recommended that distribution names be used to identify metadata extensions. This practice will also make it easier to find authoritative documentation for metadata extensions. As the order of the metadata headers is not constrained, the ``Extension: Chili`` field may appear before or after the corresponding extension fields ``Chili/Type:`` etc. Values in extension fields must still respect the general formatting requirements for metadata headers. A bare ``Extension: Name`` entry with no corresponding extension fields is permitted. It may, for example, indicate the expected presence of an additional metadata file rather than the presence of extension fields. An extension field with no corresponding ``Extension: Name`` entry is an error. Describing the distribution =========================== The distribution metadata should include a longer description of the distribution that may run to several paragraphs. Software that deals with metadata should not assume any maximum size for the description. The recommended location for the description is in the metadata payload, separated from the header fields by at least one completely blank line (that is, two successive line separators with no other characters between them, not even whitespace). Alternatively, the description may be provided in the `Description`__ metadata header field. Providing both a ``Description`` field and a payload is an error. __ `Description (optional, deprecated)`_ The distribution description can be written using reStructuredText markup [1]_. For programs that work with the metadata, supporting markup is optional; programs may also display the contents of the field as plain text without any special formatting. This means that authors should be conservative in the markup they use. Version scheme ============== Public version identifiers must comply with the following scheme:: N[.N]+[{a|b|c|rc}N][.postN][.devN] Version identifiers which do not comply with this scheme are an error. Version identifiers must not include leading or trailing whitespace. Any given version will be a "release", "pre-release", "post-release" or "developmental release" as defined in the following sections. .. note:: Some hard to read version identifiers are permitted by this scheme in order to better accommodate the wide range of versioning practices across existing public and private Python projects. Accordingly, some of the versioning practices which are technically permitted by the PEP are strongly discouraged for new projects. Where this is the case, the relevant details are noted in the following sections. Releases -------- A release number is a version identifier that consists solely of one or more non-negative integer values, separated by dots:: N[.N]+ Releases within a project must be numbered in a consistently increasing fashion. Ordering considers the numeric value of each component in turn, with "component does not exist" sorted ahead of all numeric values. Date based release numbers are explicitly excluded from compatibility with this scheme, as they hinder automatic translation to other versioning schemes, as well as preventing the adoption of semantic versioning without changing the name of the project. Accordingly, a leading release component greater than or equal to ``1980`` is an error. While any number of additional components after the first are permitted under this scheme, the most common variants are to use two components ("major.minor") or three components ("major.minor.micro"). For example:: 0.9 0.9.1 0.9.2 ... 0.9.10 0.9.11 1.0 1.0.1 1.1 2.0 2.0.1 A release series is any set of release numbers that start with a common prefix. For example, ``3.3.1``, ``3.3.5`` and ``3.3.9.45`` are all part of the ``3.3`` release series. .. note:: Using both ``X.Y`` and ``X.Y.0`` as distinct release numbers within the scope of a single release series is strongly discouraged, as it makes the version ordering ambiguous for human readers. Automated tools should either treat this case as an error, or else interpret an ``X.Y.0`` release as coming *after* the corresponding ``X.Y`` release. The recommended practice is to always use release numbers of a consistent length (that is, always include the trailing ``.0``). An acceptable alternative is to consistently omit the trailing ``.0``. The example above shows both styles, always including the ``.0`` at the second level and consistently omitting it at the third level. Pre-releases ------------ Some projects use an "alpha, beta, release candidate" pre-release cycle to support testing by their users prior to a full release. If used as part of a project's development cycle, these pre-releases are indicated by a suffix appended directly to the last component of the release number:: X.YaN # Alpha release X.YbN # Beta release X.YcN # Release candidate (alternative notation: X.YrcN) X.Y # Full release The pre-release suffix consists of an alphabetical identifier for the pre-release phase, along with a non-negative integer value. Pre-releases for a given release are ordered first by phase (alpha, beta, release candidate) and then by the numerical component within that phase. .. note:: Using both ``c`` and ``rc`` to identify release candidates within the scope of a single release is strongly discouraged, as it makes the version ordering ambiguous for human readers. Automated tools should either treat this case as an error, or else interpret all ``rc`` versions as coming after all ``c`` versions (that is, ``rc1`` indicates a later version than ``c2``). Post-releases ------------- Some projects use post-releases to address minor errors in a release that do not affect the distributed software (for example, correcting an error in the release notes). If used as part of a project's development cycle, these post-releases are indicated by a suffix appended directly to the last component of the release number:: X.Y.postN # Post-release The post-release suffix consists of the string ``.post``, followed by a non-negative integer value. Post-releases are ordered by their numerical component, immediately following the corresponding release, and ahead of any subsequent release. .. note:: The use of post-releases to publish maintenance releases containing actual bug fixes is strongly discouraged. In general, it is better to use a longer release number and increment the final component for each maintenance release. Post-releases are also permitted for pre-releases:: X.YaN.postM # Post-release of an alpha release X.YbN.postM # Post-release of a beta release X.YcN.postM # Post-release of a release candidate .. note:: Creating post-releases of pre-releases is strongly discouraged, as it makes the version identifier difficult to parse for human readers. In general, it is substantially clearer to simply create a new pre-release by incrementing the numeric component. Developmental releases ---------------------- Some projects make regular developmental releases, and system packagers (especially for Linux distributions) may wish to create early releases which do not conflict with later project releases. If used as part of a project's development cycle, these developmental releases are indicated by a suffix appended directly to the last component of the release number:: X.Y.devN # Developmental release The developmental release suffix consists of the string ``.dev``, followed by a non-negative integer value. Developmental releases are ordered by their numerical component, immediately before the corresponding release (and before any pre-releases), and following any previous release. Developmental releases are also permitted for pre-releases and post-releases:: X.YaN.devM # Developmental release of an alpha release X.YbN.devM # Developmental release of a beta release X.YcN.devM # Developmental release of a release candidate X.Y.postN.devM # Developmental release of a post-release .. note:: Creating developmental releases of pre-releases is strongly discouraged, as it makes the version identifier difficult to parse for human readers. In general, it is substantially clearer to simply create additional pre-releases by incrementing the numeric component. Developmental releases of post-releases are also strongly discouraged, but they may be appropriate for projects which use the post-release notation for full maintenance releases which may include code changes. Examples of compliant version schemes ------------------------------------- The standard version scheme is designed to encompass a wide range of identification practices across public and private Python projects. In practice, a single project attempting to use the full flexibility offered by the scheme would create a situation where human users had difficulty figuring out the relative order of versions, even though the rules above ensure all compliant tools will order them consistently. The following examples illustrate a small selection of the different approaches projects may choose to identify their releases, while still ensuring that the "latest release" and the "latest stable release" can be easily determined, both by human users and automated tools. Simple "major.minor" versioning:: 0.1 0.2 0.3 1.0 1.1 ... Simple "major.minor.micro" versioning:: 1.1.0 1.1.1 1.1.2 1.2.0 ... "major.minor" versioning with alpha, beta and release candidate pre-releases:: 0.9 1.0a1 1.0a2 1.0b1 1.0c1 1.0 1.1a1 ... "major.minor" versioning with developmental releases, release candidates and post-releases for minor corrections:: 0.9 1.0.dev1 1.0.dev2 1.0.dev3 1.0.dev4 1.0rc1 1.0rc2 1.0 1.0.post1 1.1.dev1 ... Summary of permitted suffixes and relative ordering --------------------------------------------------- .. note:: This section is intended primarily for authors of tools that automatically process distribution metadata, rather than authors of Python distributions deciding on a versioning scheme. The numeric release component of version identifiers should be sorted in the same order as Python's tuple sorting when the release number is parsed as follows:: tuple(map(int, release_number.split("."))) Within a numeric release (``1.0``, ``2.7.3``), the following suffixes are permitted and are ordered as shown:: .devN, aN, bN, cN, rcN, <no suffix>, .postN Note that `rc` will always sort after `c` (regardless of the numeric component) although they are semantically equivalent. Tools are free to reject this case as ambiguous and remain in compliance with the PEP. Within an alpha (``1.0a1``), beta (``1.0b1``), or release candidate (``1.0c1``, ``1.0rc1``), the following suffixes are permitted and are ordered as shown:: .devN, <no suffix>, .postN Within a post-release (``1.0.post1``), the following suffixes are permitted and are ordered as shown:: devN, <no suffix> Note that ``devN`` and ``postN`` must always be preceded by a dot, even when used immediately following a numeric version (e.g. ``1.0.dev456``, ``1.0.post1``). Within a given suffix, ordering is by the value of the numeric component. The following example covers many of the possible combinations:: 1.0.dev456 1.0a1 1.0a2.dev456 1.0a12.dev456 1.0a12 1.0b1.dev456 1.0b2 1.0b2.post345.dev456 1.0b2.post345 1.0c1.dev456 1.0c1 1.0 1.0.post456.dev34 1.0.post456 1.1.dev1 Version ordering across different metadata versions --------------------------------------------------- Metadata v1.0 (PEP 241) and metadata v1.1 (PEP 314) do not specify a standard version identification or ordering scheme. This PEP does not mandate any particular approach to handling such versions, but acknowledges that the de facto standard for ordering them is the scheme used by the ``pkg_resources`` component of ``setuptools``. Software that automatically processes distribution metadata may either treat non-compliant version identifiers as an error, or attempt to normalize them to the standard scheme. This means that projects using non-compliant version identifiers may not be handled consistently across different tools, even when correctly publishing the earlier metadata versions. Distribution developers can help ensure consistent automated handling by marking non-compliant versions as "hidden" on the Python Package Index (removing them is generally undesirable, as users may be depending on those specific versions being available). Distribution users may also wish to remove non-compliant versions from any private package indexes they control. For metadata v1.2 (PEP 345), the version ordering described in this PEP should be used in preference to the one defined in PEP 386. Compatibility with other version schemes ---------------------------------------- Some projects may choose to use a version scheme which requires translation in order to comply with the public version scheme defined in this PEP. In such cases, the `Private-Version`__ field can be used to record the project specific version as an arbitrary label, while the translated public version is given in the `Version`_ field. __ `Private-Version (optional)`_ This allows automated distribution tools to provide consistently correct ordering of published releases, while still allowing developers to use the internal versioning scheme they prefer for their projects. Semantic versioning ~~~~~~~~~~~~~~~~~~~ `Semantic versioning`_ is a popular version identification scheme that is more prescriptive than this PEP regarding the significance of different elements of a release number. Even if a project chooses not to abide by the details of semantic versioning, the scheme is worth understanding as it covers many of the issues that can arise when depending on other distributions, and when publishing a distribution that others rely on. The "Major.Minor.Patch" (described in this PEP as "major.minor.micro") aspects of semantic versioning (clauses 1-9 in the 2.0.0-rc-1 specification) are fully compatible with the version scheme defined in this PEP, and abiding by these aspects is encouraged. Semantic versions containing a hyphen (pre-releases - clause 10) or a plus sign (builds - clause 11) are *not* compatible with this PEP and are not permitted in the public `Version`_ field. One possible mechanism to translate such private semantic versions to compatible public versions is to use the ``.devN`` suffix to specify the appropriate version order. .. _Semantic versioning: http://semver.org/ DVCS based version labels ~~~~~~~~~~~~~~~~~~~~~~~~~ Many build tools integrate with distributed version control systems like Git and Mercurial in order to add an identifying hash to the version identifier. As hashes cannot be ordered reliably such versions are not permitted in the public `Version`_ field. As with semantic versioning, the public ``.devN`` suffix may be used to uniquely identify such releases for publication, while the private version field is used to record the original version label. Date based versions ~~~~~~~~~~~~~~~~~~~ As with other incompatible version schemes, date based versions can be stored in the ``Private-Version`` field. Translating them to a compliant version is straightforward: the simplest approach is to subtract the year of the first release from the major component in the release number. Version specifiers ================== A version specifier consists of a series of version clauses, separated by commas. Each version clause consists of an optional comparison operator followed by a version identifier. For example:: 0.9, >= 1.0, != 1.3.4, < 2.0 Each version identifier must be in the standard format described in `Version scheme`_. The comma (",") is equivalent to a logical **and** operator. Comparison operators must be one of ``<``, ``>``, ``<=``, ``>=``, ``==`` or ``!=``. The ``==`` and ``!=`` operators are strict - in order to match, the version supplied must exactly match the specified version, with no additional trailing suffix. However, when no comparison operator is provided along with a version identifier ``V``, it is equivalent to using the following pair of version clauses:: >= V, < V+1 where ``V+1`` is the next version after ``V``, as determined by incrementing the last numeric component in ``V`` (for example, if ``V == 1.0a3``, then ``V+1 == 1.0a4``, while if ``V == 1.0``, then ``V+1 == 1.1``). This approach makes it easy to depend on a particular release series simply by naming it in a version specifier, without requiring any additional annotation. For example, the following pairs of version specifiers are equivalent:: 2 >= 2, < 3 3.3 >= 3.3, < 3.4 Whitespace between a conditional operator and the following version identifier is optional, as is the whitespace around the commas. Pre-releases of any kind, including developmental releases, are implicitly excluded from all version specifiers, *unless* a pre-release or developmental developmental release is explicitly mentioned in one of the clauses. For example, this specifier implicitly excludes all pre-releases and development releases of later versions:: >= 1.0 While these specifiers would include them:: >= 1.0a1 >= 1.0c1 >= 1.0, != 1.0b2 >= 1.0, < 2.0.dev123 Dependency resolution tools should use the above rules by default, but should also allow users to request the following alternative behaviours: * accept already installed pre-releases for all version specifiers * retrieve and install available pre-releases for all version specifiers Dependency resolution tools may also allow the above behaviour to be controlled on a per-distribution basis. Post-releases and purely numeric releases receive no special treatment - they are always included unless explicitly excluded. Given the above rules, projects which include the ``.0`` suffix for the first release in a series, such as ``2.5.0``, can easily refer specifically to that version with the clause ``2.5.0``, while the clause ``2.5`` refers to that entire series. Projects which omit the ".0" suffix for the first release of a series, by using a version string like ``2.5`` rather than ``2.5.0``, will need to use an explicit clause like ``>= 2.5, < 2.5.1`` to refer specifically to that initial release. Some examples: * ``Requires-Dist: zope.interface (3.1)``: any version that starts with 3.1, excluding pre-releases. * ``Requires-Dist: zope.interface (==3.1)``: equivalent to ``Requires-Dist: zope.interface (3.1)``. * ``Requires-Dist: zope.interface (3.1.0)``: any version that starts with 3.1.0, excluding pre-releases. Since that particular project doesn't use more than 3 digits, it also means "only the 3.1.0 release". * ``Requires-Python: 3``: Any Python 3 version, excluding pre-releases. * ``Requires-Python: >=2.6,<3``: Any version of Python 2.6 or 2.7, including post-releases (if they were used for Python). It excludes pre releases of Python 3. * ``Requires-Python: 2.6.2``: Equivalent to ">=2.6.2,<2.6.3". So this includes only Python 2.6.2. Of course, if Python was numbered with 4 digits, it would include all versions of the 2.6.2 series, excluding pre-releases. * ``Requires-Python: 2.5``: Equivalent to ">=2.5,<2.6". * ``Requires-Dist: zope.interface (3.1,!=3.1.3)``: any version that starts with 3.1, excluding pre-releases of 3.1 *and* excluding any version that starts with "3.1.3". For this particular project, this means: "any version of the 3.1 series but not 3.1.3". This is equivalent to: ">=3.1,!=3.1.3,<3.2". * ``Requires-Python: >=3.3a1``: Any version of Python 3.3+, including pre-releases like 3.4a1. Depending on distributions that use non-compliant version schemes ----------------------------------------------------------------- A distribution using this version of the metadata standard may need to depend on another distribution using an earlier version of the metadata standard and a non-compliant versioning scheme. The normal ``Requires-Dist`` and ``Setup-Requires-Dist`` fields can be used for such dependencies, so long as the dependency itself can be expressed using a compliant version specifier. For more exotic dependencies, a metadata extension would be needed in order to express the dependencies accurately while still obeying the restrictions on standard version specifiers. The ``Requires-External`` field may also be used, but would not be as amenable to automatic processing. Environment markers =================== An **environment marker** is a marker that can be added at the end of a field after a semi-colon (";"), to add a condition about the execution environment. Here are some example of fields using such markers:: Requires-Dist: pywin32 (>1.0); sys.platform == 'win32' Requires-Dist: foo (1,!=1.3); platform.machine == 'i386' Requires-Dist: bar; python_version == '2.4' or python_version == '2.5' Requires-External: libxslt; 'linux' in sys.platform The micro-language behind this is a simple subset of Python: it compares only strings, with the ``==`` and ``in`` operators (and their opposites), and with the ability to combine expressions. Parentheses are supported for grouping. The pseudo-grammar is :: MARKER: EXPR [(and|or) EXPR]* EXPR: ("(" MARKER ")") | (SUBEXPR [(in|==|!=|not in) SUBEXPR]) where ``SUBEXPR`` belongs to any of the following (the details after the colon in each entry define the value represented by that subexpression): * ``python_version``: '%s.%s' % (sys.version_info[0], sys.version_info[1]) * ``python_full_version``: sys.version.split()[0] * ``os.name````: os.name * ``sys.platform````: sys.platform * ``platform.version``: platform.version() * ``platform.machine``: platform.machine() * ``platform.python_implementation``: = platform.python_implementation() * ``extra``: (name of requested feature) or None * ``'text'``: a free string, like ``'2.4'``, or ``'win32'`` Notice that ``in`` and ``not in`` are restricted to strings, meaning that it is not possible to use other sequences like tuples or lists on the right side. The fields that benefit from this marker are: * ``Requires-Python`` * ``Requires-External`` * ``Requires-Dist`` * ``Provides-Dist`` * ``Classifier`` Optional features ================= Distributions may use the ``Provides-Extra`` field to declare additional features that they provide. Environment markers may then be used to indicate that particular dependencies are needed only when a particular optional feature has been requested. Other distributions then require an optional feature by placing it inside square brackets after the distribution name when declaring the dependency. Multiple features can be requisted by separating them with a comma within the brackets. The full set of dependency requirements is then the union of the sets created by first evaluating the `Requires-Dist` fields with `extra` set to `None` and then to the name of each requested feature. Example:: Requires-Dist: beaglevote[pdf] -> requires beaglevote, reportlab at run time Setup-Requires-Dist: beaglevote[test, doc] -> requires beaglevote, sphinx, nose at setup time It is legal to specify `Provides-Extra` without referencing it in any `Requires-Dist`. It is an error to request a feature name that has not been declared with `Provides-Extra`. The following feature names are implicitly defined for all distributions: - `test`: dependencies that are needed in order to run automated tests - `doc`: dependencies that are needed in order to generate documentation Listing these implicit features explicitly in a ``Provides-Extra`` field is permitted, but not required. Updating the metadata specification =================================== The metadata specification may be updated with clarifications without requiring a new PEP or a change to the metadata version. Adding new features (other than through the extension mechanism), or changing the meaning of existing fields, requires a new metadata version defined in a new PEP. Summary of differences from \PEP 345 ==================================== * Metadata-Version is now 2.0, with semantics specified for handling version changes * Most fields are now optional * Explicit permission for in-place clarifications without releasing a new version of the specification * General reformatting of the PEP to make it easier to read * Values are now expected to be UTF-8 * Changed the version scheme * added the new ``Private-Version`` field * changed the top level sort position of the ``.devN`` suffix * allowed single value version numbers * explicit exclusion of leading or trailing whitespace * explicit criterion for the exclusion of date based versions * incorporated the version scheme directly into the PEP * Changed interpretation of version specifiers * implicitly exclude pre-releases unless explicitly requested * treat post releases the same way as unqualified releases * Discuss ordering and dependencies across metadata versions * Clarify use of parentheses for grouping in environment marker pseudo-grammar * Support for packaging, build and installation dependencies * the new ``Setup-Requires-Dist`` field * Optional feature mechanism * the new ``Provides-Extra`` field * ``extra`` expression defined for environment markers * optional feature support in ``Requires-Dist`` * Metadata extension mechanism * the new ``Extension`` field and extension specific fields * Updated obsolescence mechanism * the new ``Obsoleted-By`` field * the ``Obsoletes-Dist`` field has been removed * Simpler description format * the ``Description`` field is now deprecated * A payload (containing the description) may appear after the headers. * Other changed fields: - ``Requires-Python`` (explicitly flagged as multiple use) - ``Project-URL`` (commas permitted in labels) * Clarified fields: - ``Provides-Dist`` - ``Keywords`` The rationale for major changes is given in the following sections. Metadata-Version semantics -------------------------- The semantics of major and minor version increments are now specified, and follow the same model as the format version semantics specified for the wheel format in PEP 427: minor version increments must behave reasonably when processed by a tool that only understand earlier metadata versions with the same major version, while major version increments may include changes that are not compatible with existing tools. The major version number of the specification has been incremented accordingly, as interpreting PEP 426 metadata in accordance with earlier metadata specifications is unlikely to give the expected behaviour. Whenever the major version number of the specification is incremented, it is expected that deployment will take some time, as metadata consuming tools much be updated before other tools can safely start producing the new format. Standard encoding and other format clarifications ------------------------------------------------- Several aspects of the file format, including the expected file encoding, were underspecified in previous versions of the metadata standard. To make it easier to develop interoperable tools, these details are now explicitly specified. Changing the version scheme --------------------------- The new ``Private-Version`` field is intended to make it clearer that the constraints on public version identifiers are there primarily to aid in the creation of reliable automated dependency analysis tools. Projects are free to use whatever versioning scheme they like internally, so long as they are able to translate it to something the dependency analysis tools will understand. The key change in the version scheme in this PEP relative to that in PEP 386 is to sort top level developmental releases like ``X.Y.devN`` ahead of alpha releases like ``X.Ya1``. This is a far more logical sort order, as projects already using both development releases and alphas/betas/release candidates do not want their developmental releases sorted in between their release candidates and their full releases. There is no rationale for using ``dev`` releases in that position rather than merely creating additional release candidates. The updated sort order also means the sorting of ``dev`` versions is now consistent between the metadata standard and the pre-existing behaviour of ``pkg_resources`` (and hence the behaviour of current installation tools). Making this change should make it easier for affected existing projects to migrate to the latest version of the metadata standard. Another change to the version scheme is to allow single number versions, similar to those used by non-Python projects like Mozilla Firefox, Google Chrome and the Fedora Linux distribution. This is actually expected to be more useful for version specifiers (allowing things like the simple ``Requires-Python: 3`` rather than the more convoluted ``Requires-Python: >= 3.0, < 4``), but it is easier to allow it for both version specifiers and release numbers, rather than splitting the two definitions. The exclusion of leading and trailing whitespace was made explicit after a couple of projects with version identifiers differing only in a trailing ``\n`` character were found on PyPI. The exclusion of major release numbers that looks like dates was implied by the overall text of PEP 386, but not clear in the definition of the version scheme. This exclusion has been made clear in the definition of the release component. Finally, as the version scheme in use is dependent on the metadata version, it was deemed simpler to merge the scheme definition directly into this PEP rather than continuing to maintain it as a separate PEP. This will also allow all of the distutils-specific elements of PEP 386 to finally be formally rejected. The following statistics provide an analysis of the compatibility of existing projects on PyPI with the specified versioning scheme (as of 16th February, 2013). * Total number of distributions analysed: 28088 * Distributions with no releases: 248 / 28088 (0.88 %) * Fully compatible distributions: 24142 / 28088 (85.95 %) * Compatible distributions after translation: 2830 / 28088 (10.08 %) * Compatible distributions after filtering: 511 / 28088 (1.82 %) * Distributions sorted differently after translation: 38 / 28088 (0.14 %) * Distributions sorted differently without translation: 2 / 28088 (0.01 %) * Distributions with no compatible releases: 317 / 28088 (1.13 %) The two remaining sort order discrepancies picked up by the analysis are due to a pair of projects which have published releases ending with a carriage return, alongside releases with the same version number, only *without* the trailing carriage return. The sorting discrepancies after translation relate mainly to differences in the handling of pre-releases where the standard mechanism is considered to be an improvement. For example, the existing pkg_resources scheme will sort "1.1beta1" *after* "1.1b2", whereas the suggested standard translation for "1.1beta1" is "1.1b1", which sorts *before* "1.1b2". Similarly, the pkg_resources scheme will sort "-dev-N" pre-releases differently from "devN" pre-releases when they occur within the same release, while the standard scheme will normalize both representations to ".devN" and sort them by the numeric component. For comparison, here are the corresponding analysis results for PEP 386: * Total number of distributions analysed: 28088 * Distributions with no releases: 248 / 28088 (0.88 %) * Fully compatible distributions: 23874 / 28088 (85.00 %) * Compatible distributions after translation: 2786 / 28088 (9.92 %) * Compatible distributions after filtering: 527 / 28088 (1.88 %) * Distributions sorted differently after translation: 96 / 28088 (0.34 %) * Distributions sorted differently without translation: 14 / 28088 (0.05 %) * Distributions with no compatible releases: 543 / 28088 (1.93 %) These figures make it clear that only a relatively small number of current projects are affected by these changes. However, some of the affected projects are in widespread use (such as Pinax and selenium). The changes also serve to bring the standard scheme more into line with developer's expectations, which is an important element in encouraging adoption of the new metadata version. The script used for the above analysis is available at [3]_. A more opinionated description of the versioning scheme ------------------------------------------------------- As in PEP 386, the primary focus is on codifying existing practices to make them more amenable to automation, rather than demanding that existing projects make non-trivial changes to their workflow. However, the standard scheme allows significantly more flexibility than is needed for the vast majority of simple Python packages (which often don't even need maintenance releases - many users are happy with needing to upgrade to a new feature release to get bug fixes). For the benefit of novice developers, and for experienced developers wishing to better understand the various use cases, the specification now goes into much greater detail on the components of the defined version scheme, including examples of how each component may be used in practice. The PEP also explicitly guides developers in the direction of semantic versioning (without requiring it), and discourages the use of several aspects of the full versioning scheme that have largely been included in order to cover esoteric corner cases in the practices of existing projects and in repackaging software for Linux distributions. Changing the interpretation of version specifiers ------------------------------------------------- The previous interpretation of version specifiers made it very easy to accidentally download a pre-release version of a dependency. This in turn made it difficult for developers to publish pre-release versions of software to the Python Package Index, as leaving the package set as public would lead to users inadvertently downloading pre-release software, while hiding it would defeat the purpose of publishing it for user testing. The previous interpretation also excluded post-releases from some version specifiers for no adequately justified reason. The updated interpretation is intended to make it difficult to accidentally accept a pre-release version as satisfying a dependency, while allowing pre-release versions to be explicitly requested when needed. Packaging, build and installation dependencies ---------------------------------------------- The new ``Setup-Requires-Dist`` field allows a distribution to indicate when a dependency is needed to package, build or install the distribution, rather than being needed to run the software after installation. This should allow distribution tools to effectively support a wider range of distribution requirements. Support for optional features of distributions ---------------------------------------------- The new ``Provides-Extra`` field allows distributions to declare optional features, and to use environment markers to reduce their dependencies when those features are not requested. Environment markers may also be used to require a later version of Python when particular features are requested. The ``Requires-Dist`` and ``Setup-Requires-Dist`` fields then allow distributions to require optional features of other distributions. The ``test`` and ``doc`` features are implicitly defined for all distributions, as one key motivation for this feature is to encourage distributions to explicitly declare the dependencies needed to run their automatic tests, or build their documentation, without demanding those dependencies be present in order to merely install or use the software. Support for metadata extensions ------------------------------- The new ``Extension`` field effectively allows sections of the metadata namespace to be delegated to other distributions, while preserving a standard overal format metadata format for easy of processing by distribution tools that do not support a particular extension. It also works well in combination with the new ``Setup-Requires-Dist`` field to allow a distribution to depend on tools which *do* know how to handle the chosen extension, and the new optional features mechanism, allowing support for particular extensions to be provided as optional features. Updated obsolescence mechanism ------------------------------ The marker to indicate when a project is obsolete and should be replaced has been moved to the obsolete project (the new ``Obsoleted-By`` field), replacing the previous marker on the replacement project (the removed ``Obsoletes-Dist`` field). This should allow distribution tools to more easily warn users of obsolete projects and their suggested replacements. The ``Obsoletes-Dist`` header is removed rather than deprecated as it is not widely supported, and so removing it does not present any significant barrier to tools and projects adopting the new metadata format. Simpler description format -------------------------- Distribution descriptions are often quite long, sometimes including a short guide to using the module. Moving them into the file payload allows them to be formatted neatly as reStructuredText without needing to carefully avoid the introduction of a blank line that would terminate the header section. The ``Description`` header is deprecated rather than removed to support easier conversion of existing tools and projects to the new metadata format. References ========== This document specifies version 2.0 of the metadata format. Version 1.0 is specified in PEP 241. Version 1.1 is specified in PEP 314. Version 1.2 is specified in PEP 345. The initial attempt at a standardised version scheme, along with the justifications for needing such a standard can be found in PEP 386. .. [1] reStructuredText markup: http://docutils.sourceforge.net/ .. _`Python Package Index`: http://pypi.python.org/pypi/ .. [2] PEP 301: http://www.python.org/dev/peps/pep-0301/ .. [3] Version compatibility analysis script: http://hg.python.org/peps/file/default/pep-0426/pepsort.py Appendix ======== Parsing and generating the Metadata 2.0 serialization format using Python 3.3:: # Metadata 2.0 demo from email.generator import Generator from email import header from email.parser import Parser from email.policy import Compat32 from email.utils import _has_surrogates class MetadataPolicy(Compat32): max_line_length = 0 continuation_whitespace = '\t' def _sanitize_header(self, name, value): if not isinstance(value, str): return value if _has_surrogates(value): raise NotImplementedError() else: return value def _fold(self, name, value, sanitize): body = ((self.linesep+self.continuation_whitespace) .join(value.splitlines())) return ''.join((name, ': ', body, self.linesep)) if __name__ == "__main__": import sys import textwrap pkg_info = """\ Metadata-Version: 2.0 Name: package Version: 0.1.0 Summary: A package. Description: Description =========== A description of the package. """ m = Parser(policy=MetadataPolicy()).parsestr(pkg_info) m['License'] = 'GPL' description = m['Description'] description_lines = description.splitlines() m.set_payload(description_lines[0] + '\n' + textwrap.dedent('\n'.join(description_lines[1:])) + '\n') del m['Description'] # Correct if sys.stdout.encoding == 'UTF-8': Generator(sys.stdout, maxheaderlen=0).flatten(m) Copyright ========= This document has been placed in the public domain. -- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia -- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia
On Sun, 17 Feb 2013 20:11:23 +1000 Nick Coghlan <ncoghlan@gmail.com> wrote:
Major changes since the last draft:
1. Metadata-Version is 2.0 rather than 1.3, and the field now has the same major.minor semantics as are defined for wheel versions in PEP 427 (i.e. if a tool sees a major version number it doesn't recognise, it should give up rather than trying to guess what to do with it, while it's OK to process a higher minor version)
So is it possible to bundle several versioned metadata files in order to maximize compatibility? Or does a distribution with 2.0 metadata have to abandon all hope of being compatible with all tools? Regards Antoine.
On Sun, 17 Feb 2013 20:11:23 +1000 Nick Coghlan <ncoghlan@gmail.com> wrote:
Major changes since the last draft:
1. Metadata-Version is 2.0 rather than 1.3, and the field now has the same major.minor semantics as are defined for wheel versions in PEP 427 (i.e. if a tool sees a major version number it doesn't recognise, it should give up rather than trying to guess what to do with it, while it's OK to process a higher minor version)
So is it possible to bundle several versioned metadata files in order to maximize compatibility? Or does a distribution with 2.0 metadata have to abandon all hope of being compatible with all tools? Regards Antoine. _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/dholth%40gmail.com Not likely to matter for a while as the current md v1 tools don't understand this new obsolescence rule :-)
On Sun, Feb 17, 2013 at 1:45 PM, Daniel Holth <dholth@gmail.com> wrote:
Not likely to matter for a while as the current md v1 tools don't understand this new obsolescence rule :-)
Using a separate file for post-obsolescence-rule metadata versions would allow coexistance, which would likely improve adoption. -Fred -- Fred L. Drake, Jr. <fred at fdrake.net> "A storm broke loose in my mind." --Albert Einstein
On 18 Feb 2013 04:54, "Fred Drake" <fred@fdrake.net> wrote:
On Sun, Feb 17, 2013 at 1:45 PM, Daniel Holth <dholth@gmail.com> wrote:
Not likely to matter for a while as the current md v1 tools don't
understand
this new obsolescence rule :-)
Using a separate file for post-obsolescence-rule metadata versions would allow coexistance, which would likely improve adoption.
Perhaps, but not something we actually need to worry about until we're contemplating metadata 3.0, especially since whether or not it helps will depend on why we're breaking backwards compatibility. At the very least, updated wheel, sdist and installation database specs would be needed to allow multiple versions of the metadata. As Daniel pointed out, easy_install and pip also don't follow this rule yet, so it won't really have any impact if we never get to metadata 3.0. Cheers, Nick.
-Fred
-- Fred L. Drake, Jr. <fred at fdrake.net> "A storm broke loose in my mind." --Albert Einstein _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe:
http://mail.python.org/mailman/options/python-dev/ncoghlan%40gmail.com
On Sun, Feb 17, 2013 at 4:21 PM, Nick Coghlan <ncoghlan@gmail.com> wrote:
As Daniel pointed out, easy_install and pip also don't follow this rule yet, so it won't really have any impact if we never get to metadata 3.0.
Actually, my point was that using a separate filename for version 2.0 would allow provision of both 1.x and 2.0, so version 2.0 metadata can be deployed as tool support becomes available, instead of having to wait until 1.x tools are replaced. Once tools are following the new rule about version compatibility, there's less worry about this (at least on my part). -Fred -- Fred L. Drake, Jr. <fred at fdrake.net> "A storm broke loose in my mind." --Albert Einstein
On 18 Feb 2013 08:36, "Fred Drake" <fred@fdrake.net> wrote:
On Sun, Feb 17, 2013 at 4:21 PM, Nick Coghlan <ncoghlan@gmail.com> wrote:
As Daniel pointed out, easy_install and pip also don't follow this rule
yet,
so it won't really have any impact if we never get to metadata 3.0.
Actually, my point was that using a separate filename for version 2.0 would allow provision of both 1.x and 2.0, so version 2.0 metadata can be deployed as tool support becomes available, instead of having to wait until 1.x tools are replaced.
Once tools are following the new rule about version compatibility, there's less worry about this (at least on my part).
None of sdist, wheel or the installation database currently support parallel metadata versions. Interpreting 2.0 metadata as 1.1 also won't be catastrophically wrong in general, especially if the production tools still also ship the legacy dependency and entry points data as separate files. The worst thing that is likely to happen is an old tool may fail to show a 2.0 style description. However, I *will* update the PEP to state explicitly that tools should emit the lowest required metadata version for the fields being published. Cheers, Nick.
-Fred
-- Fred L. Drake, Jr. <fred at fdrake.net> "A storm broke loose in my mind." --Albert Einstein
On Mon, Feb 18, 2013 at 9:54 AM, Nick Coghlan <ncoghlan@gmail.com> wrote:
On 18 Feb 2013 08:36, "Fred Drake" <fred@fdrake.net> wrote:
On Sun, Feb 17, 2013 at 4:21 PM, Nick Coghlan <ncoghlan@gmail.com> wrote:
As Daniel pointed out, easy_install and pip also don't follow this rule yet, so it won't really have any impact if we never get to metadata 3.0.
Actually, my point was that using a separate filename for version 2.0 would allow provision of both 1.x and 2.0, so version 2.0 metadata can be deployed as tool support becomes available, instead of having to wait until 1.x tools are replaced.
Once tools are following the new rule about version compatibility, there's less worry about this (at least on my part).
None of sdist, wheel or the installation database currently support parallel metadata versions. Interpreting 2.0 metadata as 1.1 also won't be catastrophically wrong in general, especially if the production tools still also ship the legacy dependency and entry points data as separate files. The worst thing that is likely to happen is an old tool may fail to show a 2.0 style description.
However, I *will* update the PEP to state explicitly that tools should emit the lowest required metadata version for the fields being published.
I clarified the metadata version handling here: http://hg.python.org/peps/rev/630c5dd5a123 Rather than "should", I softened the "use the lowest metadata format" suggestion to a "may". I also pointed out that these new rules will only apply to a future major version transition, and for this one, people can just emit the extra files they do today and even older versions of tools will probably get things fairly right. Cheers, Nick. diff --git a/pep-0426.txt b/pep-0426.txt --- a/pep-0426.txt +++ b/pep-0426.txt @@ -89,9 +89,15 @@ Version of the file format; "2.0" is the only legal value. -Automated tools should warn if ``Metadata-Version`` is greater than the -highest version they support, and must fail if ``Metadata-Version`` has -a greater major version than the highest version they support. +Automated tools consuming metadata should warn if ``Metadata-Version`` is +greater than the highest version they support, and must fail if +``Metadata-Version`` has a greater major version than the highest +version they support. + +For broader compatibility, automated tools may choose to produce +distribution metadata using the lowest metadata version that includes +all of the needed fields. + Example:: @@ -1283,9 +1289,19 @@ metadata specifications is unlikely to give the expected behaviour. Whenever the major version number of the specification is incremented, it -is expected that deployment will take some time, as metadata consuming tools -much be updated before other tools can safely start producing the new -format. +is expected that deployment will take some time, as either metadata +consuming tools must be updated before other tools can safely start +producing the new format, or else the sdist and wheel formats, along with +the installation database definition, will need to be updated to support +provision of multiple versions of the metadata in parallel. + +Existing tools won't abide by this guideline until they're updated to +support the new metadata standard, so the new semantics will first take +effect for a hypothetical 2.x -> 3.0 transition. For the 1.x -> 2.0 +transition, it is recommended that tools continue to produce the +existing supplementary files (such as ``entry_points.txt``) in addition +to any equivalents specified using the new features of the standard +metadata format (including the formal extension mechanism). -- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia
On 17.02.2013 11:11, Nick Coghlan wrote:
FYI
---------- Forwarded message ---------- From: Nick Coghlan <ncoghlan@gmail.com> Date: Sun, Feb 17, 2013 at 8:10 PM Subject: PEP 426 is now the draft spec for distribution metadata 2.0 To: "DistUtils mailing list\"\"" <distutils-sig@python.org>
The latest draft of PEP 426 is up at http://www.python.org/dev/peps/pep-0426/
Major changes since the last draft:
1. Metadata-Version is 2.0 rather than 1.3, and the field now has the same major.minor semantics as are defined for wheel versions in PEP 427 (i.e. if a tool sees a major version number it doesn't recognise, it should give up rather than trying to guess what to do with it, while it's OK to process a higher minor version)
2. The "Private-Version" field is added, and several examples are given showing how to use it in conjunction with translated public versions when a project wants to use a version numbering scheme that the standard installation tools won't understand.
3. The environment markers section more clearly covers the need to handle parentheses (this was mentioned in the text, but not the pseudo-grammar), and the fields which support those markers have an explicit cross-reference to that section of the spec.
4. Leading/trailing whitespace and date based versioning are explicitly excluded from valid public versions
5. Version compatibility statistics are provided for this PEP relative to PEP 386 (the analysis script has been added to the PEP repo if anyone wants to check my numbers)
6. I have reclaimed BDFL-Delegate status (with Guido's approval)
Since getting wheel support into pip no longer depends on this version of the metadata spec, I plan to leave it open for comment for another week, and then accept it next weekend if I don't hear any significant objections.
Overall, I think the meta data for Python packages is getting too complicated. Without a support module in the stdlib implementing the required parsing, evaluation and formatting mechanisms needed to analyze and write the format, I'm -1 on adding yet another format version on top of the stack. At the moment, discussing yet another version update is mostly academic, since not even version 1.2 has been picked up by the tools yet: distutils still writes version 1.1 meta data and doesn't even understand 1.2 meta data. The only tool in wide spread use that understands part of the 1.2 data is setuptools/distribute, but it can only understand the Requires-Dist field of that version of the spec (only because the 1.1 Requires field was deprecated) and interprets a Provides-Extra field which isn't even standard. All other 1.2 fields are ignored. setuptools/distribute still writes 1.1 meta-data. I've never seen environment markers being used or supported in the wild. I'm not against modernizing the format, but given that version 1.2 has been out for around 8 years now, without much following, I think we need to make the implementation bit a requirement before accepting the PEP. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Feb 19 2013)
Python Projects, Consulting and Support ... http://www.egenix.com/ mxODBC.Zope/Plone.Database.Adapter ... http://zope.egenix.com/ mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/
::::: Try our mxODBC.Connect Python Database Interface for free ! :::::: eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 http://www.egenix.com/company/contact/
On Tuesday, 19 February 2013, M.-A. Lemburg wrote:
The only tool in wide spread use that understands part of the 1.2 data is setuptools/distribute, but it can only understand the Requires-Dist field of that version of the spec (only because the 1.1 Requires field was deprecated) and interprets a Provides-Extra field which isn't even standard. All other 1.2 fields are ignored. setuptools/distribute still writes 1.1 meta-data.
I've never seen environment markers being used or supported in the wild.
I'm not against modernizing the format, but given that version 1.2 has been out for around 8 years now, without much following, I think we need to make the implementation bit a requirement before accepting the PEP.
The wheel project uses metadata 2.0 and environment markers - indeed, the PEP was written to formalise what wheel was implementing (specifically so that pip was happy to incorporate support). Standard library support was hampered by the difficulty of changing Distutils - an issue which may have gone away now. I agree that standard library support would be good, either via Distutils or by incorporating distlib, but I don't think it is essential for acceptance. Paul
Le Tue, 19 Feb 2013 10:24:15 +0000, Paul Moore <p.f.moore@gmail.com> a écrit :
On Tuesday, 19 February 2013, M.-A. Lemburg wrote:
The only tool in wide spread use that understands part of the 1.2 data is setuptools/distribute, but it can only understand the Requires-Dist field of that version of the spec (only because the 1.1 Requires field was deprecated) and interprets a Provides-Extra field which isn't even standard. All other 1.2 fields are ignored. setuptools/distribute still writes 1.1 meta-data.
I've never seen environment markers being used or supported in the wild.
I'm not against modernizing the format, but given that version 1.2 has been out for around 8 years now, without much following, I think we need to make the implementation bit a requirement before accepting the PEP.
The wheel project uses metadata 2.0 and environment markers - indeed, the PEP was written to formalise what wheel was implementing (specifically so that pip was happy to incorporate support).
I'm unsure what this means. Does the "wheel project" (I thought wheel was a format? is it also a project?) reimplement its own wheel of metadata parsing and generating?
I agree that standard library support would be good, either via Distutils or by incorporating distlib, but I don't think it is essential for acceptance.
I think Marc-André is right that the acceptability of the standard should be judged on the availability of (preferably standard) implementations. If the standard isn't implemented, then perhaps it means it's too ambitious / too complex / victim of the second-system effect. So I kind of agree with him the PEP shouldn't be accepted until there's a decent patch pending for the stdlib. That's not a judgement on the PEP's quality. Just an advice to remain cautious, especially if the previous metadata version already enjoys a very poor adoption rate. By the way, pip may be nice, but it's still a third-party tool, and perhaps not even as widespread as distribute / setuptools. Regards Antoine.
Le Tue, 19 Feb 2013 11:36:09 +0100, Antoine Pitrou <solipsis@pitrou.net> a écrit :
I think Marc-André is right that the acceptability of the standard should be judged on the availability of (preferably standard) implementations. If the standard isn't implemented, then perhaps it means it's too ambitious / too complex / victim of the second-system effect.
So I kind of agree with him the PEP shouldn't be accepted until there's a decent patch pending for the stdlib. That's not a judgement on the PEP's quality. Just an advice to remain cautious, especially if the previous metadata version already enjoys a very poor adoption rate.
By the way, pip may be nice, but it's still a third-party tool, and perhaps not even as widespread as distribute / setuptools.
Well, Nick kind of proved my wrong in his reply to Marc-André :-) Regards Antoine.
On Tue, Feb 19, 2013 at 8:36 PM, Antoine Pitrou <solipsis@pitrou.net> wrote:
Le Tue, 19 Feb 2013 10:24:15 +0000, Paul Moore <p.f.moore@gmail.com> a écrit :
On Tuesday, 19 February 2013, M.-A. Lemburg wrote:
The only tool in wide spread use that understands part of the 1.2 data is setuptools/distribute, but it can only understand the Requires-Dist field of that version of the spec (only because the 1.1 Requires field was deprecated) and interprets a Provides-Extra field which isn't even standard. All other 1.2 fields are ignored. setuptools/distribute still writes 1.1 meta-data.
I've never seen environment markers being used or supported in the wild.
I'm not against modernizing the format, but given that version 1.2 has been out for around 8 years now, without much following, I think we need to make the implementation bit a requirement before accepting the PEP.
The wheel project uses metadata 2.0 and environment markers - indeed, the PEP was written to formalise what wheel was implementing (specifically so that pip was happy to incorporate support).
I'm unsure what this means. Does the "wheel project" (I thought wheel was a format? is it also a project?) reimplement its own wheel of metadata parsing and generating?
I agree that standard library support would be good, either via Distutils or by incorporating distlib, but I don't think it is essential for acceptance.
I think Marc-André is right that the acceptability of the standard should be judged on the availability of (preferably standard) implementations. If the standard isn't implemented, then perhaps it means it's too ambitious / too complex / victim of the second-system effect.
The most complex part of the PEP is still the version ordering, and that's implemented in the analysis script (initially by Vinay, with one small tweak by me to fix the regular expression for the new validity rules). Everything else was either already implemented for distutils2/distlib, or is a trivial check (like scanning for "a", "b", "c" or "dev" to identify pre-releases and filter them out if none of those characters are present in the corresponding version specifier). Nothing in the PEP is particularly original - almost all of it is either stolen from other build and packaging systems, or is designed to provide a *discoverable* alternative to existing setuptools/distribute/pip practices (specifically, the new extension mechanism means things like entry points can be defined in the standard metadata files without python-dev needing to get involved). Probably the most novel concepts in the PEP are "Obsoleted-By" (so a project can issue one last release to inform users directly that it is dead, and there is an alternative available) and the "Private-Version" field to handle the case where a projects' preferred version scheme requires translation to match the more restricted format understood by the installation tools. Yes, the spec in aggregate is complex, but it's complex because software distribution and dependency analysis are complex tasks. If people want to simplify it, they can try to rebut the rationale for the individual changes that is included at the end of the PEP, but "it's complex" alone is not an argument.
So I kind of agree with him the PEP shouldn't be accepted until there's a decent patch pending for the stdlib. That's not a judgement on the PEP's quality. Just an advice to remain cautious, especially if the previous metadata version already enjoys a very poor adoption rate.
There were at least a couple of very good reasons for not adopting metadata 1.2: - it didn't eliminate the need for ad hoc metadata extension files like entry_points.txt, so it didn't solve one of the problems it set out to solve - it's proposed version ordering scheme was incompatible with the prevailing usage on PyPI in a couple of key ways (hence the systematic statistical comparisons in the new PEP - the numbers that are already there shows that the current version of the standard is highly compatible even with *hidden* revisions included in the statistics. I'm currently redoing the analysis to also show public versions only, which should make the proportions look even better, as many of the remaining glitches only affected old pre-releases). The adoption of metadata 1.2 also got caught up in the "distutils must die" rhetoric that meant the distutils2 project got bogged down in trying to eliminate setup.py completely, when the only thing that *really* needs to die is "./setup.py install" (and even that can be acceptable on a development system, we just want to eliminate the need to ever run it on a deployment target). That's the key change in philosophy between this PEP and the previous one: I'm working backwards from what *installers* need, and creating a specification that allows build tools, including distutils, to give it to them. I *don't really care* how those build tools get the info from their users - setup.py, setup.cfg, bento.info, it doesn't matter to me.
By the way, pip may be nice, but it's still a third-party tool, and perhaps not even as widespread as distribute / setuptools.
The main easy_install feature that pip couldn't previously match was installing from pre-built binaries (since easy_install had eggs), which is why the wheel format is so important. My current plan for Python 3.4 is for pip to be formally endorsed as the recommended tool that supports installing from an sdist, while the stdlib will ship a "pydist" tool that can only install from prebuilt wheel files. This will keep the stdlib tool simple (i.e. no need to try to find installers on arbitrary target systems), while easily allowing users to bootstrap a full fledged installer through "pydist install pip". (This will all play it out in PEPs before 3.4 rolls around - and there will likely be recruiting and documentation efforts well in advance of that) Cheers, Nick. -- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia
On Tue, Feb 19, 2013 at 6:42 AM, Nick Coghlan <ncoghlan@gmail.com> wrote:
Nothing in the PEP is particularly original - almost all of it is either stolen from other build and packaging systems, or is designed to provide a *discoverable* alternative to existing setuptools/distribute/pip practices (specifically, the new extension mechanism means things like entry points can be defined in the standard metadata files without python-dev needing to get involved).
FWIW, I actually think this is a step in the wrong direction relative to eggs; the ability to add new metadata files is a useful feature for application frameworks. For example, the EggTranslations project uses egg metadata to implement resource localization plugins. It lets you have an application with plugins that either contain their own translations, contain multiple translations for another plugin, a single language translation for an assortment of plugins, etc. These kinds of runtime-discovery use cases haven't seen much attention in the metadata standard discussion. On one level, that's fine, because it makes sense that distribution-provided metadata should be parseable by all tools, and that at build/download/install time the performance and ease-of-use favor a single file approach. That does not mean, however, that the presence of other files is bad or should be deprecated. IMO, metadata that see significant runtime use independent of the core metadata *should* appear in their own files, even if redundant.
On Tue, Feb 19, 2013 at 7:37 PM, M.-A. Lemburg <mal@egenix.com> wrote:
On 17.02.2013 11:11, Nick Coghlan wrote: I'm not against modernizing the format, but given that version 1.2 has been out for around 8 years now, without much following, I think we need to make the implementation bit a requirement before accepting the PEP.
It is being implemented in distlib, and the (short!) appendix to the PEP itself shows how to read the format using the standard library's email module. v2.0 is designed to fix many of the issues that prevented the adoption of v1.2, including tweaks to the standardised version scheme and the addition of a formal extension mechanism to avoid the ad hoc extensions that occurred with earlier metadata versions. Cheers, Nick. -- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia
On 19.02.2013 11:28, Nick Coghlan wrote:
On Tue, Feb 19, 2013 at 7:37 PM, M.-A. Lemburg <mal@egenix.com> wrote:
On 17.02.2013 11:11, Nick Coghlan wrote: I'm not against modernizing the format, but given that version 1.2 has been out for around 8 years now, without much following, I think we need to make the implementation bit a requirement before accepting the PEP.
It is being implemented in distlib, and the (short!) appendix to the PEP itself shows how to read the format using the standard library's email module.
Hmm, what is distlib and where does it live ? The PEP only shows how to parse the RFC822-style format used by the metadata. That's not what I was referring to. If a tools wants to support metadata 2.0, it has to support all the complicated stuff as well, i.e. handle the requires fields, the environment markers and version comparisons/sorting.
v2.0 is designed to fix many of the issues that prevented the adoption of v1.2, including tweaks to the standardised version scheme and the addition of a formal extension mechanism to avoid the ad hoc extensions that occurred with earlier metadata versions.
Some more notes: * I find it confusing that we now have two version schemes, one defined in PEP 426 (hidden in the middle of the document) and one in PEP 386. It would be better to amend or replace PEP 386, since that's where you look for Python version strings. * PEP 426 doesn't include any mention of the egg distribution format, even though it's the most popular distribution format at the moment. It should at least include the location of the metadata file in eggs (EGG-INFO/PKG-INFO) and egg installations (<eggdir>/EGG-INFO/PKG-INFO). Not sure whether related or not, I also think it would be a good idea to make the metadata file available on PyPI for download (could be sent there when registering the package release). The register command only posts the data as 1.0 metadata, but includes fields from metadata 1.1. PyPI itself only displays part of the data. It would be useful to have the metadata readily available for inspection on PyPI without having to download one of the distribution files first. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Feb 19 2013)
Python Projects, Consulting and Support ... http://www.egenix.com/ mxODBC.Zope/Plone.Database.Adapter ... http://zope.egenix.com/ mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/
::::: Try our mxODBC.Connect Python Database Interface for free ! :::::: eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 http://www.egenix.com/company/contact/
On Tue, Feb 19, 2013 at 11:23 PM, M.-A. Lemburg <mal@egenix.com> wrote:
On 19.02.2013 11:28, Nick Coghlan wrote:
On Tue, Feb 19, 2013 at 7:37 PM, M.-A. Lemburg <mal@egenix.com> wrote:
On 17.02.2013 11:11, Nick Coghlan wrote: I'm not against modernizing the format, but given that version 1.2 has been out for around 8 years now, without much following, I think we need to make the implementation bit a requirement before accepting the PEP.
It is being implemented in distlib, and the (short!) appendix to the PEP itself shows how to read the format using the standard library's email module.
Hmm, what is distlib and where does it live ?
As part of the post-mortem of packaging's removal from Python 3.3, several subcomponents were identified as stable and useful. distlib is those subcomponents extracted into a separate repository by Vinay Sajip. It will be proposed as the standard library infrastructure for building packaging related tools, while distutils will become purely a build system and have nothing to do with installing software directly (except perhaps on developer machines).
The PEP only shows how to parse the RFC822-style format used by the metadata. That's not what I was referring to.
If a tools wants to support metadata 2.0, it has to support all the complicated stuff as well, i.e. handle the requires fields, the environment markers and version comparisons/sorting.
Which is what distutils2 can be used for now, and what distlib will provide without the unwanted build system infrastructure in distutils2.
v2.0 is designed to fix many of the issues that prevented the adoption of v1.2, including tweaks to the standardised version scheme and the addition of a formal extension mechanism to avoid the ad hoc extensions that occurred with earlier metadata versions.
Some more notes:
* I find it confusing that we now have two version schemes, one defined in PEP 426 (hidden in the middle of the document) and one in PEP 386. It would be better to amend or replace PEP 386, since that's where you look for Python version strings.
You can't understand version specifiers without understanding the sort order defined for the version scheme, so documenting them separately is just a recipe for confusion. I plan to mark PEP 386 as Withdrawn when I accept this PEP, as the sorting scheme it defines is broken, and the distutils changes proposed in that PEP are never going to happen.
* PEP 426 doesn't include any mention of the egg distribution format, even though it's the most popular distribution format at the moment. It should at least include the location of the metadata file in eggs (EGG-INFO/PKG-INFO) and egg installations (<eggdir>/EGG-INFO/PKG-INFO).
"Other tools involved in Python distribution may also use this format." The egg format has never been, and never will be, officially endorsed by python-dev. The wheel format is the standard format for binary distribution, and PEP 376 defines the standard location for metadata on installed distributions.
Not sure whether related or not, I also think it would be a good idea to make the metadata file available on PyPI for download (could be sent there when registering the package release). The register command only posts the data as 1.0 metadata, but includes fields from metadata 1.1. PyPI itself only displays part of the data.
It's not related, but I plan to propose the adoption of TUF (with GPG based signatures) for PyPI's end-to-end security solution, and the conversion of the metadata files to JSON for distribution through TUF's metadata support. (Donald Stufft already wrote PEP 426 <-> JSON bidirectional converter as part of an unrelated experiment)
It would be useful to have the metadata readily available for inspection on PyPI without having to download one of the distribution files first.
Indeed, which is a large part of why TUF (aka The Update Framework: https://www.updateframework.com/) is such an interesting security solution. Regards, Nick. -- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia
On 19 February 2013 13:40, Nick Coghlan <ncoghlan@gmail.com> wrote:
If a tools wants to support metadata 2.0, it has to support all the complicated stuff as well, i.e. handle the requires fields, the environment markers and version comparisons/sorting.
Which is what distutils2 can be used for now, and what distlib will provide without the unwanted build system infrastructure in distutils2.
One particular item in Metadata 2.0 which needs to be addressed is requirements specifiers, as used in (for example) Requires-Dist. These take forms like "DistName (>= ver)". There are a number of potential issues here: 1. This differs from the pkg_resources format (which omits the parentheses). Having 2 subtly different formats is not a good idea in the long term. At the moment, pkg_resources format is used in pip requirements (on the command line and in requirement files) as well as in setuptools/distribute and possibly elsewhere. 2. There is currently no code that I am aware of that implements this spec. I don't believe distlib does (yet - give Vinay 5 minutes and who knows? :-)), pkg_resources as I said implements a different format, and distutils2, apart from being a big dependency to cover just this point, only matches the version (not the project name) and presumably does so using the distutils2 version ordering (which is incompatible with Metadata 2.0). 3. The format is fiddly to parse and process - nobody is likely to implement it for themselves without a library that does it (especially not when using pkg_resources is so easy). The PEP needs a rationale as to why the pkg_resources format wasn't used, and should suggest a migration path for projects which currently use the pkg_resources style (such as pip's requirements files). Paul
On Tuesday, February 19, 2013 at 3:25 PM, Paul Moore wrote:
On 19 February 2013 13:40, Nick Coghlan <ncoghlan@gmail.com (mailto:ncoghlan@gmail.com)> wrote:
If a tools wants to support metadata 2.0, it has to support all the complicated stuff as well, i.e. handle the requires fields, the environment markers and version comparisons/sorting.
Which is what distutils2 can be used for now, and what distlib will provide without the unwanted build system infrastructure in distutils2.
One particular item in Metadata 2.0 which needs to be addressed is requirements specifiers, as used in (for example) Requires-Dist. These take forms like "DistName (>= ver)". There are a number of potential issues here:
1. This differs from the pkg_resources format (which omits the parentheses). Having 2 subtly different formats is not a good idea in the long term. At the moment, pkg_resources format is used in pip requirements (on the command line and in requirement files) as well as in setuptools/distribute and possibly elsewhere. 2. There is currently no code that I am aware of that implements this spec. I don't believe distlib does (yet - give Vinay 5 minutes and who knows? :-)), pkg_resources as I said implements a different format, and distutils2, apart from being a big dependency to cover just this point, only matches the version (not the project name) and presumably does so using the distutils2 version ordering (which is incompatible with Metadata 2.0).
It should be alongside the version stuff, atleast it was in distutils2.
3. The format is fiddly to parse and process - nobody is likely to implement it for themselves without a library that does it (especially not when using pkg_resources is so easy).
The PEP needs a rationale as to why the pkg_resources format wasn't used, and should suggest a migration path for projects which currently use the pkg_resources style (such as pip's requirements files).
Paul _______________________________________________ Python-Dev mailing list Python-Dev@python.org (mailto:Python-Dev@python.org) http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/donald.stufft%40gmail.com
On 19 February 2013 20:36, Donald Stufft <donald.stufft@gmail.com> wrote:
2. There is currently no code that I am aware of that implements this spec. I don't believe distlib does (yet - give Vinay 5 minutes and who knows? :-)), pkg_resources as I said implements a different format, and distutils2, apart from being a big dependency to cover just this point, only matches the version (not the project name) and presumably does so using the distutils2 version ordering (which is incompatible with Metadata 2.0).
It should be alongside the version stuff, atleast it was in distutils2.
Yes, sorry - distlib does include code for this: https://distlib.readthedocs.org/en/latest/tutorial.html#matching-versions-ag... I was looking for the term "requirement" which is not used, and missed it. (Either that or Vinay's been borrowing the time machine keys again!) Paul
On Tue, Feb 19, 2013 at 3:25 PM, Paul Moore <p.f.moore@gmail.com> wrote:
On 19 February 2013 13:40, Nick Coghlan <ncoghlan@gmail.com> wrote:
If a tools wants to support metadata 2.0, it has to support all the complicated stuff as well, i.e. handle the requires fields, the environment markers and version comparisons/sorting.
Which is what distutils2 can be used for now, and what distlib will provide without the unwanted build system infrastructure in distutils2.
One particular item in Metadata 2.0 which needs to be addressed is requirements specifiers, as used in (for example) Requires-Dist. These take forms like "DistName (>= ver)". There are a number of potential issues here:
1. This differs from the pkg_resources format (which omits the parentheses). Having 2 subtly different formats is not a good idea in the long term. At the moment, pkg_resources format is used in pip requirements (on the command line and in requirement files) as well as in setuptools/distribute and possibly elsewhere. 2. There is currently no code that I am aware of that implements this spec. I don't believe distlib does (yet - give Vinay 5 minutes and who knows? :-)), pkg_resources as I said implements a different format, and distutils2, apart from being a big dependency to cover just this point, only matches the version (not the project name) and presumably does so using the distutils2 version ordering (which is incompatible with Metadata 2.0). 3. The format is fiddly to parse and process - nobody is likely to implement it for themselves without a library that does it (especially not when using pkg_resources is so easy).
The PEP needs a rationale as to why the pkg_resources format wasn't used, and should suggest a migration path for projects which currently use the pkg_resources style (such as pip's requirements files).
Paul
We did add full support for Metadata 2.0 Requires-Dist in pkg_resources. The fiddling happens here: https://bitbucket.org/tarek/distribute/src/tip/pkg_resources.py?at=default#c... The code removes the parenthesis and adds == when no operator was specified to convert us back to the pkg_resources format. The rest of pkg_resources carries on as before. Wheel installs would not pull in dependencies otherwise.
On 19.02.2013 14:40, Nick Coghlan wrote:
On Tue, Feb 19, 2013 at 11:23 PM, M.-A. Lemburg <mal@egenix.com> wrote:
* PEP 426 doesn't include any mention of the egg distribution format, even though it's the most popular distribution format at the moment. It should at least include the location of the metadata file in eggs (EGG-INFO/PKG-INFO) and egg installations (<eggdir>/EGG-INFO/PKG-INFO).
"Other tools involved in Python distribution may also use this format."
The egg format has never been, and never will be, officially endorsed by python-dev. The wheel format is the standard format for binary distribution, and PEP 376 defines the standard location for metadata on installed distributions.
Oh, come on, Nick, that's just silly. setuptools was included in stdlib for a short while, so the above is simply wrong. Eggs are the most widely used binary distribution format for Python package on PyPI: # wc *files.csv 25585 25598 1431013 2013-02-19-egg-files.csv 4619 4640 236694 2013-02-19-exe-files.csv 254 255 13402 2013-02-19-msi-files.csv 104691 104853 5251962 2013-02-19-tar-gz-files.csv 24 24 1221 2013-02-19-whl-files.csv 17937 18022 905913 2013-02-19-zip-files.csv 153110 153392 7840205 total (based on todays PyPI stats) It doesn't really help ignoring realities... and I'm saying that as one of the core devs who got setuptools kicked out of the stdlib again. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Feb 19 2013)
Python Projects, Consulting and Support ... http://www.egenix.com/ mxODBC.Zope/Plone.Database.Adapter ... http://zope.egenix.com/ mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/
::::: Try our mxODBC.Connect Python Database Interface for free ! :::::: eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 http://www.egenix.com/company/contact/
On Tue, Feb 19, 2013 at 4:34 PM, M.-A. Lemburg <mal@egenix.com> wrote:
On 19.02.2013 14:40, Nick Coghlan wrote:
On Tue, Feb 19, 2013 at 11:23 PM, M.-A. Lemburg <mal@egenix.com> wrote:
* PEP 426 doesn't include any mention of the egg distribution format, even though it's the most popular distribution format at the moment. It should at least include the location of the metadata file in eggs (EGG-INFO/PKG-INFO) and egg installations (<eggdir>/EGG-INFO/PKG-INFO).
"Other tools involved in Python distribution may also use this format."
The egg format has never been, and never will be, officially endorsed by python-dev. The wheel format is the standard format for binary distribution, and PEP 376 defines the standard location for metadata on installed distributions.
Oh, come on, Nick, that's just silly. setuptools was included in stdlib for a short while, so the above is simply wrong. Eggs are the most widely used binary distribution format for Python package on PyPI:
# wc *files.csv 25585 25598 1431013 2013-02-19-egg-files.csv 4619 4640 236694 2013-02-19-exe-files.csv 254 255 13402 2013-02-19-msi-files.csv 104691 104853 5251962 2013-02-19-tar-gz-files.csv 24 24 1221 2013-02-19-whl-files.csv 17937 18022 905913 2013-02-19-zip-files.csv 153110 153392 7840205 total
(based on todays PyPI stats)
It doesn't really help ignoring realities... and I'm saying that as one of the core devs who got setuptools kicked out of the stdlib again.
-- Marc-Andre Lemburg eGenix.com
The wheel philosophy is that it should be supported by both python-dev and setuptools and that you should feel happy about using setuptools if you like it whether or not python-dev (currently) endorses that. If you are using setuptools (distribute's pkg_resources) then you can use both at the same time. Distribute, distutils and setuptools' problems have not been well understood which I think is why there has been a need to discredit setuptools by calling it non-standard. It is the defacto standard. If your packages have dependencies there is no other choice. Wheel tries to solve the real problem by allowing you to build a package with setuptools while giving the end-user the choice of installing setuptools or not. Of course eggs are the most popular right now. The wheel format is very egg-like while avoiding some of egg's problems. See the comparison in the PEP or read the story on wheel's rtfd. The wheel project includes tools to losslessly convert eggs or bdist_wininst to wheel. I am confident distlib can thrive outside of the standard library! Why the rush to kill it before its prime?
On 19.02.2013 23:01, Daniel Holth wrote:
On Tue, Feb 19, 2013 at 4:34 PM, M.-A. Lemburg <mal@egenix.com> wrote:
On 19.02.2013 14:40, Nick Coghlan wrote:
On Tue, Feb 19, 2013 at 11:23 PM, M.-A. Lemburg <mal@egenix.com> wrote:
* PEP 426 doesn't include any mention of the egg distribution format, even though it's the most popular distribution format at the moment. It should at least include the location of the metadata file in eggs (EGG-INFO/PKG-INFO) and egg installations (<eggdir>/EGG-INFO/PKG-INFO).
"Other tools involved in Python distribution may also use this format."
The egg format has never been, and never will be, officially endorsed by python-dev. The wheel format is the standard format for binary distribution, and PEP 376 defines the standard location for metadata on installed distributions.
Oh, come on, Nick, that's just silly. setuptools was included in stdlib for a short while, so the above is simply wrong. Eggs are the most widely used binary distribution format for Python package on PyPI:
# wc *files.csv 25585 25598 1431013 2013-02-19-egg-files.csv 4619 4640 236694 2013-02-19-exe-files.csv 254 255 13402 2013-02-19-msi-files.csv 104691 104853 5251962 2013-02-19-tar-gz-files.csv 24 24 1221 2013-02-19-whl-files.csv 17937 18022 905913 2013-02-19-zip-files.csv 153110 153392 7840205 total
(based on todays PyPI stats)
It doesn't really help ignoring realities... and I'm saying that as one of the core devs who got setuptools kicked out of the stdlib again.
-- Marc-Andre Lemburg eGenix.com
The wheel philosophy is that it should be supported by both python-dev and setuptools and that you should feel happy about using setuptools if you like it whether or not python-dev (currently) endorses that. If you are using setuptools (distribute's pkg_resources) then you can use both at the same time.
Distribute, distutils and setuptools' problems have not been well understood which I think is why there has been a need to discredit setuptools by calling it non-standard. It is the defacto standard. If your packages have dependencies there is no other choice. Wheel tries to solve the real problem by allowing you to build a package with setuptools while giving the end-user the choice of installing setuptools or not.
Of course eggs are the most popular right now. The wheel format is very egg-like while avoiding some of egg's problems. See the comparison in the PEP or read the story on wheel's rtfd. The wheel project includes tools to losslessly convert eggs or bdist_wininst to wheel.
That's all fine, but it doesn't explain the refusal to add the documentation of the location of the PKG-INFO file in eggs ?
I am confident distlib can thrive outside of the standard library! Why the rush to kill it before its prime?
Who's trying to kill distlib ? -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Feb 19 2013)
Python Projects, Consulting and Support ... http://www.egenix.com/ mxODBC.Zope/Plone.Database.Adapter ... http://zope.egenix.com/ mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/
::::: Try our mxODBC.Connect Python Database Interface for free ! :::::: eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 http://www.egenix.com/company/contact/
On Tue, Feb 19, 2013 at 5:10 PM, M.-A. Lemburg <mal@egenix.com> wrote:
On Tue, Feb 19, 2013 at 4:34 PM, M.-A. Lemburg <mal@egenix.com> wrote:
On 19.02.2013 14:40, Nick Coghlan wrote:
On Tue, Feb 19, 2013 at 11:23 PM, M.-A. Lemburg <mal@egenix.com> wrote:
* PEP 426 doesn't include any mention of the egg distribution format, even though it's the most popular distribution format at the moment. It should at least include the location of the metadata file in eggs (EGG-INFO/PKG-INFO) and egg installations (<eggdir>/EGG-INFO/PKG-INFO).
"Other tools involved in Python distribution may also use this format."
The egg format has never been, and never will be, officially endorsed by python-dev. The wheel format is the standard format for binary distribution, and PEP 376 defines the standard location for metadata on installed distributions.
Oh, come on, Nick, that's just silly. setuptools was included in stdlib for a short while, so the above is simply wrong. Eggs are the most widely used binary distribution format for Python package on PyPI:
# wc *files.csv 25585 25598 1431013 2013-02-19-egg-files.csv 4619 4640 236694 2013-02-19-exe-files.csv 254 255 13402 2013-02-19-msi-files.csv 104691 104853 5251962 2013-02-19-tar-gz-files.csv 24 24 1221 2013-02-19-whl-files.csv 17937 18022 905913 2013-02-19-zip-files.csv 153110 153392 7840205 total
(based on todays PyPI stats)
It doesn't really help ignoring realities... and I'm saying that as one of the core devs who got setuptools kicked out of the stdlib again.
-- Marc-Andre Lemburg eGenix.com
The wheel philosophy is that it should be supported by both python-dev and setuptools and that you should feel happy about using setuptools if you like it whether or not python-dev (currently) endorses that. If you are using setuptools (distribute's pkg_resources) then you can use both at
On 19.02.2013 23:01, Daniel Holth wrote: the
same time.
Distribute, distutils and setuptools' problems have not been well understood which I think is why there has been a need to discredit setuptools by calling it non-standard. It is the defacto standard. If your packages have dependencies there is no other choice. Wheel tries to solve the real problem by allowing you to build a package with setuptools while giving the end-user the choice of installing setuptools or not.
Of course eggs are the most popular right now. The wheel format is very egg-like while avoiding some of egg's problems. See the comparison in the PEP or read the story on wheel's rtfd. The wheel project includes tools to losslessly convert eggs or bdist_wininst to wheel.
That's all fine, but it doesn't explain the refusal to add the documentation of the location of the PKG-INFO file in eggs ?
It would just be a sentence, I wouldn't have a problem with it but I also don't see why it would be necessary. Even setuptools doesn't touch the file usually. Right now distribute's pkg_resources currently only understands Requires-Dist if it is inside a .dist-info directory. Sorry, Chris must have meant http://hg.python.org/distlib/ . I was struggling to imagine a world where that is more visible than something on bitbucket. Half the comments have been about putting something in stdlib right away, something that I do not understand at all as a voracious PyPI or https://crate.io/ user. You should secure both the metadata and the packages but it doesn't have anything to do with the serialization format. Wheel is designed so that the metadata is at the end of the .zip and can be retrieved with an HTTP partial request. The feature may or may not be useful.
On Tuesday, February 19, 2013 at 6:16 PM, Daniel Holth wrote:
Sorry, Chris must have meant http://hg.python.org/distlib/ . I was struggling to imagine a world where that is more visible than something on bitbucket. Half the comments have been about putting something in stdlib right away, something that I do not understand at all as a voracious PyPI or https://crate.io/ user. Let's not add anything to the stdlib till it has real world usage. Doing otherwise is putting the cart before the horse.
On Tue, Feb 19, 2013 at 6:19 PM, Donald Stufft <donald.stufft@gmail.com> wrote:
Let's not add anything to the stdlib till it has real world usage. Doing otherwise is putting the cart before the horse.
I'd posit that anything successful will no longer need to be added to the standard library, to boot. Packaging hasn't done well there. I'd rather see a successful packaging story develop than bundle it into the standard library. The later just isn't that interesting any more. -Fred -- Fred L. Drake, Jr. <fred at fdrake.net> "A storm broke loose in my mind." --Albert Einstein
On 20 February 2013 00:54, Fred Drake <fred@fdrake.net> wrote:
I'd posit that anything successful will no longer need to be added to the standard library, to boot. Packaging hasn't done well there.
distlib may be the exception, though. Packaging tools are somewhat unique because of the chicken and egg issue involved in having a packaging tool with external dependencies - who installs your dependencies for you? So enabling technology (library code to perform packaging-related tasks, particularly in support of standardised formats) could be better available from the stdlib.
I'd rather see a successful packaging story develop than bundle it into the standard library. The later just isn't that interesting any more.
Bundling too early is a bad idea though. distlib is developing fast and to do so it needs (1) a development cycle independent of python's and (2) compatibility and ease of use with earlier versions of Python (the latter is also critical for adoption in place of custom code in packaging tools). Aiming for an accelerated level of development targeting inclusion in Python 3.4 is plausible, though. MAL pointed out that agreeing standards but not offering tools to support them in the stdlib is risky, as people have no incentive to adopt those standards. We've got 6 months or more until 3.4 feature freeze, let's not make any decision too soon, though. Paul.
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 02/19/2013 09:37 PM, Paul Moore wrote:
On 20 February 2013 00:54, Fred Drake <fred@fdrake.net> wrote:
I'd posit that anything successful will no longer need to be added to the standard library, to boot. Packaging hasn't done well there.
distlib may be the exception, though. Packaging tools are somewhat unique because of the chicken and egg issue involved in having a packaging tool with external dependencies - who installs your dependencies for you? So enabling technology (library code to perform packaging-related tasks, particularly in support of standardised formats) could be better available from the stdlib.
The big blocker there is that users can't rely on having it in the stdlib until after they drop Python < 3.4 (assuming accelearated absorption) or even 3.5. Tres. - -- =================================================================== Tres Seaver +1 540-429-0999 tseaver@palladion.com Palladion Software "Excellence by Design" http://palladion.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.11 (GNU/Linux) Comment: Using GnuPG with undefined - http://www.enigmail.net/ iEYEARECAAYFAlEkTAsACgkQ+gerLs4ltQ6VBgCePncI4cX7a8NEN6lj98CVBdAE UTUAnA+6zo8Zjmp6T4n0uL804PnHHvZ8 =OT8w -----END PGP SIGNATURE-----
On 20 February 2013 04:07, Tres Seaver <tseaver@palladion.com> wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
On 02/19/2013 09:37 PM, Paul Moore wrote:
On 20 February 2013 00:54, Fred Drake <fred@fdrake.net> wrote:
I'd posit that anything successful will no longer need to be added to the standard library, to boot. Packaging hasn't done well there.
distlib may be the exception, though. Packaging tools are somewhat unique because of the chicken and egg issue involved in having a packaging tool with external dependencies - who installs your dependencies for you? So enabling technology (library code to perform packaging-related tasks, particularly in support of standardised formats) could be better available from the stdlib.
The big blocker there is that users can't rely on having it in the stdlib until after they drop Python < 3.4 (assuming accelearated absorption) or even 3.5.
Understood - that's why I suggested that distlib reach a point where it's stable as an external package and supported on (some) older versions. I'm hoping for an experience more like unittest2 than packaging/distutils2. But we shouldn't be blocking new stdlib features just because they won't be available in older Python versions... Paul
Paul Moore <p.f.moore <at> gmail.com> writes:
Understood - that's why I suggested that distlib reach a point where it's stable as an external package and supported on (some) older versions. I'm hoping for an experience more like unittest2 than packaging/distutils2.
Currently, distlib runs on Python 2.6, 2.7 and 3.2+, so there shouldn't be any concerns about support on those older Python versions. Regards, Vinay Sajip
On 20.02.2013 03:37, Paul Moore wrote:
On 20 February 2013 00:54, Fred Drake <fred@fdrake.net> wrote:
I'd posit that anything successful will no longer need to be added to the standard library, to boot. Packaging hasn't done well there.
distlib may be the exception, though. Packaging tools are somewhat unique because of the chicken and egg issue involved in having a packaging tool with external dependencies - who installs your dependencies for you? So enabling technology (library code to perform packaging-related tasks, particularly in support of standardised formats) could be better available from the stdlib.
I'd rather see a successful packaging story develop than bundle it into the standard library. The later just isn't that interesting any more.
Bundling too early is a bad idea though. distlib is developing fast and to do so it needs (1) a development cycle independent of python's and (2) compatibility and ease of use with earlier versions of Python (the latter is also critical for adoption in place of custom code in packaging tools).
Aiming for an accelerated level of development targeting inclusion in Python 3.4 is plausible, though. MAL pointed out that agreeing standards but not offering tools to support them in the stdlib is risky, as people have no incentive to adopt those standards. We've got 6 months or more until 3.4 feature freeze, let's not make any decision too soon, though.
I'm fine with not adding distlib to Python 3.4. The point I wanted to make was that there has to be an reference implementation of the PEP that tool makers can use to avoid reinventing the wheel over and over again (each with its own set of problems). If distlib implements the PEP, then it just needs to be mentioned there as a suitable reference implementation. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Feb 20 2013)
Python Projects, Consulting and Support ... http://www.egenix.com/ mxODBC.Zope/Plone.Database.Adapter ... http://zope.egenix.com/ mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/
::::: Try our mxODBC.Connect Python Database Interface for free ! :::::: eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 http://www.egenix.com/company/contact/
On 20/02/13 11:54, Fred Drake wrote:
On Tue, Feb 19, 2013 at 6:19 PM, Donald Stufft<donald.stufft@gmail.com> wrote:
Let's not add anything to the stdlib till it has real world usage. Doing otherwise is putting the cart before the horse.
I'd posit that anything successful will no longer need to be added to the standard library, to boot. Packaging hasn't done well there.
I'd rather see a successful packaging story develop than bundle it into the standard library. The later just isn't that interesting any more.
I keep hearing people say that the stdlib is not important, but I don't think that is true. There are lots of people who have problems with anything not in the standard library. - Beginners often have difficulty (due to inexperience, lack of confidence or knowledge) in *finding*, let alone installing and using, packages that aren't in the standard library. - To people in the Linux world, adding anything outside of your distro's packaging system is a nuisance. No matter how easy your packaging library makes it, you now have two sorts of packages: first-class packages that your distro will automatically update for you, and second-class ones that aren't. - People working in restrictive corporate systems often have to jump through flaming hoops before installing software. Packages in the stdlib are a no-brainer. Anything outside the stdlib has additional barriers to use, even if installing them is as simple as "some-package-manager install spam.py". For the avoidance of doubt, this is *not* a veiled request for "everything" to be in the stdlib, since that is impractical and stupid, just a reminder that the stdlib is still important and that no matter how easy packaging becomes, it will never be as easy as having something already there. -- Steven
On Tue, Feb 19, 2013 at 3:16 PM, Daniel Holth <dholth@gmail.com> wrote:
Sorry, Chris must have meant http://hg.python.org/distlib/ . I was struggling to imagine a world where that is more visible than something on bitbucket.
I meant that bringing distlib into http://hg.python.org/cpython/ would give it more visibility to core devs and others that already keep an eye on python-checkins (the mailing list). And I think seeing the Sphinx-processed docs integrated and cross-referenced with http://docs.python.org/dev/ will help people understand better what has been done and how it fits in with the rest of CPython -- which I think would be useful to the community. It may also encourage involvement (e.g. by being part of the main tracker). In asking about the "plan" for doing this, I was thinking of the following remark by Nick: On Tue, Feb 19, 2013 at 5:40 AM, Nick Coghlan <ncoghlan@gmail.com> wrote:
On Tue, Feb 19, 2013 at 11:23 PM, M.-A. Lemburg <mal@egenix.com> wrote:
Hmm, what is distlib and where does it live ?
As part of the post-mortem of packaging's removal from Python 3.3, several subcomponents were identified as stable and useful. distlib is those subcomponents extracted into a separate repository by Vinay Sajip.
It will be proposed as the standard library infrastructure for building packaging related tools, while distutils will become purely a build system and have nothing to do with installing software directly (except perhaps on developer machines).
My question was basically whether there was a tentative plan for when it (or completed parts of it) will be proposed (e.g. when a certain amount of functionality is completed, etc). It's better not to do this at the last minute if 3.4 is the plan (as I think was attempted with packaging but for 3.3). On Tue, Feb 19, 2013 at 6:40 PM, Steven D'Aprano <steve@pearwood.info> wrote:
I keep hearing people say that the stdlib is not important, but I don't think that is true. There are lots of people who have problems with anything not in the standard library.
- Beginners often have difficulty (due to inexperience, lack of confidence or knowledge) in *finding*, let alone installing and using, packages that aren't in the standard library.
- To people in the Linux world, adding anything outside of your distro's packaging system is a nuisance. No matter how easy your packaging library makes it, you now have two sorts of packages: first-class packages that your distro will automatically update for you, and second-class ones that aren't.
- People working in restrictive corporate systems often have to jump through flaming hoops before installing software.
I would also add that for people new to writing Python modules and that want to distribute them, it's hard to evaluate what they are "supposed" to use (distutils, setuptools, distribute, bento, etc). Just a day or two ago, this exact question was asked on the Distutils mailing list with subject "Confusion of a hobby programmer." Code not being in the standard library creates an extra mental hurdle to overcome. --Chris
On Wednesday, February 20, 2013 at 2:48 AM, Chris Jerdonek wrote:
On Tue, Feb 19, 2013 at 3:16 PM, Daniel Holth <dholth@gmail.com (mailto:dholth@gmail.com)> wrote:
Sorry, Chris must have meant http://hg.python.org/distlib/ . I was struggling to imagine a world where that is more visible than something on bitbucket.
I meant that bringing distlib into http://hg.python.org/cpython/ would give it more visibility to core devs and others that already keep an eye on python-checkins (the mailing list). And I think seeing the Sphinx-processed docs integrated and cross-referenced with http://docs.python.org/dev/ will help people understand better what has been done and how it fits in with the rest of CPython -- which I think would be useful to the community. It may also encourage involvement (e.g. by being part of the main tracker).
On the other hand it makes contributing to it more annoying since it does not have pull requests, unless it was just a mirror.
In asking about the "plan" for doing this, I was thinking of the following remark by Nick:
On Tue, Feb 19, 2013 at 5:40 AM, Nick Coghlan <ncoghlan@gmail.com (mailto:ncoghlan@gmail.com)> wrote:
On Tue, Feb 19, 2013 at 11:23 PM, M.-A. Lemburg <mal@egenix.com (mailto:mal@egenix.com)> wrote:
Hmm, what is distlib and where does it live ?
As part of the post-mortem of packaging's removal from Python 3.3, several subcomponents were identified as stable and useful. distlib is those subcomponents extracted into a separate repository by Vinay Sajip.
It will be proposed as the standard library infrastructure for building packaging related tools, while distutils will become purely a build system and have nothing to do with installing software directly (except perhaps on developer machines).
My question was basically whether there was a tentative plan for when it (or completed parts of it) will be proposed (e.g. when a certain amount of functionality is completed, etc). It's better not to do this at the last minute if 3.4 is the plan (as I think was attempted with packaging but for 3.3).
On Tue, Feb 19, 2013 at 6:40 PM, Steven D'Aprano <steve@pearwood.info (mailto:steve@pearwood.info)> wrote:
I keep hearing people say that the stdlib is not important, but I don't think that is true. There are lots of people who have problems with anything not in the standard library.
- Beginners often have difficulty (due to inexperience, lack of confidence or knowledge) in *finding*, let alone installing and using, packages that aren't in the standard library.
- To people in the Linux world, adding anything outside of your distro's packaging system is a nuisance. No matter how easy your packaging library makes it, you now have two sorts of packages: first-class packages that your distro will automatically update for you, and second-class ones that aren't.
- People working in restrictive corporate systems often have to jump through flaming hoops before installing software.
I would also add that for people new to writing Python modules and that want to distribute them, it's hard to evaluate what they are "supposed" to use (distutils, setuptools, distribute, bento, etc). Just a day or two ago, this exact question was asked on the Distutils mailing list with subject "Confusion of a hobby programmer." Code not being in the standard library creates an extra mental hurdle to overcome.
I agree that eventually the stdlib needs standard tooling to work with the future (™) but until that future is in use adding it to the stdlib feels premature to me.
On Wednesday, February 20, 2013 at 2:48 AM, Chris Jerdonek wrote:
I meant that bringing distlib into http://hg.python.org/cpython/ would give it more visibility to core devs and others that already keep an eye on python-checkins (the mailing list). And I think seeing the Sphinx-processed docs integrated and cross-referenced with http://docs.python.org/dev/ will help people understand better what has been done and how it fits in with the rest of CPython -- which I think would be useful to the community. It may also encourage involvement (e.g. by being part of the main tracker).
On Tue, Feb 19, 2013 at 11:53 PM, Donald Stufft <donald.stufft@gmail.com> wrote:
On the other hand it makes contributing to it more annoying since it does not have pull requests, unless it was just a mirror.
Maybe just the finished/production-ready pieces could be added as they are ready, with the main development happening outside. My understanding of distlib is that it's a collection of independent, bite-sized pieces of functionality, which could lend itself well to such a process. --Chris
Le Tue, 19 Feb 2013 19:54:21 -0500, Fred Drake <fred@fdrake.net> a écrit :
On Tue, Feb 19, 2013 at 6:19 PM, Donald Stufft <donald.stufft@gmail.com> wrote:
Let's not add anything to the stdlib till it has real world usage. Doing otherwise is putting the cart before the horse.
I'd posit that anything successful will no longer need to be added to the standard library, to boot. Packaging hasn't done well there.
If only "successful", agreed. However, packaging is a core part of the Python experience, and as such should be provided in the stdlib. Regards Antoine.
On 20.02.2013 00:16, Daniel Holth wrote:
On Tue, Feb 19, 2013 at 5:10 PM, M.-A. Lemburg <mal@egenix.com> wrote:
On Tue, Feb 19, 2013 at 4:34 PM, M.-A. Lemburg <mal@egenix.com> wrote:
On 19.02.2013 14:40, Nick Coghlan wrote:
On Tue, Feb 19, 2013 at 11:23 PM, M.-A. Lemburg <mal@egenix.com> wrote:
* PEP 426 doesn't include any mention of the egg distribution format, even though it's the most popular distribution format at the moment. It should at least include the location of the metadata file in eggs (EGG-INFO/PKG-INFO) and egg installations (<eggdir>/EGG-INFO/PKG-INFO).
"Other tools involved in Python distribution may also use this format."
The egg format has never been, and never will be, officially endorsed by python-dev. The wheel format is the standard format for binary distribution, and PEP 376 defines the standard location for metadata on installed distributions.
Oh, come on, Nick, that's just silly. setuptools was included in stdlib for a short while, so the above is simply wrong. Eggs are the most widely used binary distribution format for Python package on PyPI:
# wc *files.csv 25585 25598 1431013 2013-02-19-egg-files.csv 4619 4640 236694 2013-02-19-exe-files.csv 254 255 13402 2013-02-19-msi-files.csv 104691 104853 5251962 2013-02-19-tar-gz-files.csv 24 24 1221 2013-02-19-whl-files.csv 17937 18022 905913 2013-02-19-zip-files.csv 153110 153392 7840205 total
(based on todays PyPI stats)
It doesn't really help ignoring realities... and I'm saying that as one of the core devs who got setuptools kicked out of the stdlib again.
-- Marc-Andre Lemburg eGenix.com
The wheel philosophy is that it should be supported by both python-dev and setuptools and that you should feel happy about using setuptools if you like it whether or not python-dev (currently) endorses that. If you are using setuptools (distribute's pkg_resources) then you can use both at
On 19.02.2013 23:01, Daniel Holth wrote: the
same time.
Distribute, distutils and setuptools' problems have not been well understood which I think is why there has been a need to discredit setuptools by calling it non-standard. It is the defacto standard. If your packages have dependencies there is no other choice. Wheel tries to solve the real problem by allowing you to build a package with setuptools while giving the end-user the choice of installing setuptools or not.
Of course eggs are the most popular right now. The wheel format is very egg-like while avoiding some of egg's problems. See the comparison in the PEP or read the story on wheel's rtfd. The wheel project includes tools to losslessly convert eggs or bdist_wininst to wheel.
That's all fine, but it doesn't explain the refusal to add the documentation of the location of the PKG-INFO file in eggs ?
It would just be a sentence, I wouldn't have a problem with it but I also don't see why it would be necessary. Even setuptools doesn't touch the file usually. Right now distribute's pkg_resources currently only understands Requires-Dist if it is inside a .dist-info directory.
Perhaps I'm not clear enough. I'll try again :-) The wording in the PEP alienates the egg format by defining an incompatible new standard for the location of the metadata file: """ There are three standard locations for these metadata files: * the PKG-INFO file included in the base directory of Python source distribution archives (as created by the distutils sdist command) * the {distribution}-{version}.dist-info/METADATA file in a wheel binary distribution archive (as described in PEP 425, or a later version of that specification) * the {distribution}-{version}.dist-info/METADATA files in a local Python installation database (as described in PEP 376, or a later version of that specification) """ It's easy to upgrade distribute and distutils to write metadata 1.2 format, simply by changing the version in the PKG-INFO files. These addition are necessary to fix the above and also include the standard location of the metadata for pip and distutils installations: * the EGG-INFO/PKG-INFO file in an egg binary distribution archive (as created by the distribute bdist_egg command) * the {distribution}-{version}.egg/EGG-INFO/PKG-INFO file in an installed egg distribution archive * the {distribution}-{version}.egg-info/PKG-INFO file for packages installed with "pip install" or distribute's "python setup.py install" * the {distribution}-{version}.egg-info file for packages installed with distutils' "python setup.py install" -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Feb 20 2013)
Python Projects, Consulting and Support ... http://www.egenix.com/ mxODBC.Zope/Plone.Database.Adapter ... http://zope.egenix.com/ mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/
::::: Try our mxODBC.Connect Python Database Interface for free ! :::::: eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 http://www.egenix.com/company/contact/
On Wed, Feb 20, 2013 at 5:30 AM, M.-A. Lemburg <mal@egenix.com> wrote:
The wording in the PEP alienates the egg format by defining an incompatible new standard for the location of the metadata file:
This isn't a problem, because there's not really a use case at the moment for eggs to include a PEP 426-format metadata file, and if they ever do, it ought to be called METADATA, so that pkg_resources will know to read it if there are no egg-format dependencies listed. Setuptools also doesn't care what format PKG-INFO is in, as it only ever reads the "Version:" field, and that only in the case of in-development source packages.
It's easy to upgrade distribute and distutils to write metadata 1.2 format, simply by changing the version in the PKG-INFO files.
As soon as distutils does it, setuptools will do it, because setuptools delegates metadata writing to distutils. So there's no "alienation" here. What will need to happen at some point is for pkg_resources to implement support for PEP 426-style version requirements, which I haven't tried to fully wrap my head around as yet. I'm hoping that there are simple textual substitutions (e.g. regexes) that can be done to convert them to pkg_resources requirements. If need be, I'll swipe whatever's needed from distlib. ;-) In the meantime, eggs aren't actually going anywhere, since wheels aren't actually trying to replace all of their use cases. And since the new metadata and binary formats don't actually add much new functionality over what eggs already do, eggs wouldn't lose much by not being able to use the same metadata, anyway. ;-)
On 19.02.2013 14:40, Nick Coghlan wrote:
On Tue, Feb 19, 2013 at 11:23 PM, M.-A. Lemburg <mal@egenix.com> wrote:
On 19.02.2013 11:28, Nick Coghlan wrote:
On Tue, Feb 19, 2013 at 7:37 PM, M.-A. Lemburg <mal@egenix.com> wrote:
On 17.02.2013 11:11, Nick Coghlan wrote: I'm not against modernizing the format, but given that version 1.2 has been out for around 8 years now, without much following, I think we need to make the implementation bit a requirement before accepting the PEP.
It is being implemented in distlib, and the (short!) appendix to the PEP itself shows how to read the format using the standard library's email module.
Hmm, what is distlib and where does it live ?
As part of the post-mortem of packaging's removal from Python 3.3, several subcomponents were identified as stable and useful. distlib is those subcomponents extracted into a separate repository by Vinay Sajip.
It will be proposed as the standard library infrastructure for building packaging related tools, while distutils will become purely a build system and have nothing to do with installing software directly (except perhaps on developer machines).
Shouldn't those details be mentioned in the PEP ?
The PEP only shows how to parse the RFC822-style format used by the metadata. That's not what I was referring to.
If a tools wants to support metadata 2.0, it has to support all the complicated stuff as well, i.e. handle the requires fields, the environment markers and version comparisons/sorting.
Which is what distutils2 can be used for now, and what distlib will provide without the unwanted build system infrastructure in distutils2.
v2.0 is designed to fix many of the issues that prevented the adoption of v1.2, including tweaks to the standardised version scheme and the addition of a formal extension mechanism to avoid the ad hoc extensions that occurred with earlier metadata versions.
Some more notes:
* I find it confusing that we now have two version schemes, one defined in PEP 426 (hidden in the middle of the document) and one in PEP 386. It would be better to amend or replace PEP 386, since that's where you look for Python version strings.
You can't understand version specifiers without understanding the sort order defined for the version scheme, so documenting them separately is just a recipe for confusion.
PEP 386 defines both. The point here is that the version scheme goes far beyond the metadata format and is complicated enough to warrant a separate PEP.
I plan to mark PEP 386 as Withdrawn when I accept this PEP, as the sorting scheme it defines is broken, and the distutils changes proposed in that PEP are never going to happen.
Hmm, Tarek is the author, so only he can withdraw the PEP, AFAIK.
* PEP 426 doesn't include any mention of the egg distribution format, even though it's the most popular distribution format at the moment. It should at least include the location of the metadata file in eggs (EGG-INFO/PKG-INFO) and egg installations (<eggdir>/EGG-INFO/PKG-INFO).
"Other tools involved in Python distribution may also use this format."
The egg format has never been, and never will be, officially endorsed by python-dev. The wheel format is the standard format for binary distribution, and PEP 376 defines the standard location for metadata on installed distributions.
See my other reply.
Not sure whether related or not, I also think it would be a good idea to make the metadata file available on PyPI for download (could be sent there when registering the package release). The register command only posts the data as 1.0 metadata, but includes fields from metadata 1.1. PyPI itself only displays part of the data.
It's not related, but I plan to propose the adoption of TUF (with GPG based signatures) for PyPI's end-to-end security solution, and the conversion of the metadata files to JSON for distribution through TUF's metadata support. (Donald Stufft already wrote PEP 426 <-> JSON bidirectional converter as part of an unrelated experiment)
Why convert the metadata format you are defining in PEP 426 to yet another format when it can be uploaded as file straight to PyPI ? TUF doesn't have anything to do with that, agreed ;-)
It would be useful to have the metadata readily available for inspection on PyPI without having to download one of the distribution files first.
Indeed, which is a large part of why TUF (aka The Update Framework: https://www.updateframework.com/) is such an interesting security solution.
The suggestion to have the metadata available on PyPI doesn't have anything to do with security. It's about being able to determine compatibility and select the right distribution file for download. The metadata also helps in creating dependency graphs, which are useful for a lot of things. -- Marc-Andre Lemburg eGenix.com Professional Python Services directly from the Source (#1, Feb 19 2013)
Python Projects, Consulting and Support ... http://www.egenix.com/ mxODBC.Zope/Plone.Database.Adapter ... http://zope.egenix.com/ mxODBC, mxDateTime, mxTextTools ... http://python.egenix.com/
::::: Try our mxODBC.Connect Python Database Interface for free ! :::::: eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48 D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg Registered at Amtsgericht Duesseldorf: HRB 46611 http://www.egenix.com/company/contact/
M.-A. Lemburg <mal <at> egenix.com> writes:
The suggestion to have the metadata available on PyPI doesn't have anything to do with security.
It's about being able to determine compatibility and select the right distribution file for download. The metadata also helps in creating dependency graphs, which are useful for a lot of things.
FYI, distlib already uses metadata in this way. Note that: 1. Dependency information is locked away in setup.py files, e.g in kwargs to the setup() call. 2. PyPI does not provide access to this metadata. So I have had to write code to extract what information I could out of setup.py setup() and into metadata that can be used. I have, for now, hosted it on my own server, but it can be used for e.g. determining complete dependency graphs without ever actually downloading any distributions. Distlib provides access to it: $ python finddeps.py pyramid 12 dists, elapsed time: 4.35 secs ---------------------------------------- Download order: ---------------------------------------- download setuptools (0.6c11) [for pyramid, zope.interface, zope.deprecation] download PasteDeploy (1.5.0) [for pyramid] download repoze.lru (0.6) [for pyramid] download venusian (1.0a7) [for pyramid] download MarkupSafe (0.15) [for Mako] download translationstring (1.1) [for pyramid] download Chameleon (2.11) [for pyramid] download WebOb (1.2.3) [for pyramid] download zope.interface (4.0.3) [for pyramid] download Mako (0.7.3) [for pyramid] download zope.deprecation (4.0.2) [for pyramid] download pyramid (1.4) In the above, nothing was actually downloaded except the metadata. It's just indicating an intuitive ordering for download based on a topological sort of the dependency graph - for pyramid, in this case. Regards, Vinay Sajip
On Tue, Feb 19, 2013 at 2:28 AM, Nick Coghlan <ncoghlan@gmail.com> wrote:
On Tue, Feb 19, 2013 at 7:37 PM, M.-A. Lemburg <mal@egenix.com> wrote:
On 17.02.2013 11:11, Nick Coghlan wrote: I'm not against modernizing the format, but given that version 1.2 has been out for around 8 years now, without much following, I think we need to make the implementation bit a requirement before accepting the PEP.
It is being implemented in distlib, and the (short!) appendix to the PEP itself shows how to read the format using the standard library's email module.
Maybe this is already stated somewhere, but is there a plan for when distlib will be brought into the repository? Is there a reason not to do it now? It seems it would have more visibility that way (e.g. people could see it as part of the development version of the online docs and it would be in check-ins as are PEP edits), and its status relative to Python would be clearer. --Chris
v2.0 is designed to fix many of the issues that prevented the adoption of v1.2, including tweaks to the standardised version scheme and the addition of a formal extension mechanism to avoid the ad hoc extensions that occurred with earlier metadata versions.
Cheers, Nick.
-- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia _______________________________________________ Python-Dev mailing list Python-Dev@python.org http://mail.python.org/mailman/listinfo/python-dev Unsubscribe: http://mail.python.org/mailman/options/python-dev/chris.jerdonek%40gmail.com
Chris Jerdonek <chris.jerdonek <at> gmail.com> writes:
Maybe this is already stated somewhere, but is there a plan for when distlib will be brought into the repository? Is there a reason not to do it now? It seems it would have more visibility that way (e.g. people could see it as part of the development version of the online docs and it would be in check-ins as are PEP edits), and its status relative to Python would be clearer.
There's no firm plan other than it being on the 3.4 wishlist, but IMO there's no rush to do it right now. AFAICT interested parties can be in the loop even though the project is actively developed on BitBucket rather than hg.python.org: remember that the current stakeholders in terms of packaging tools are not all in python-dev and may find it easier to contribute on BitBucket. (I often get comments from Daniel Holth in response to distlib commits I push to BitBucket.) I periodically sync the BitBucket repo with hg.python.org/distlib. The docs are also readily accessible on readthedocs.org (the first two Google results for distlib are those docs and the project on BitBucket). While not integrated with docs.python.org, I don't think that the distlib docs suffer inordinately from being on readthedocs.org - for one thing, I've enabled Disqus comments, allowing feedback on the docs - not that I've had any ;-) Closer integration should perhaps happen, but not until the project has matured a little. Regards, Vinay Sajip
participants (12)
-
Antoine Pitrou -
Chris Jerdonek -
Daniel Holth -
Donald Stufft -
Fred Drake -
M.-A. Lemburg -
Nick Coghlan -
Paul Moore -
PJ Eby -
Steven D'Aprano -
Tres Seaver -
Vinay Sajip