Skip to content

Commit b02b234

Browse files
committed
PEP 639: Add custom IDs issue & clarify rejected license key str value
1 parent c617f2e commit b02b234

File tree

1 file changed

+116
-15
lines changed

1 file changed

+116
-15
lines changed

pep-0639.rst

Lines changed: 116 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ Author: Philippe Ombredanne <pombredanne at nexb.com>,
66
C.A.M. Gerlach <CAM.Gerlach at Gerlach.CAM>
77
Sponsor: Paul Moore <p.f.moore at gmail.com>
88
PEP-Delegate: Paul Moore <p.f.moore at gmail.com>
9-
Discussions-To: https://discuss.python.org/t/2154
9+
Discussions-To: https://discuss.python.org/t/12622
1010
Status: Draft
1111
Type: Standards Track
1212
Content-Type: text/x-rst
@@ -1398,25 +1398,58 @@ key, retaining the ``expression`` subkey in the ``license`` table, or
13981398
allowing both. Indeed, this would seem to have been envisioned by PEP 621
13991399
itself with this PEP in mind, in particular the first approach::
14001400

1401-
A practical string value for the license key has been purposefully left out
1402-
to allow for a future PEP to specify support for SPDX expressions.
1401+
A practical string value for the license key has been purposefully left
1402+
out to allow for a future PEP to specify support for SPDX expressions
1403+
(the same logic applies to any sort of "type" field specifying what
1404+
license the file or text represents).
14031405

14041406
However, while a working draft temporarily explored this solution, it was
14051407
ultimately rejected, as it shared most of the downsides identified with
14061408
adding new subkeys under the existing ``license`` table, as well as several
14071409
of its own, with again minimal advantage over separating both.
14081410

1409-
In particular, it means the top-level ``license`` key still maps to multiple
1411+
Most importantly, it still means that per PEP 621, it is not possible to
1412+
separately mark the ``[project]`` keys corresponding to the ``License`` and
1413+
``License-Expression`` metadata fields as dynamic. This, in turn, still
1414+
renders specifying metadata following that standard incompatible with
1415+
conversion of legacy metadata, as specified in this PEP's
1416+
`Converting legacy metadata`_ section, as PEP 621 strictly prohibits the
1417+
``license`` key from being both present (to define the existing value of
1418+
the ``License`` field, or the path to a license file, and thus able to be
1419+
converted), and specified as ``dynamic`` (which would allow tools to
1420+
use the generated value for the ``License-Expression`` field.
1421+
1422+
For the same reasons, this would make it impossible to back-fill the
1423+
``License`` field from the ``License-Expression`` field as this PEP
1424+
currently allows (without making an exception from strict
1425+
``dynamic`` behavior in this case), as again, marking ``license`` as dynamic
1426+
would mean it cannot be specified in the ``project`` table at all.
1427+
1428+
Furthermore, this would mean existing project source metadata specifying
1429+
``license`` as ``dynamic`` would be ambiguous, as it would be impossible for
1430+
tools to statically determine if they are intended to conform to previous
1431+
metadata versions specifying ``License``, or this version specifying
1432+
``License-Expression``. Tools would have no way of determining which field,
1433+
if either, might be filled in the resulting distribution's core metadata.
1434+
By contrast, the present approach makes clear what the author intended,
1435+
allows tools to unambiguously determine which field(s) may be dynamically
1436+
inserted, and ensures backward compatibility such that current project
1437+
source metadata do not unknowingly specify both the old and the new field
1438+
as dynamic, and instead must do so explicitly per PEP 621's intent.
1439+
1440+
Additionally, while differences from existing tool formats (and core metadata
1441+
field names) has precedent in PEP 621 (though is best avoided if practical),
1442+
using a key with an identical name as in all current tools (and of an existing
1443+
core metadata field) to mean something different (and map to a different
1444+
core metadata field), with distinct and incompatible syntax and semantics,
1445+
does not, and is likely to create substantial and confusion and ambiguity
1446+
for readers and authors, contrary to the fundamental goals of this PEP.
1447+
1448+
Finally, this means that the top-level ``license`` key still maps to multiple
14101449
core metadata fields with different purposes and interpretation (``License``
1411-
and ``License-Expression``), one deprecated and one new, and still prevents
1412-
them from being separately marked as dynamic, and conflates the same with
1413-
an existing mark. This further exhibits the same divergence from both
1414-
PEP 621, core metadata, tool file formats and the consensus in the discussion
1415-
in not making the new license expression map to a corresponding new field,
1416-
none of which was the case at the time PEP 621 was drafted.
1417-
Finally, this would deny a clear separation from the old behavior by not
1418-
cleanly deprecating the entire ``license`` key, and increases the complexity
1419-
of the specification and implementation.
1450+
and ``License-Expression``), this would deny a clear separation from the
1451+
old behavior by not cleanly deprecating the ``license`` key, and
1452+
increases the complexity of the specification and implementation.
14201453

