@@ -222,149 +222,8 @@ canonical, or which versioning scheme applies to virtual DepURLs (see Appendix
222222B). The corresponding answers are not given in this PEP; instead we delegate
223223that responsibility to the central registry maintainers.
224224
225- Mappings
226- --------
227-
228- The mappings specify which ecosystem-specific identifiers provide the canonical
229- entries available in the central registry. A mapping mainly consists of a list
230- of dictionaries, in which each entry consists of:
231-
232- - an ``id `` field with the canonical DepURL.
233-
234- - an optional free form ``description `` text.
235-
236- - a ``specs `` field whose value MUST be one of:
237-
238- - a dictionary with three keys (``build ``, ``host ``, ``run ``). The values
239- 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
241- details on these definitions).
242-
243- - for convenience, a string or a list of strings are also accepted as a
244- shorthand form. In this case, the identifier(s) will be used to populate
245- the three categories mentioned in the item above.
246-
247- - an empty list, which is understood as the ecosystem not having packages to
248- provide such dependency.
249-
250- - a ``specs_from `` field whose value is a DepURL from which the ``specs ``
251- field will be imported. Either ``specs `` or ``specs_from `` MUST be present.
252-
253- - an optional ``urls `` field whose value MUST be a URL, a list of URLs, or a
254- dictionary that maps a non-empty string to a URL. This is useful to link to external
255- resources that provide more information about the mapped packages.
256-
257- The mappings MUST also specify another section ``package_managers ``, reporting
258- which package managers are available in the ecosystem and how to use them. This field MUST
259- take an empty list or a list of dictionaries, with each of them reporting the following fields:
260-
261- - ``name `` (string), unique identifier for this package manager. Usually, the executable name.
262-
263- - ``commands `` (list of dictionaries), the commands to run to install the mapped package(s) and
264- check whether they are already installed. Two types of commands are proposed:
265-
266- - ``install ``, to generate install instructions. The exit code MUST be ``0 `` on success.
267-
268- - ``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, a non-zero exit code
270- MUST be returned.
271-
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).
275-
276- Each mapping MUST have a canonical URL for online retrieval, with the
277- filename following the rules described in the section below. These
278- mappings MAY also be packaged for offline distribution in each platform. The authors
279- recommend placing them in the standard location for data artifacts in each operating
280- system; e.g. ``$XDG_DATA_DIRS `` on Linux and others, ``~/Library/Application Support `` on
281- macOS, and ``%LOCALAPPDATA% `` for Windows. The subdirectory identifier MUST
282- be ``external-packaging-metadata-mappings ``. This data directory SHOULD only
283- contain mapping documents named ``{ecosystem-identifier}.mapping.json `` (see section below
284- for details on the construction of ecosystem identifiers). The central
285- registry and known ecosystem documents MAY also be distributed in this directory,
286- as ``registry.json `` and ``known-ecosystems.json ``, respectively.
287-
288- .. note ::
289-
290- The ``specifier_syntax `` mappings are meant to provide interoperability between
291- ecosystems where choosing which package version to install is possible. For
292- example, this is not the case in many Linux distributions, where each distro
293- release commits to a package version during its lifecycle (although often
294- with the necessary security backports).
295-
296- In these cases, the ``install `` command could be used, optimistically, in
297- "name-only" mode, hoping that the OS-provided version is a good fit. A more
298- pessimistic alternative would be to use the ``query `` command first to see if
299- the available version matches the project constraints, and then install the
300- package by name.
301-
302- Even in those cases, perfect 1:1 version matching is not always possible due to how
303- different ecosystems map upstream releases to repackaged versions (e.g. the epoch
304- had to be bumped to accommodate a change of release schema). In that regard, we do
305- not encode explicit mapping semantics for epochs or pre-releases.
306-
307-
308- Known ecosystems
309- ----------------
310-
311- The list of known ecosystems has two roles:
312-
313- 1. Reporting the canonical URL for its mapping.
314- 2. Assigning a unique, short identifier to each ecosystem.
315-
316- Ecosystem identifiers
317- ^^^^^^^^^^^^^^^^^^^^^
318-
319- The identifier MUST conform to this regex: ``[a-z0-9\-_.]+(\+[a-z0-9\-_.])? ``.
320- In other words, a first field optionally followed by a second, separated
321- by a ``+ `` symbol.
322-
323- For ecosystems corresponding to Linux distributions,
324- the first field MUST correspond to the ``ID `` string as specified in the
325- `os-release <https://www.freedesktop.org/software/systemd/man/latest/os-release.html >`__
326- specification. If provided, the second field MUST correspond to the
327- ``VERSION_ID `` string if relevant.
328-
329- Since the version field is optional, tools SHOULD try to access the versioned
330- identifier but fallback to the name-only identifier if not found.
331-
332- The complete filename MUST be ``{identifier}.mapping.json ``.
333-
334- Some examples:
335-
336- .. list-table ::
337- :header-rows: 1
338-
339- * - Ecosystem
340- - Identifier
341- - Filename
342- * - Debian Bookworm
343- - ``debian+12 ``
344- - ``debian+12.mapping.json ``
345- * - Fedora 40
346- - ``fedora+40 ``
347- - ``fedora+40.mapping.json ``
348- * - Ubuntu 24.04
349- - ``ubuntu+24.04 ``
350- - ``ubuntu+24.04.mapping.json ``
351- * - Arch Linux (rolling)
352- - ``arch ``
353- - ``arch.mapping.json ``
354- * - Homebrew
355- - ``homebrew ``
356- - ``homebrew.mapping.json ``
357- * - conda-forge
358- - ``conda-forge ``
359- - ``conda-forge.mapping.json ``
360-
361- Schema details
362- --------------
363-
364- Three JSON Schema documents are provided to fully standardize the registries and mappings.
365-
366- Central registry schema
367- ^^^^^^^^^^^^^^^^^^^^^^^
225+ Schema
226+ ^^^^^^
368227
369228The central registry is specified by the following
370229`JSON schema <https://github.com/jaimergp/external-metadata-mappings/blob/main/schemas/central-registry.schema.json >`__:
@@ -432,8 +291,61 @@ Each entry in this list is defined as:
432291 - ``AnyUrl | list[AnyUrl] | dict[NonEmptyString, AnyUrl] ``
433292 - Hyperlinks to web locations that provide more information about the definition.
434293
435- Known ecosystems schema
436- ^^^^^^^^^^^^^^^^^^^^^^^
294+ Known ecosystems
295+ ----------------
296+
297+ The list of known ecosystems has two roles:
298+
299+ 1. Reporting the canonical URL for its mapping.
300+ 2. Assigning a unique, short identifier to each ecosystem.
301+
302+ Ecosystem identifiers
303+ ^^^^^^^^^^^^^^^^^^^^^
304+
305+ The identifier MUST conform to this regex: ``[a-z0-9\-_.]+(\+[a-z0-9\-_.])? ``.
306+ In other words, a first field optionally followed by a second, separated
307+ by a ``+ `` symbol.
308+
309+ For ecosystems corresponding to Linux distributions,
310+ the first field MUST correspond to the ``ID `` string as specified in the
311+ `os-release <https://www.freedesktop.org/software/systemd/man/latest/os-release.html >`__
312+ specification. If provided, the second field MUST correspond to the
313+ ``VERSION_ID `` string if relevant.
314+
315+ Since the version field is optional, tools SHOULD try to access the versioned
316+ identifier but fallback to the name-only identifier if not found.
317+
318+ The complete filename MUST be ``{identifier}.mapping.json ``.
319+
320+ Some examples:
321+
322+ .. list-table ::
323+ :header-rows: 1
324+
325+ * - Ecosystem
326+ - Identifier
327+ - Filename
328+ * - Debian Bookworm
329+ - ``debian+12 ``
330+ - ``debian+12.mapping.json ``
331+ * - Fedora 40
332+ - ``fedora+40 ``
333+ - ``fedora+40.mapping.json ``
334+ * - Ubuntu 24.04
335+ - ``ubuntu+24.04 ``
336+ - ``ubuntu+24.04.mapping.json ``
337+ * - Arch Linux (rolling)
338+ - ``arch ``
339+ - ``arch.mapping.json ``
340+ * - Homebrew
341+ - ``homebrew ``
342+ - ``homebrew.mapping.json ``
343+ * - conda-forge
344+ - ``conda-forge ``
345+ - ``conda-forge.mapping.json ``
346+
347+ Schema
348+ ^^^^^^
437349
438350The known ecosystems list is specified by the following
439351`JSON Schema <https://github.com/jaimergp/external-metadata-mappings/blob/main/schemas/known-ecosystems.schema.json >`__:
@@ -496,8 +408,90 @@ to a sub-dictionary defined as:
496408 - URL to the mapping for this ecosystem
497409 - True
498410
499- Mappings schema
500- ^^^^^^^^^^^^^^^
411+ Mappings
412+ --------
413+
414+ The mappings specify which ecosystem-specific identifiers provide the canonical
415+ entries available in the central registry. A mapping mainly consists of a list
416+ of dictionaries, in which each entry consists of:
417+
418+ - an ``id `` field with the canonical DepURL.
419+
420+ - an optional free form ``description `` text.
421+
422+ - a ``specs `` field whose value MUST be one of:
423+
424+ - a dictionary with three keys (``build ``, ``host ``, ``run ``). The values
425+ MUST be a string or list of strings representing the ecosystem-specific package
426+ identifiers as needed as build-, host- and runtime dependencies (see :pep: `725 ` for
427+ details on these definitions).
428+
429+ - for convenience, a string or a list of strings are also accepted as a
430+ shorthand form. In this case, the identifier(s) will be used to populate
431+ the three categories mentioned in the item above.
432+
433+ - an empty list, which is understood as the ecosystem not having packages to
434+ provide such dependency.
435+
436+ - a ``specs_from `` field whose value is a DepURL from which the ``specs ``
437+ field will be imported. Either ``specs `` or ``specs_from `` MUST be present.
438+
439+ - an optional ``urls `` field whose value MUST be a URL, a list of URLs, or a
440+ dictionary that maps a non-empty string to a URL. This is useful to link to external
441+ resources that provide more information about the mapped packages.
442+
443+ The mappings MUST also specify another section ``package_managers ``, reporting
444+ which package managers are available in the ecosystem and how to use them. This field MUST
445+ take an empty list or a list of dictionaries, with each of them reporting the following fields:
446+
447+ - ``name `` (string), unique identifier for this package manager. Usually, the executable name.
448+
449+ - ``commands `` (list of dictionaries), the commands to run to install the mapped package(s) and
450+ check whether they are already installed. Two types of commands are proposed:
451+
452+ - ``install ``, to generate install instructions. The exit code MUST be ``0 `` on success.
453+
454+ - ``query ``, to check whether a given package is already installed. If the package is
455+ installed, the command MUST result in an exit code of ``0 ``. Otherwise, a non-zero exit code
456+ MUST be returned.
457+
458+ - ``specifier_syntax ``: instructions on how to map a subset of PEP 440 specifiers (as determined
459+ in PEP 725)to the target package manager. Three levels of support are offered: name-only,
460+ exact-version-only, and version-range compatibility (with per-operator translations).
461+
462+ Each mapping MUST have a canonical URL for online retrieval, with the
463+ filename following the rules described in the section below. These
464+ mappings MAY also be packaged for offline distribution in each platform. The authors
465+ recommend placing them in the standard location for data artifacts in each operating
466+ system; e.g. ``$XDG_DATA_DIRS `` on Linux and others, ``~/Library/Application Support `` on
467+ macOS, and ``%LOCALAPPDATA% `` for Windows. The subdirectory identifier MUST
468+ be ``external-packaging-metadata-mappings ``. This data directory SHOULD only
469+ contain mapping documents named ``{ecosystem-identifier}.mapping.json `` (see section below
470+ for details on the construction of ecosystem identifiers). The central
471+ registry and known ecosystem documents MAY also be distributed in this directory,
472+ as ``registry.json `` and ``known-ecosystems.json ``, respectively.
473+
474+ .. note ::
475+
476+ The ``specifier_syntax `` mappings are meant to provide interoperability between
477+ ecosystems where choosing which package version to install is possible. For
478+ example, this is not the case in many Linux distributions, where each distro
479+ release commits to a package version during its lifecycle (although often
480+ with the necessary security backports).
481+
482+ In these cases, the ``install `` command could be used, optimistically, in
483+ "name-only" mode, hoping that the OS-provided version is a good fit. A more
484+ pessimistic alternative would be to use the ``query `` command first to see if
485+ the available version matches the project constraints, and then install the
486+ package by name.
487+
488+ Even in those cases, perfect 1:1 version matching is not always possible due to how
489+ different ecosystems map upstream releases to repackaged versions (e.g. the epoch
490+ had to be bumped to accommodate a change of release schema). In that regard, we do
491+ not encode explicit mapping semantics for epochs or pre-releases.
492+
493+ Schema
494+ ^^^^^^
501495
502496The mappings are specified by the following
503497`JSON Schema <https://github.com/jaimergp/external-metadata-mappings/blob/main/schemas/external-mapping.schema.json >`__:
0 commit comments