Skip to content

Commit 165e2cb

Browse files
committed
Fix some typos and polish some details
1 parent 7997f0d commit 165e2cb

File tree

1 file changed

+52
-43
lines changed

1 file changed

+52
-43
lines changed

peps/pep-0804.rst

Lines changed: 52 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,14 @@ Packages on PyPI often require build-time and runtime dependencies that are not
2727
present on PyPI. :pep:`725` introduced metadata to express
2828
such dependencies. Using concrete external dependency metadata for
2929
a Python package requires mapping the given dependency identifiers to the specifiers
30-
used in other ecosystems, which would allow to:
30+
used in other ecosystems, which would allow:
3131

3232
- Enabling tools to automatically map external dependencies to packages in other
3333
packaging repositories/ecosystems,
3434
- Including the needed external dependencies *with the package
3535
names used by the relevant system package manager on the user's system* in
3636
error messages emitted by Python package installers and build frontends,
37-
as well as allowing the user to obtain install instructions for those packages.
37+
as well as allowing the user to obtain installation instructions for those packages.
3838

3939
Packaging ecosystems like Linux distros, conda, Homebrew, Spack, and Nix need
4040
full sets of dependencies for Python packages, and have tools like pyp2rpm_
@@ -44,7 +44,7 @@ upstream Python packages. Before PEP 725, external dependencies were handled man
4444
because there was no metadata for this in ``pyproject.toml`` or any other
4545
standard metadata file. Enabling its automatic conversion is a key benefit of
4646
this PEP, making Python packaging easier and more reliable. In addition, the
47-
authors envision other types of tools making use of this information; e.g.,
47+
authors envision other types of tools making use of this information; e.g.
4848
dependency analysis tools like Repology_, Dependabot_ and libraries.io_.
4949

5050

