Skip to content

Commit dcf9bb7

Browse files
committed
PEP 725: expand Specification section
1 parent 6e99291 commit dcf9bb7

File tree

1 file changed

+64
-23
lines changed

1 file changed

+64
-23
lines changed

peps/pep-0725.rst

Lines changed: 64 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -445,6 +445,42 @@ Specification
445445
If metadata is improperly specified then tools MUST raise an error to notify
446446
the user about their mistake.
447447

448+
DepURL
449+
------
450+
451+
A DepURL implements a scheme for identifying packages that is meant to be
452+
portable across packaging ecosystems. Its design is::
453+
454+
dep:type/namespace/name@version?qualifiers#subpath
455+
456+
``dep:`` is a fixed string, and always present. ``type`` and ``name`` are
457+
required, other components are optional. Component definitions:
458+
459+
- ``type`` (required): MUST be either a `PURL`_ ``type``, or ``virtual``.
460+
- ``namespace`` (optional): MUST be a `PURL`_ ``namespace``, or a namespace in
461+
the DepURL central registry (see :pep:`700`). FIXME: PEP number
462+
- ``name`` (required): MUST be a name that parses as a valid `PURL`_ ``name``.
463+
Tools MAY warn or error if a name is not present in the DepURL central
464+
registry (:pep:`700`).
465+
- ``version`` (optional): MUST be one of:
466+
467+
- A regular `version specifier`_ (PEP 440 semantics) as a single version or
468+
version range, with the restriction that only the following operators may
469+
be used: ``>=``, ``>``, ``<``, ``<=``, ``==``, ``,``.
470+
- A `PURL`_ percent-encoded version string.
471+
472+
- ``qualifiers`` (optional): MUST parse as a valid `PURL`_ ``qualifier``.
473+
- ``subpath`` (optional): MUST parse as a valid `PURL`_ ``subpath``.
474+
475+
476+
External dependency specifiers
477+
------------------------------
478+
479+
External dependency specifiers MUST contain a DepURL, and MAY contain
480+
environment markers with the same syntax as used in regular `dependency
481+
specifiers`_ (as originally specified in :pep:`508`).
482+
483+
448484
Changes in Core Metadata
449485
------------------------
450486

@@ -459,7 +495,8 @@ Additions
459495

460496
Two new fields are added to Core Metadata:
461497

462-
- ``Requires-External-Dep``. An external requirement expressed as a ``dep:`` URL.
498+
- ``Requires-External-Dep``. An external requirement expressed as an external
499+
dependency specifier string.
463500
- ``Provides-External-Extra``. An *extra* group that carries external dependencies
464501
(as found in ``Requires-External-Dep``) only.
465502