14211454
In addition to the aforementioned issues, this also requires deciding between
14221455
the three individual approaches (``expression`` subkey, top-level string or
@@ -1441,8 +1474,7 @@ while adding even more spec and tool complexity and making there more than
14411474

14421475
Therefore, a separate top-level ``license-expression`` key was adopted to avoid
14431476
all these issues, with relatively minimal downside aside from adding a single
1444-
additional top-level key and (versus some approaches) a few extra characters
1445-
to type.
1477+
additional key and (versus some approaches) a few extra characters to type.
14461478

14471479

14481480
Add a ``type`` key to treat as expression
@@ -1999,6 +2031,75 @@ be reversed once a breaking revision of the metadata spec is issued)?
19992031
Or should this not be explicitly allowed, discouraged or even prohibited?
20002032

20012033

2034+
Should custom license identifiers be allowed?
2035+
---------------------------------------------
2036+
2037+
The current version of this PEP retains the behavior of only specifying
2038+
the use of SPDX-defined license identifiers, as well as the explicitly defined
2039+
custom identifiers ``LicenseRef-Public-Domain`` and ``LicenseRef-Proprietary``
2040+
to handle the two common cases where projects have a license, but it is not
2041+
one that has a recognized SPDX license identifier.
2042+
2043+
For maximum flexibility, custom ``LicenseRef-<CUSTOM-TEXT>`` license
2044+
identifiers could be allowed, which could potentially be useful for niche
2045+
cases or corporate environments where ``LicenseRef-Proprietary`` is not
2046+
appropriate or insufficiently specific, but relying on mainstream Python
2047+
build tooling and the ``License-Expression`` metadata field is still
2048+
desirable to use for this purpose.
2049+
2050+
This has the downsides, however, of not catching misspellings of the
2051+
canonically defined license identifiers and thus producing license metadata
2052+
that is not a valid match for what the author intended, as well as users
2053+
potentially thinking they have to prepend ``LicenseRef`` in front of valid
2054+
license identifiers, as there seems to be some previous confusion about.
2055+
Furthermore, this encourages the proliferation of bespoke license identifiers,
2056+
which obviates the purpose of enabling clear, unambiguous and well
2057+
understood license metadata for which this PEP was created.
2058+
2059+
Indeed, for niche cases that need specific, proprietary custom licenses,
2060+
they could always simply specify ``LicenseRef-Proprietary``, and then
2061+
include the actual license files needed to unambiguously identify the license
2062+
regardless (if not using SPDX license identifiers) under the ``License-File``
2063+
fields. Requiring standards-conforming tools to allow custom license
2064+
identifiers does not seem very useful, since standard tools will not recognize
2065+
bespoke ones or know how to treat them. By contrast, bespoke tools, which
2066+
would be required in any case to understand and act on custom identifiers,
2067+
are explicitly allowed, with good reason (thus the ``SHOULD`` keyword)
2068+
to not require that license identifiers conform to those listed here.
2069+
Therefore, this specification still allows such use in private corporate
2070+
environments or specific ecosystems, while avoiding the disadvantages of
2071+
imposing them on all mainstream packaging tools.
2072+
2073+
As an alternative, a literal ``LicenseRef-Custom`` identifier could be
2074+
defined, which would more explicitly indicate that the license cannot be
2075+
expressed with defined identifiers and the license text should be referenced
2076+
for details, without carrying the negative and potentially inappropriate
2077+
implications of ``LicenseRef-Proprietary``. This would avoid the main
2078+
mentioned downsides (misspellings, confusion, license proliferation) of
2079+
the approve approach of allowing an arbitrary ``LicenseRef``, while
2080+
addressing several of the potential theoretical scenarios cited for it.
2081+
2082+
On the other hand, as SPDX aims to (and generally does) encompass all
2083+
FSF-recognized "Free" and OSI-approved "Open Source" licenses,
2084+
and those sources are kept closely in sync and are now relatively stable,
2085+
anything outside those bounds would generally be covered by
2086+
``LicenseRef-Proprietary``, thus making ``LicenseRef-Custom`` less specific
2087+
in that regard, and somewhat redundant to it. Furthermore, it may mislead
2088+
authors of projects with complex/multiple licenses that they should use it
2089+
over specifying a license expression.
2090+
2091+
At present, the PEP retains the existing approach over either of these, given
2092+
the use cases and benefits were judged to be sufficiently marginal based
2093+
on the current understanding of the packaging landscape. For both these
2094+
proposals, however, if more concrete use cases emerge, this can certainly
2095+
be reconsidered, either for this current PEP or a future one (before or
2096+
in tandem with actually removing the legacy unstructured ``License``
2097+
metadata field). Not defining this now enables allowing it later
2098+
(or still now, with custom packaging tools), without affecting backward
2099+
compatibility, while the same is not so if they are allowed now and later
2100+
determined to be unnecessary or too problematic in practice.
2101+
2102+
20022103
Appendix 1. License Expression Examples
20032104
=======================================
20042105

0 commit comments

Comments
 (0)