@@ -72,23 +72,23 @@ RPM-based distributions, like Fedora, can use a `rule-based implementation
7272
<https://discuss.python.org/t/wanting-a-singular-packaging-tool-vision/21141/117>`__
7373
(``NameConvertor``) in pyp2rpm_. The main rule is that the RPM name for a PyPI package is
7474
typically ``f"python3-{pypi_package_name}"``. The rare exceptions include packages that
75-
primarily distribute an application, which drop the prefix, (e.g., the Black formatter
75+
primarily distribute an application, which drop the prefix, (e.g. the Black formatter
7676
is simply ``black``, not ``python3-black``), and variants for different Python versions
77-
(e.g., in RHEL 9 ``setuptools`` can be found as ``python3-setuptools`` for Python 3.9,
77+
(e.g. in RHEL 9 ``setuptools`` can be found as ``python3-setuptools`` for Python 3.9,
7878
but ``python3.11-setuptools`` and ``python3.12-setuptools`` are also available). More details
7979
are available in `Fedora's packaging guidelines for Python <https://docs.fedoraproject.org/en-US/packaging-guidelines/Python/#_naming>`__.
8080

8181
Debian packages typically follow a ``f"python3-{import_name}"`` naming scheme, with some
82-
exceptions: some sub-communities have an infix (e.g., Django packages go under
82+
exceptions: some sub-communities have an infix (e.g. Django packages go under
8383
``f"python3-django-*"``), and applications are often distributed by their name, with no
8484
``python3-`` prefix. Additional details are available in `Debian's Python Policy <https://www.debian.org/doc/packaging-manuals/python-policy/#module-package-names>`__.
8585

8686
Gentoo follows a similar approach to naming Python packages, using the ``dev-python/``
8787
category and some `well-specified rules <https://projects.gentoo.org/python/guide/package-maintenance.html>`__.
8888

8989
Conda-forge has a more explicit name mapping, because the base names are the
90-
same in conda-forge as on PyPI (e.g., ``numpy`` maps to ``numpy``), but there
91-
are many exceptions because of both name collisions and renames (e.g., the PyPI
90+
same in conda-forge as on PyPI (e.g. ``numpy`` maps to ``numpy``), but there
91+
are many exceptions because of both name collisions and renames (e.g. the PyPI
9292
name for PyTorch is ``torch`` while in conda-forge it's ``pytorch``). There are
9393
several name mappings efforts maintained by different teams. Conda-forge's infrastructure
9494
generates one in `regro/cf-graph-countyfair <https://github.com/regro/cf-graph-countyfair/tree/master/mappings/pypi>`__.
@@ -152,7 +152,7 @@ this could be made both more comprehensive and easier to maintain through a tool
152152
command with semantics of *"show this ecosystem's preferred package manager
153153
install command for all external dependencies"*. This may be done as a
154154
standalone tool, or as a new subcommand in any Python development workflow tool
155-
(e.g., Pip, Poetry, Hatch, PDM, uv).
155+
(e.g. Pip, Poetry, Hatch, PDM, uv).
156156

157157
To this end, each ecosystem mapping can provide a list of package managers
158158
known to be compatible, with templated instructions on how to install and query installed
@@ -167,7 +167,7 @@ Registry design
167167
The mapping infrastructure has been designed to present the following components and properties:
168168

169169
- A central registry of PEP 725 identifiers (DepURLs), including at least the
170-
well-known generic and virtual identifiers considered canonical.
170+
well-known ``generic`` and ``virtual`` identifiers considered canonical.
171171
- A list of known ecosystems, where ecosystem maintainers can register their name mapping(s).
172172
- A standardized schema that defines how mappings should be structured. Each mapping can
173173
also provide programmatic details about how their supported package manager(s) work.
@@ -237,7 +237,7 @@ of dictionaries, in which each entry consists of:
237237

238238
- a dictionary with three keys (``build``, ``build_host``, ``run``). The values
239239
MUST be a string or list of strings representing the ecosystem-specific package
240-
identifiers as needed as build-, host- and runtime dependencies (see PEP 725 for
240+
identifiers as needed as build-, host- and runtime dependencies (see :pep:`725` for
241241
details on these definitions).
242242

243243
- for convenience, a string or a list of strings are also accepted as a
@@ -251,12 +251,12 @@ of dictionaries, in which each entry consists of:
251251
field will be imported. Either ``specs`` or ``specs_from`` MUST be present.
252252

253253
- an optional ``urls`` field whose value MUST be a URL, a list of URLs, or a
254-
dictionary that maps a string to a URL. This is useful to link to external
254+
dictionary that maps a non-empty string to a URL. This is useful to link to external
255255
resources that provide more information about the mapped packages.
256256

257-
The mappings SHOULD also specify another section ``package_managers``, reporting
257+
The mappings MUST also specify another section ``package_managers``, reporting
258258
which package managers are available in the ecosystem and how to use them. This field MUST
259-
take a list of dictionaries, with each of them reporting the following fields:
259+
take an empty list or a list of dictionaries, with each of them reporting the following fields:
260260

261261
- ``name`` (string), unique identifier for this package manager. Usually, the executable name.
262262

@@ -266,21 +266,22 @@ take a list of dictionaries, with each of them reporting the following fields:
266266
- ``install``, to generate install instructions. The exit code MUST be ``0`` on success.
267267

268268
- ``query``, to check whether a given package is already installed. If the package is
269-
installed, the command MUST result in an exit code of ``0``. Otherwise, an exit code
270-
of ``1`` SHOULD be used.
269+
installed, the command MUST result in an exit code of ``0``. Otherwise, a non-zero exit code
270+
MUST be returned.
271271

272-
- ``specifier_syntax``: instructions on how to map a subset of PEP 440 specifiers to
273-
the target package manager. Three levels of support are offered: name-only, exact-version-only,
274-
and version-range compatibility (with per-operator translations).
272+
- ``specifier_syntax``: instructions on how to map a subset of PEP 440 specifiers (as determined
273+
in PEP 725)to the target package manager. Three levels of support are offered: name-only,
274+
exact-version-only, and version-range compatibility (with per-operator translations).
275275

276276
Each mapping MUST have a canonical URL for online retrieval, with the
277277
filename following the rules described in the section below. These
278278
mappings MAY also be packaged for offline distribution in each platform. The authors
279-
recommend placing in the standard location for data artifacts in each operating
279+
recommend placing them in the standard location for data artifacts in each operating
280280
system; e.g. ``$XDG_DATA_DIRS`` on Linux and others, ``~/Library/Application Support`` on
281281
macOS, and ``%LOCALAPPDATA%`` for Windows. The subdirectory identifier MUST
282282
be ``external-packaging-metadata-mappings``. This data directory SHOULD only
283-
contain mapping documents named ``{ecosystem-identifier}.mapping.json``. The central
283+
contain mapping documents named ``{ecosystem-identifier}.mapping.json`` (see section below
284+
for details on the construction of ecosystem identifiers). The central
284285
registry and known ecosystem documents MAY also be distributed in this directory,
285286
as ``registry.json`` and ``known-ecosystems.json``, respectively.
286287

@@ -447,7 +448,7 @@ The known ecosystems list is specified by the following
447448
* - Type
448449
- ``string``
449450
* - Description
450-
- URL of the mappings schema in use for the document.
451+
- URL of the schema in use for the document.
451452
* - Required
452453
- False
453454

@@ -459,6 +460,8 @@ The known ecosystems list is specified by the following
459460

460461
* - Type
461462
- ``integer``
463+
* - Description
464+
- Version of the schema in use.
462465
* - Required
463466
- False
464467

@@ -486,7 +489,7 @@ to a sub-dictionary defined as:
486489
- Value type
487490
- Value description
488491
- Required
489-
* - ``Literal['mapping']``
492+
* - ``mapping``
490493
- ``AnyURL``
491494
- URL to the mapping for this ecosystem
492495
- True
@@ -518,6 +521,8 @@ The mappings are specified by the following
518521

519522
* - Type
520523
- ``integer``
524+
* - Description
525+
- Version of the schema in use.
521526
* - Required
522527
- False
523528

@@ -530,7 +535,7 @@ The mappings are specified by the following
530535
* - Type
531536
- ``string``
532537
* - Description
533-
- Name of the schema
538+
- Name of the schema.
534539
* - Required
535540
- True
536541

@@ -541,7 +546,7 @@ The mappings are specified by the following
541546
:widths: 25 75
542547

543548
* - Type
544-
- ``string | None``
549+
- ``string``
545550
* - Description
546551
- Free-form field to add information this mapping. Allows
547552
Markdown.
@@ -573,7 +578,7 @@ Each entry in this list is defined as:
573578
- Required
574579
* - ``id``
575580
- ``DepURLField`` (``string`` matching regex ``^dep:.+$``)
576-
- DepURL, as provided in the central registry
581+
- DepURL, as provided in the central registry.
577582
- True
578583
* - ``description``
579584
- ``string``
@@ -625,7 +630,7 @@ Each entry in this list is defined as a dictionary with these fields:
625630
- Required
626631
* - ``name``
627632
- ``string``
628-
- Short identifier for this package manager (usually the command name)
633+
- Short identifier for this package manager (usually the command name).
629634
- True
630635
* - ``commands``
631636
- ``dict[Literal['install', 'query'], dict[Literal['command', 'requires_elevation', 'multiple_specifiers'], list[str] | bool | Literal['always', 'name-only', 'never']]]``
@@ -642,14 +647,14 @@ Each entry in this list is defined as a dictionary with these fields:
642647
(e.g. administrator on Windows, superuser on Linux and macOS).
643648

644649
- an enum ``multiple_specifiers`` that determines whether the command
645-
accepts multiple package specifiers at the same time, accepting one of:
650+
accepts multiple package specifiers at the same time, taking one of:
646651

647-
- ``always``, default in ``install``.
652+
- ``always``, default in ``install``.
648653

649-
- ``name-only``, the command only accepts multiple specifiers if they do
650-
not contain version constraints.
654+
- ``name-only``, the command only accepts multiple specifiers if they do
655+
not contain version constraints.
651656

652-
- ``never``, default in ``query``.
657+
- ``never``, default in ``query``.
653658

654659
Exactly one of the ``command`` items MUST be the ``{}`` placeholder,
655660
which will be replaced by the mapped package specifier(s). The
@@ -1044,9 +1049,11 @@ The ``pyproject-external`` Python API also allows users to do these operations p
10441049
'pixi'
10451050
>>> external.to_dict(mapped_for=ecosystem, package_manager=package_manager)
10461051
{'external': {'build_requires': ['c-compiler', 'cxx-compiler', 'python']}}
1047-
>>> external.install_command(ecosystem, package_manager=package_manager)
1052+
>>> external.install_commands(ecosystem, package_manager=package_manager)
10481053
# {"command": ["pixi", "add", "{}"]}
1049-
['pixi', 'add', 'c-compiler', 'cxx-compiler', 'python']
1054+
[
1055+
['pixi', 'add', 'c-compiler', 'cxx-compiler', 'python'],
1056+
]
10501057
>>> external.query_commands(ecosystem, package_manager=package_manager)
10511058
# {"command": ["pixi", "list", "{}"]}
10521059
[
@@ -1117,7 +1124,7 @@ connectivity to fetch the mappings from their online sources. Instead:
11171124
11181125
- they should vendor the relevant documents in the distributed packages,
11191126
- or depend on prepackaged, offline distributions of these documents,
1120-
- or implement best-practices for authenticity verification of the fetched documents.
1127+
- or implement best practices for authenticity verification of the fetched documents.
11211128
11221129
The install commands have the potential to modify the system configuration of the user.
11231130
When available, tools should prefer creating ephemeral, isolated environments for the
@@ -1153,14 +1160,16 @@ affordances like issue and pull request templates, or linting tools.
11531160
Package ecosystem maintainers usage
11541161
-----------------------------------
11551162
1156-
Missing mapping entries will result in the absence tailored error messages and
1163+
Missing mapping entries will result in the absence of tailored error messages and
11571164
other UX affordances for end users of the impacted ecosystems. It is thus
11581165
recommended that each package ecosystem keeps their mappings up-to-date with
11591166
the central registry. The key to this will be automation, like linting scripts
1160-
(see example at `external-metadata-mappings <https://github.com/jaimergp/external-metadata-mappings/blob/main/scripts/lint-mapping-entries.py>`__),
1167+
(see example at `external-metadata-mappings
1168+
<https://github.com/jaimergp/external-metadata-mappings/blob/main/scripts/lint-mapping-entries.py>`__),
11611169
or periodic notifications via issues or draft submissions.
11621170
1163-
Establishing the initial mapping is likely to involve a lot of work, but ideally the maintenance on an ongoing basis effort should require smaller effort.
1171+
Establishing the initial mapping is likely to involve a lot of work, but ideally
1172+
the maintenance on an ongoing basis effort should require smaller effort.
11641173
11651174
As best practices are discovered and agreed on, they should get documented
11661175
in the central registry repository as learning materials for the mapping
@@ -1188,15 +1197,15 @@ true if the user only relies on wheels, since the only impact will be driven by
11881197
external runtime dependencies (expected to be rare), and even in those cases
11891198
they need to opt-in by installing a compatible tool.
11901199
1191-
Users that do opt-in may find missing entries in for their target ecosystems, for
1200+
Users that do opt-in may find missing entries for their target ecosystems, for
11921201
which they should obtain informative error messages that point to the relevant
11931202
documentation sections. This will allow them to get acquainted with the nature
11941203
of the issue and its potential solutions.
11951204
11961205
We hope that this results in a subset of them reporting the missing entries,
11971206
submitting a fix to the affected mapping or, if totally absent, even deciding
11981207
to maintain a new one on their own. To that end, they should get familiar with
1199-
the responsibilties of mapping maintainers (discussed above).
1208+
the responsibilities of mapping maintainers (discussed above).
12001209
12011210
Reference Implementation
12021211
========================
@@ -1261,7 +1270,7 @@ The reasons include:
12611270
where that extra metadata can be obtained (e.g. the repository at the URL will likely
12621271
include details about authorship and licensing).
12631272
- These details can also be obtained from the actual target ecosystems. In some
1264-
cases this might even be preferable; e.g., for licenses, where downstream packaging
1273+
cases this might even be preferable; e.g. for licenses, where downstream packaging
12651274
can actually affect it by unvendoring dependencies or adjusting optional bits.
12661275
- Those details may change over the lifetime of the project, and keeping them
12671276
up-to-date would increase the maintenance burden on the governance body.
@@ -1342,8 +1351,8 @@ values. The authors have decided to not add this feature given the implied compl
13421351
the following alternatives are proposed:
13431352
13441353
- For mapping authors, automate the generation of derived mappings via scripting and
1345-
cronjobs. For example, simple logic such as fetching the parent mapping, applying the
1346-
necesary modifications and republishing it to the target location should not result
1354+
cron jobs. For example, simple logic such as fetching the parent mapping, applying the
1355+
necessary modifications and republishing it to the target location should not result
13471356
in much maintenance burden.
13481357
13491358
- For end-users wishing to extend a given mapping with custom overrides, client-side

0 commit comments

Comments
 (0)