@@ -490,72 +527,73 @@ to be present on the system already.
490527
``build-requires``/``optional-build-requires``
491528
''''''''''''''''''''''''''''''''''''''''''''''
492529

493-
- Format: Array of ``dep:`` strings (``build-requires``) and a table
494-
with values of arrays of ``dep:`` strings (``optional-build-requires``)
530+
- Format: Array of external dependency specifiers (``build-requires``) and a
531+
table with values of arrays of external dependency strings
532+
(``optional-build-requires``)
495533
- `Core metadata`_: N/A
496534

497535
The (optional) external build requirements needed to build the project.
498536

499537
For ``build-requires``, it is a key whose value is an array of strings. Each
500538
string represents a build requirement of the project and MUST be formatted as
501-
a valid ``dep:`` string.
539+
a valid external dependency string.
502540

503541
For ``optional-build-requires``, it is a table where each key specifies an
504542
extra set of build requirements and whose value is an array of strings. The
505-
strings of the arrays MUST be valid ``dep:`` strings.
543+
strings of the arrays MUST be valid external dependency strings.
506544

507545
``host-requires``/``optional-host-requires``
508546
''''''''''''''''''''''''''''''''''''''''''''
509547

510-
- Format: Array of ``dep:`` strings (``host-requires``) and a table
511-
with values of arrays of ``dep:`` strings (``optional-host-requires``)
512-
- `Core metadata`_: N/A
548+
- Format: Array of external dependency strings (``host-requires``) and a table
549+
with values of arrays of external dependency strings (``optional-host-requires``) -
550+
`Core metadata`_: N/A
513551

514552
The (optional) external host requirements needed to build the project.
515553

516554
For ``host-requires``, it is a key whose value is an array of strings. Each
517555
string represents a host requirement of the project and MUST be formatted as
518-
a valid ``dep:`` string.
556+
a valid external dependency string.
519557

520558
For ``optional-host-requires``, it is a table where each key specifies an
521559
extra set of host requirements and whose value is an array of strings. The
522-
strings of the arrays MUST be valid ``dep:`` strings.
560+
strings of the arrays MUST be valid external dependency strings.
523561

524562
``dependencies``/``optional-dependencies``
525563
''''''''''''''''''''''''''''''''''''''''''
526564

527-
- Format: Array of ``dep:`` strings (``dependencies``) and a table
528-
with values of arrays of ``dep:`` strings (``optional-dependencies``)
565+
- Format: Array of external dependency strings (``dependencies``) and a table
566+
with values of arrays of external dependency strings
567+
(``optional-dependencies``)
529568
- `Core metadata`_: ``Requires-External-Dep``, ``Provides-External-Extra``
530569

531570
The (optional) runtime dependencies of the project.
532571

533572
For ``dependencies``, it is a key whose value is an array of strings. Each
534-
string represents a dependency of the project and MUST be formatted as either a
535-
valid ``dep:`` string. Each string must be added to `Core Metadata`_ as a
573+
string represents a dependency of the project and MUST be formatted as a valid
574+
external dependency string. Each string must be added to `Core Metadata`_ as a
536575
``Requires-External-Dep`` field.
537576

538577
For ``optional-dependencies``, it is a table where each key specifies an *extra*
539578
and whose value is an array of strings. The strings of the arrays MUST be valid
540-
``dep:`` strings. For each ``optional-dependencies`` group:
579+
external dependency strings. For each ``optional-dependencies`` group:
541580

542581
- The name of the group MUST be added to `Core Metadata`_ as a
543582
``Provides-External-Extra`` field.
544-
- The ``dep:`` URLs in that group MUST be added to `Core Metadata`_ as a
545-
``Requires-External-Dep`` field, with the corresponding ``; extra == 'name'``
546-
environment marker.
583+
- The external dependency specifiers in that group MUST be added to `Core
584+
Metadata`_ as a ``Requires-External-Dep`` field, with the corresponding ``;
585+
extra == 'name'`` environment marker.
547586

548587
``dependency-groups``
549588
'''''''''''''''''''''
550589

551590
- Format: A table where each key is the name of the group, and the values are
552-
arrays of ``dep:`` strings, tables, or a mix of both.
591+
arrays of external dependency strings, tables, or a mix of both.
553592
- `Core metadata`_: N/A
554593

555-
PEP 735 -style dependency groups, but using ``dep:`` URLs instead of PEP 508 strings as
556-
dependency specifiers. Every other detail (e.g. group inclusion, name normalization)
557-
follows the official `Dependency Groups specification
558-
<https://packaging.python.org/en/latest/specifications/dependency-groups/>`__.
594+
PEP 735 -style dependency groups, but using external dependency specifiers
595+
instead of PEP 508 strings. Every other detail (e.g. group inclusion, name
596+
normalization) follows the official `dependency groups specification`_.
559597

560598
Examples
561599
--------
@@ -1017,6 +1055,9 @@ CC0-1.0-Universal license, whichever is more permissive.
10171055
.. _setuptools metadata: https://setuptools.readthedocs.io/en/latest/setuptools.html#metadata
10181056
.. _SPDX: https://spdx.dev/
10191057
.. _PURL: https://github.com/package-url/purl-spec/
1058+
.. _version specifier: https://packaging.python.org/en/latest/specifications/version-specifiers/
1059+
.. _dependencies specifier: https://packaging.python.org/en/latest/specifications/dependency-specifiers/
1060+
.. _dependency groups specification: https://packaging.python.org/en/latest/specifications/dependency-groups/
10201061
.. _packageurl-python: https://pypi.org/project/packageurl-python/
10211062
.. _vers: https://github.com/package-url/purl-spec/blob/version-range-spec/VERSION-RANGE-SPEC.rst
10221063
.. _vers implementation for PURL: https://github.com/package-url/purl-spec/pull/139

0 commit comments

Comments
 (0)