RFC: PEP 566 - Metadata for Python Software Packages 1.3
Hi all,
I'd appreciate your feedback on the following Metadata 1.3 PEP.
The goal here is not to provide a full specification for all fields as
in previous PEPs, but to:
* Motivate and describe the addition of the new fields or changes to
existing fields;
* Point to the Core Metadata Specifications reference document as the
canonical source for the specification.
Previous discussions:
* https://mail.python.org/pipermail/distutils-sig/2017-September/031465.html
* https://github.com/python/peps/issues/388
Thanks,
D.
PEP: 566
Title: Metadata for Python Software Packages 1.3
Version: $Revision$
Last-Modified: $Date$
Author: Dustin Ingram
On 12/05/2017 11:39 AM, Dustin Ingram wrote:
Hi all,
I'd appreciate your feedback on the following Metadata 1.3 PEP.
The goal here is not to provide a full specification for all fields as in previous PEPs, but to:
* Motivate and describe the addition of the new fields or changes to existing fields; * Point to the Core Metadata Specifications reference document as the canonical source for the specification.
Previous discussions: * https://mail.python.org/pipermail/distutils-sig/2017-September/031465.html * https://github.com/python/peps/issues/388
LGTM. Tres. -- =================================================================== Tres Seaver +1 540-429-0999 tseaver@palladion.com Palladion Software "Excellence by Design" http://palladion.com
LGTM.
I was a bit confused at first by the fact that you describe
environment markers but not where they are allowed. On checking, I
find that this is defined in version 1.2 (PEP 345). It might be worth
a small clarification that this (and name and version specifiers) are
still used in the same way as in PEP 345. Better to be explicit than
implicit and all that :-)
Formatting nit - the "Name" section header is at a different level
than the other two. You probably want the other two with "::::"
underlines.
Paul
On 5 December 2017 at 16:39, Dustin Ingram
Hi all,
I'd appreciate your feedback on the following Metadata 1.3 PEP.
The goal here is not to provide a full specification for all fields as in previous PEPs, but to:
* Motivate and describe the addition of the new fields or changes to existing fields; * Point to the Core Metadata Specifications reference document as the canonical source for the specification.
Previous discussions: * https://mail.python.org/pipermail/distutils-sig/2017-September/031465.html * https://github.com/python/peps/issues/388
Thanks, D.
PEP: 566 Title: Metadata for Python Software Packages 1.3 Version: $Revision$ Last-Modified: $Date$ Author: Dustin Ingram
Discussions-To: distutils-sig <distutils-sig at python.org> Status: Draft Type: Standards Track Content-Type: text/x-rst Created: 1-Dec-2017 Python-Version: 3.x Post-History: Replaces: 345 Abstract ========
This PEP describes the changes between versions 1.2 and 1.3 of the core metadata specification for Python packages. Version 1.2 is specified in PEP 345.
It also changes to the canonical source for field specifications to the `Core Metadata Specification`_ reference document, which includes specifics of the field names, and their semantics and usage.
Fields ======
The canonical source for the names and semantics of each of the supported metadata fields is the `Core Metadata Specification`_ document.
Fields marked with "(Multiple use)" may be specified multiple times in a single PKG-INFO file. Other fields may only occur once in a PKG-INFO file. Fields marked with "(optional)" are not required to appear in a valid PKG-INFO file; all other fields must be present.
New in Version 1.3 ------------------
Description-Content-Type (optional) :::::::::::::::::::::::::::::::::::
A string stating the markup syntax (if any) used in the distribution's description, so that tools can intelligently render the description.
Historically, tools like PyPI assume that a package's description is formatted in `reStructuredText (reST) http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html`_, and fall back on plain text if the description is not valid reST.
The introduction of this field allows PyPI to support additional types of markup syntax, and not need to make this assumption.
The full specification for this field is defined in the `Core Metadata Specification`_.
Provides-Extra (optional, multiple use) :::::::::::::::::::::::::::::::::::::::
A string containing the name of an optional feature. Must be a valid Python identifier. May be used to make a dependency conditional on whether the optional feature has been requested.
This introduction of this field allows packge installation tools (such as ``pip``) to determine which extras are provided by a given package, and so that package publication tools (such as ``twine``) can check for issues with environment markers which use extras.
The full specification for this field is defined in the `Core Metadata Specification`_.
Changed in Version 1.3 ----------------------
Name ::::
The specification for the format of this field is now identical to the distribution name specification defined in PEP 508.
Version Specifiers ==================
Version numbering requirements and the semantics for specifying comparisons between versions are defined in PEP 440.
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.
The environment marker format used to declare such a condition is defined in the environment markers section of PEP 508.
JSON-compatible Metadata ========================
It may be necessary to store metadata in a data structure which does not allow for multiple repeated keys, such as JSON.
The canonical method to transform metadata fields into such a data structure is as follows:
#. The original key-value format should be read with ``email.parser.HeaderParser``; #. All transformed keys should be reduced to lower case, but otherwise should retain all other characters; #. The transformed value for any field marked with "(Multiple-use") should be a single list containing all the original values for the given key; #. The ``Keywords`` field should be converted to a list by splitting the original value on whitespace characters; #. The result should be stored as a string-keyed dictionary.
Summary of Differences From PEP 345 ===================================
* Metadata-Version is now 1.3.
* Fields are now specified via the `Core Metadata Specification`_.
* Added two new fields: ``Description-Content-Type`` and ``Provides-Extra``
* Acceptable values for the ``Name`` field are now specified as per PEP 508.
* Added canonical method of transformation into JSON-compatible data structure.
References ==========
This document specifies version 1.3 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.
.. _`Core Metadata Specification`: https://packaging.python.org/specifications/core-metadata/
Copyright =========
This document has been placed in the public domain.
Acknowledgements ================
Thanks to Nick Colgan for contributing to this PEP.
.. Local Variables: mode: indented-text indent-tabs-mode: nil sentence-end-double-space: t fill-column: 80 End: _______________________________________________ Distutils-SIG maillist - Distutils-SIG@python.org https://mail.python.org/mailman/listinfo/distutils-sig
I was a bit confused at first by the fact that you describe environment markers but not where they are allowed. On checking, I find that this is defined in version 1.2 (PEP 345). It might be worth a small clarification that this (and name and version specifiers) are still used in the same way as in PEP 345. Better to be explicit than implicit and all that :-)
Thanks Paul. I will add a note to to these sections indicating that their usage is otherwise unchanged from PEP 345.
Formatting nit - the "Name" section header is at a different level than the other two. You probably want the other two with "::::" underlines.
Unless I'm misunderstanding your nit, I believe this is already the case? Thanks again, D.
On 5 December 2017 at 18:11, Dustin Ingram
I was a bit confused at first by the fact that you describe environment markers but not where they are allowed. On checking, I find that this is defined in version 1.2 (PEP 345). It might be worth a small clarification that this (and name and version specifiers) are still used in the same way as in PEP 345. Better to be explicit than implicit and all that :-)
Thanks Paul. I will add a note to to these sections indicating that their usage is otherwise unchanged from PEP 345.
Formatting nit - the "Name" section header is at a different level than the other two. You probably want the other two with "::::" underlines.
Unless I'm misunderstanding your nit, I believe this is already the case?
Sorry, I was rushing and didn't take the time to fight with Gmail to do inline comments. What I was trying to get at:
Changed in Version 1.3 ----------------------
Name ::::
The specification for the format of this field is now identical to the distribution name specification defined in PEP 508.
Version Specifiers ==================
This should be :::::::::::::::::: so "Version Specifiers" is at the same level as "Name"
Version numbering requirements and the semantics for specifying comparisons between versions are defined in PEP 440.
Environment markers ===================
Same here, should be :::::::::::::::::::
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.
The environment marker format used to declare such a condition is defined in the environment markers section of PEP 508.
Paul
Ah, I see, by "other two" I thought you meant the other two new fields. Looking at https://www.python.org/dev/peps/pep-0566/ might make it more clear that I originally intended the "New in Version 1.3" and "Changed in Version 1.3" headings to only be under the "Fields" heading, so the outline would be: * Abstract * Fields - New in Version 1.3 * Description-Content-Type (optional) * Provides-Extra (optional, multiple use) - Changed in Version 1.3 * Name * Version Specifiers * Environment markers * JSON-compatible Metadata * Summary of Differences From PEP 345 * References * Copyright * Acknowledgements However I could see the value in inverting this a bit to be: * Abstract * New in Version 1.3 - Fields * Description-Content-Type (optional) * Provides-Extra (optional, multiple use) * Changed in Version 1.3 - Fields * Name - Version Specifiers - Environment markers - JSON-compatible Metadata * Summary of Differences From PEP 345 * References * Copyright * Acknowledgements If this is preferable. Thanks, D.
On 5 December 2017 at 20:34, Dustin Ingram
Ah, I see, by "other two" I thought you meant the other two new fields.
Looking at https://www.python.org/dev/peps/pep-0566/ might make it more clear that I originally intended the "New in Version 1.3" and "Changed in Version 1.3" headings to only be under the "Fields" heading, so the outline would be:
* Abstract * Fields - New in Version 1.3 * Description-Content-Type (optional) * Provides-Extra (optional, multiple use) - Changed in Version 1.3 * Name * Version Specifiers * Environment markers * JSON-compatible Metadata * Summary of Differences From PEP 345 * References * Copyright * Acknowledgements
However I could see the value in inverting this a bit to be:
* Abstract * New in Version 1.3 - Fields * Description-Content-Type (optional) * Provides-Extra (optional, multiple use) * Changed in Version 1.3 - Fields * Name - Version Specifiers - Environment markers - JSON-compatible Metadata * Summary of Differences From PEP 345 * References * Copyright * Acknowledgements
If this is preferable.
Oh! Sorry, I follow now. I'd misunderstood the structure completely - my mistake. I was thinking of "Version Specifiers" and "Environment Markers" as fields, when they aren't - they are *part* of certain fields. The table of contents is completely clear, though, it's just that I wasn't concentrating so much when I read that. I'd say it's fine as it stands. Thanks for clarifying. Paul
On 6 December 2017 at 02:39, Dustin Ingram
Hi all,
I'd appreciate your feedback on the following Metadata 1.3 PEP.
The goal here is not to provide a full specification for all fields as in previous PEPs, but to:
* Motivate and describe the addition of the new fields or changes to existing fields; * Point to the Core Metadata Specifications reference document as the canonical source for the specification.
Hi folks, While I'd normally step up as BDFL-Delegate for an interoperability specification like this one, I'm actually going to be offline for most of the rest of the year, which I figure wouldn't be especially conducive to running an effective and timely review process :) So while I'll note that I'm personally happy with the PEP as it currently stands (based on my review of Dustin's earlier drafts), I've also asked Daniel Holth if he'd be willing to handle the task of final review and approval for this PEP as the original author of the wheel specification, and Daniel's graciously agreed to do so. Regards, Nick. -- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia
From "[distutils] Multiple package authors" [1]
- How should multiple author-email and maintainer-email addresses be
specified?
- Should we add security-email and/or security-disclosure-instructions?
[1] http://markmail.org/thread/xmwfktnsbmpakv6b
On Wednesday, December 6, 2017, Nick Coghlan
On 6 December 2017 at 02:39, Dustin Ingram
wrote: Hi all,
I'd appreciate your feedback on the following Metadata 1.3 PEP.
The goal here is not to provide a full specification for all fields as in previous PEPs, but to:
* Motivate and describe the addition of the new fields or changes to existing fields; * Point to the Core Metadata Specifications reference document as the canonical source for the specification.
Hi folks,
While I'd normally step up as BDFL-Delegate for an interoperability specification like this one, I'm actually going to be offline for most of the rest of the year, which I figure wouldn't be especially conducive to running an effective and timely review process :)
So while I'll note that I'm personally happy with the PEP as it currently stands (based on my review of Dustin's earlier drafts), I've also asked Daniel Holth if he'd be willing to handle the task of final review and approval for this PEP as the original author of the wheel specification, and Daniel's graciously agreed to do so.
Regards, Nick.
-- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia _______________________________________________ Distutils-SIG maillist - Distutils-SIG@python.org https://mail.python.org/mailman/listinfo/distutils-sig
Dustin asked me to bring this issue to this thread: Metadata version 1.2 (PEP 345) says that version specifiers within a Requires-Dist field should go in parentheses: "zope.interface (>3.5.0)". The metadata spec on PyPUG repeats this. However, PEP 508 says that the parentheses are not needed, and tools writing dependency specifications should not create them. Its recommended format is therefore "zope.interface >3.5.0". Should the metadata 1.3 PEP note that this has changed? Or do we only need to update the metadata spec on PyPUG? (I'm writing some validation code for flit, and quickly seeing the value in having the latest information in one place, rather than scattered across several PEPs) Thomas On Tue, Dec 5, 2017, at 04:39 PM, Dustin Ingram wrote:
Hi all,
I'd appreciate your feedback on the following Metadata 1.3 PEP.
The goal here is not to provide a full specification for all fields as in previous PEPs, but to:
* Motivate and describe the addition of the new fields or changes to existing fields; * Point to the Core Metadata Specifications reference document as the canonical source for the specification.
Previous discussions: * https://mail.python.org/pipermail/distutils-sig/2017-September/031465.html * https://github.com/python/peps/issues/388
Thanks, D.
PEP: 566 Title: Metadata for Python Software Packages 1.3 Version: $Revision$ Last-Modified: $Date$ Author: Dustin Ingram
Discussions-To: distutils-sig <distutils-sig at python.org> Status: Draft Type: Standards Track Content-Type: text/x-rst Created: 1-Dec-2017 Python-Version: 3.x Post-History: Replaces: 345 Abstract ========
This PEP describes the changes between versions 1.2 and 1.3 of the core metadata specification for Python packages. Version 1.2 is specified in PEP 345.
It also changes to the canonical source for field specifications to the `Core Metadata Specification`_ reference document, which includes specifics of the field names, and their semantics and usage.
Fields ======
The canonical source for the names and semantics of each of the supported metadata fields is the `Core Metadata Specification`_ document.
Fields marked with "(Multiple use)" may be specified multiple times in a single PKG-INFO file. Other fields may only occur once in a PKG-INFO file. Fields marked with "(optional)" are not required to appear in a valid PKG-INFO file; all other fields must be present.
New in Version 1.3 ------------------
Description-Content-Type (optional) :::::::::::::::::::::::::::::::::::
A string stating the markup syntax (if any) used in the distribution's description, so that tools can intelligently render the description.
Historically, tools like PyPI assume that a package's description is formatted in `reStructuredText (reST) http://docutils.sourceforge.net/docs/ref/rst/restructuredtext.html`_, and fall back on plain text if the description is not valid reST.
The introduction of this field allows PyPI to support additional types of markup syntax, and not need to make this assumption.
The full specification for this field is defined in the `Core Metadata Specification`_.
Provides-Extra (optional, multiple use) :::::::::::::::::::::::::::::::::::::::
A string containing the name of an optional feature. Must be a valid Python identifier. May be used to make a dependency conditional on whether the optional feature has been requested.
This introduction of this field allows packge installation tools (such as ``pip``) to determine which extras are provided by a given package, and so that package publication tools (such as ``twine``) can check for issues with environment markers which use extras.
The full specification for this field is defined in the `Core Metadata Specification`_.
Changed in Version 1.3 ----------------------
Name ::::
The specification for the format of this field is now identical to the distribution name specification defined in PEP 508.
Version Specifiers ==================
Version numbering requirements and the semantics for specifying comparisons between versions are defined in PEP 440.
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.
The environment marker format used to declare such a condition is defined in the environment markers section of PEP 508.
JSON-compatible Metadata ========================
It may be necessary to store metadata in a data structure which does not allow for multiple repeated keys, such as JSON.
The canonical method to transform metadata fields into such a data structure is as follows:
#. The original key-value format should be read with ``email.parser.HeaderParser``; #. All transformed keys should be reduced to lower case, but otherwise should retain all other characters; #. The transformed value for any field marked with "(Multiple-use") should be a single list containing all the original values for the given key; #. The ``Keywords`` field should be converted to a list by splitting the original value on whitespace characters; #. The result should be stored as a string-keyed dictionary.
Summary of Differences From PEP 345 ===================================
* Metadata-Version is now 1.3.
* Fields are now specified via the `Core Metadata Specification`_.
* Added two new fields: ``Description-Content-Type`` and ``Provides-Extra``
* Acceptable values for the ``Name`` field are now specified as per PEP 508.
* Added canonical method of transformation into JSON-compatible data structure.
References ==========
This document specifies version 1.3 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.
.. _`Core Metadata Specification`: https://packaging.python.org/specifications/core-metadata/
Copyright =========
This document has been placed in the public domain.
Acknowledgements ================
Thanks to Nick Colgan for contributing to this PEP.
.. Local Variables: mode: indented-text indent-tabs-mode: nil sentence-end-double-space: t fill-column: 80 End: _______________________________________________ Distutils-SIG maillist - Distutils-SIG@python.org https://mail.python.org/mailman/listinfo/distutils-sig
On 9 December 2017 at 02:42, Thomas Kluyver
Dustin asked me to bring this issue to this thread:
Metadata version 1.2 (PEP 345) says that version specifiers within a Requires-Dist field should go in parentheses: "zope.interface (>3.5.0)". The metadata spec on PyPUG repeats this.
However, PEP 508 says that the parentheses are not needed, and tools writing dependency specifications should not create them. Its recommended format is therefore "zope.interface >3.5.0".
Should the metadata 1.3 PEP note that this has changed? Or do we only need to update the metadata spec on PyPUG?
The new PEP already delegates to PEP 508 for the version specifier format, so I think that can just be updated in PyPUG. Cheers, Nick. -- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia
I don't know why the parentheses were included in the older pep. They are
widely deployed. We probably can get rid of them or make them optional in a
practical parser.
On Sat, Dec 9, 2017, 02:03 Nick Coghlan
On 9 December 2017 at 02:42, Thomas Kluyver
wrote: Dustin asked me to bring this issue to this thread:
Metadata version 1.2 (PEP 345) says that version specifiers within a Requires-Dist field should go in parentheses: "zope.interface (>3.5.0)". The metadata spec on PyPUG repeats this.
However, PEP 508 says that the parentheses are not needed, and tools writing dependency specifications should not create them. Its recommended format is therefore "zope.interface >3.5.0".
Should the metadata 1.3 PEP note that this has changed? Or do we only need to update the metadata spec on PyPUG?
The new PEP already delegates to PEP 508 for the version specifier format, so I think that can just be updated in PyPUG.
Cheers, Nick.
-- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia _______________________________________________ Distutils-SIG maillist - Distutils-SIG@python.org https://mail.python.org/mailman/listinfo/distutils-sig
After working a bit on an implementation of the "JSON-compatible Metadata" section in this PEP, I'm noticing that it might be more useful if it had the following step instead for canonicalizing the field names:
#. All transformed keys should be reduced to lower case. Hyphens should be replaced with underscores, but otherwise should retain all other characters;
Thus a field like `Description-Content-Type` would become
`description_content_type` and the resulting data structure would be
slightly more useful (as it could be passed as `**kwargs` to a
function with PEP 8 style parameter names)
If no one has any objections to this, I'll update the draft accordingly.
Also, if there is no other feedback on the current draft, I'l be
formally submitting it for Daniel's review this week.
Thanks,
D.
On Sat, Dec 9, 2017 at 8:27 AM, Daniel Holth
I don't know why the parentheses were included in the older pep. They are widely deployed. We probably can get rid of them or make them optional in a practical parser.
On Sat, Dec 9, 2017, 02:03 Nick Coghlan
wrote: On 9 December 2017 at 02:42, Thomas Kluyver
wrote: Dustin asked me to bring this issue to this thread:
Metadata version 1.2 (PEP 345) says that version specifiers within a Requires-Dist field should go in parentheses: "zope.interface (>3.5.0)". The metadata spec on PyPUG repeats this.
However, PEP 508 says that the parentheses are not needed, and tools writing dependency specifications should not create them. Its recommended format is therefore "zope.interface >3.5.0".
Should the metadata 1.3 PEP note that this has changed? Or do we only need to update the metadata spec on PyPUG?
The new PEP already delegates to PEP 508 for the version specifier format, so I think that can just be updated in PyPUG.
Cheers, Nick.
-- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia _______________________________________________ Distutils-SIG maillist - Distutils-SIG@python.org https://mail.python.org/mailman/listinfo/distutils-sig
_______________________________________________ Distutils-SIG maillist - Distutils-SIG@python.org https://mail.python.org/mailman/listinfo/distutils-sig
On Monday, December 11, 2017, Dustin Ingram
After working a bit on an implementation of the "JSON-compatible Metadata" section in this PEP, I'm noticing that it might be more useful if it had the following step instead for canonicalizing the field names:
#. All transformed keys should be reduced to lower case. Hyphens should be replaced with underscores, but otherwise should retain all other characters;
Thus a field like `Description-Content-Type` would become `description_content_type` and the resulting data structure would be slightly more useful (as it could be passed as `**kwargs` to a function with PEP 8 style parameter names)
Good idea.
If no one has any objections to this, I'll update the draft accordingly.
Also, if there is no other feedback on the current draft, I'l be formally submitting it for Daniel's review this week.
(Copied and pasted this from above)
From "[distutils] Multiple package authors" [1]
- How should multiple author-email and maintainer-email addresses be specified? - Should we add security-email and/or security-disclosure-instructions? [1] http://markmail.org/thread/xmwfktnsbmpakv6b
Thanks, D.
On Sat, Dec 9, 2017 at 8:27 AM, Daniel Holth
wrote: I don't know why the parentheses were included in the older pep. They are widely deployed. We probably can get rid of them or make them optional in a practical parser.
On Sat, Dec 9, 2017, 02:03 Nick Coghlan
wrote: On 9 December 2017 at 02:42, Thomas Kluyver
wrote:
Dustin asked me to bring this issue to this thread:
Metadata version 1.2 (PEP 345) says that version specifiers within a Requires-Dist field should go in parentheses: "zope.interface (>3.5.0)". The metadata spec on PyPUG repeats this.
However, PEP 508 says that the parentheses are not needed, and tools writing dependency specifications should not create them. Its recommended format is therefore "zope.interface >3.5.0".
Should the metadata 1.3 PEP note that this has changed? Or do we only need to update the metadata spec on PyPUG?
The new PEP already delegates to PEP 508 for the version specifier format, so I think that can just be updated in PyPUG.
Cheers, Nick.
-- Nick Coghlan | ncoghlan@gmail.com | Brisbane, Australia _______________________________________________ Distutils-SIG maillist - Distutils-SIG@python.org https://mail.python.org/mailman/listinfo/distutils-sig
_______________________________________________ Distutils-SIG maillist - Distutils-SIG@python.org https://mail.python.org/mailman/listinfo/distutils-sig
_______________________________________________ Distutils-SIG maillist - Distutils-SIG@python.org https://mail.python.org/mailman/listinfo/distutils-sig
participants (8)
-
Daniel Holth
-
Dustin Ingram
-
Dustin Ingram
-
Nick Coghlan
-
Paul Moore
-
Thomas Kluyver
-
Tres Seaver
-
Wes Turner