Skip to content

Commit 3f24658

Browse files
committed
Move commands and specifier_syntax details to subsections
1 parent 3a9bcae commit 3f24658

File tree

1 file changed

+66
-59
lines changed

1 file changed

+66
-59
lines changed

peps/pep-0804.rst

Lines changed: 66 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -612,7 +612,7 @@ Each entry in this list is defined as a dictionary with these fields:
612612

613613
.. list-table::
614614
:header-rows: 1
615-
:widths: 25 25 50
615+
:widths: 25 15 60
616616

617617
* - Field
618618
- Type
@@ -622,71 +622,78 @@ Each entry in this list is defined as a dictionary with these fields:
622622
- Short identifier for this package manager (usually the command name).
623623
* - ``commands`` (required)
624624
- ``dict``
625-
- Commands used to install or query the given package(s). Only two keys
626-
are allowed: ``install`` (to generate install instructions) and ``query`` (to
627-
check whether a given package is already installed). Their value is a dictionary
628-
with:
625+
- Commands used to install or query the given package(s). See subsection
626+
below for more details.
627+
* - ``specifier_syntax`` (required)
628+
- ``dict``
629+
- Mapping of allowed PEP440 version specifiers to the syntax used in this
630+
package manager. See subsection below for more details.
629631

630-
- a required key ``command`` that takes a list of strings
631-
(as expected by ``subprocess.run``).
632+
``commands``
633+
""""""""""""
632634

633-
- an optional ``requires_elevation`` boolean (``False`` by default)
634-
to indicate whether the command must run with elevated permissions
635-
(e.g. administrator on Windows, superuser on Linux and macOS).
635+
Only two keys are allowed: ``install`` (to generate install instructions) and
636+
``query`` (to check whether a given package is already installed). Their value
637+
is a dictionary with:
636638

637-
- an enum ``multiple_specifiers`` that determines whether the command
638-
accepts multiple package specifiers at the same time, taking one of:
639+
- a required key ``command`` that takes a list of strings (as expected by
640+
``subprocess.run``).
639641

640-
- ``always``, default in ``install``.
642+
- an optional ``requires_elevation`` boolean (``False`` by default) to indicate
643+
whether the command must run with elevated permissions (e.g. administrator on
644+
Windows, superuser on Linux and macOS).
641645

642-
- ``name-only``, the command only accepts multiple specifiers if they do
643-
not contain version constraints.
646+
- an enum ``multiple_specifiers`` that determines whether the command accepts
647+
multiple package specifiers at the same time, taking one of:
644648

645-
- ``never``, default in ``query``.
649+
- ``always``, default in ``install``.
646650

647-
Exactly one of the ``command`` items MUST be the ``{}`` placeholder,
648-
which will be replaced by the mapped package specifier(s). The
649-
``install`` command SHOULD support the placeholder being replaced by
650-
multiple specifiers, ``query`` MUST only receive a single specifier
651-
per command.
652-
* - ``specifier_syntax`` (required)
653-
- ``dict``
654-
- Mapping of allowed PEP440 version specifiers to the syntax used in this
655-
package manager. Three top-level keys are expected and required:
656-
657-
- ``name_only`` MUST take a list of strings as the syntax used for specifiers
658-
that do not contain any version information; it MUST include the placeholder
659-
``{name}``.
660-
661-
- ``exact_version`` MUST be ``None`` or a list of strings that describe
662-
the syntax used for specifiers that only express exact version
663-
constraints; in the latter case, the placeholders ``{name}``
664-
and ``{version}`` MUST be present in at least one of the strings
665-
(although not necessary the same string for both).
666-
667-
- ``version_ranges`` MUST be ``None`` or a dictionary with the
668-
following required keys:
669-
670-
- the key ``syntax`` takes a list of strings where at least one MUST
671-
include the ``{ranges}`` placeholder (to be replaced by the
672-
maybe-joined version constraints, as determined by the value of
673-
``and``). They MAY also include the ``{name}`` placeholder.
674-
675-
- the keys ``equal``, ``greater_than``, ``greater_than_equal``,
676-
``less_than``, and ``less_than_equal`` take a string
677-
if the operator is supported, ``None`` otherwise. In the former case,
678-
the value MUST include the ``{version}`` placeholder, and MAY include
679-
``{name}``.
680-
681-
- the key ``and`` takes a string used to join multiple version
682-
constraints in a single token, or ``None`` if only a single
683-
constraint can be used per token. In the latter case, the different
684-
constraints will be "exploded" into several tokens using the
685-
``syntax`` template.
686-
687-
When ``exact_version`` or ``version_ranges`` are set to ``None``, it
688-
indicates that the respective types of specifiers are not supported
689-
by the package manager.
651+
- ``name-only``, the command only accepts multiple specifiers if they do not
652+
contain version constraints.
653+
654+
- ``never``, default in ``query``.
655+
656+
Exactly one of the ``command`` items MUST be the ``{}`` placeholder, which will
657+
be replaced by the mapped package specifier(s). The ``install`` command SHOULD
658+
support the placeholder being replaced by multiple specifiers, ``query`` MUST
659+
only receive a single specifier per command.
660+
661+
``specifier_syntax``
662+
""""""""""""""""""""
663+
664+
Three top-level keys are expected and required:
665+
666+
- ``name_only`` MUST take a list of strings as the syntax used for specifiers
667+
that do not contain any version information; it MUST include the placeholder
668+
``{name}``.
669+
670+
- ``exact_version`` MUST be ``None`` or a list of strings that describe the
671+
syntax used for specifiers that only express exact version constraints; in
672+
the latter case, the placeholders ``{name}`` and ``{version}`` MUST be
673+
present in at least one of the strings (although not necessary the same
674+
string for both).
675+
676+
- ``version_ranges`` MUST be ``None`` or a dictionary with the following
677+
required keys:
678+
679+
- the key ``syntax`` takes a list of strings where at least one MUST include
680+
the ``{ranges}`` placeholder (to be replaced by the maybe-joined version
681+
constraints, as determined by the value of ``and``). They MAY also include
682+
the ``{name}`` placeholder.
683+
684+
- the keys ``equal``, ``greater_than``, ``greater_than_equal``,
685+
``less_than``, and ``less_than_equal`` take a string if the operator is
686+
supported, ``None`` otherwise. In the former case, the value MUST include
687+
the ``{version}`` placeholder, and MAY include ``{name}``.
688+
689+
- the key ``and`` takes a string used to join multiple version constraints in
690+
a single token, or ``None`` if only a single constraint can be used per
691+
token. In the latter case, the different constraints will be "exploded"
692+
into several tokens using the ``syntax`` template.
693+
694+
When ``exact_version`` or ``version_ranges`` are set to ``None``, it
695+
indicates that the respective types of specifiers are not supported by the
696+
package manager.
690697

691698

692699
Examples

0 commit comments

Comments
 (0)