Skip to content

Commit 40bbaaa

Browse files
brettcannonhugovk
andauthored
PEP 751: updates based on user feedback (#3969)
Co-authored-by: Hugo van Kemenade <[email protected]>
1 parent b4e7700 commit 40bbaaa

File tree

1 file changed

+55
-52
lines changed

1 file changed

+55
-52
lines changed

peps/pep-0751.rst

Lines changed: 55 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -359,16 +359,16 @@ unless otherwise specified for the same reason.
359359
purpose.
360360

361361

362-
``packages.simple-repo-package-url``
362+
``packages.index-url``
363363
------------------------------------
364364

365365
- Optional (although mutually exclusive with
366-
``packages.files.simple-repo-package-url``)
366+
``packages.files.index-url``)
367367
- String
368-
- Stores the `project detail`_ URL from the `Simple Repository API`_.
368+
- Stores the `project index`_ URL from the `Simple Repository API`_.
369369
- Useful for generating Packaging URLs (aka PURLs).
370370
- When possible, lockers SHOULD include this or
371-
``packages.files.simple-repo-package-url`` to assist with generating
371+
``packages.files.index-url`` to assist with generating
372372
`software bill of materials`_ (aka SBOMs).
373373

374374

@@ -464,29 +464,38 @@ unless otherwise specified for the same reason.
464464
package, regardless of version.
465465

466466

467-
``packages.files.simple-repo-package-url``
467+
``packages.files.index-url``
468468
''''''''''''''''''''''''''''''''''''''''''
469469

470470
- Optional (although mutually exclusive with
471-
``packages.simple-repo-package-url``)
471+
``packages.index-url``)
472472
- String
473-
- The value has the same meaning as ``packages.simple-repo-package-url``.
473+
- The value has the same meaning as ``packages.index-url``.
474474
- This key is available per-file to support :pep:`708` when some files override
475475
what's provided by another `Simple Repository API`_ index.
476476

477477

478-
``packages.files.origin``
479-
'''''''''''''''''''''''''
478+
``packages.files.url``
479+
''''''''''''''''''''''
480480

481-
- Optional
481+
- Optional (and mutually exclusive with ``packages.path``)
482482
- String
483-
- URI where the file was found when the lock file was generated.
484-
- If the URI is a relative file path, it is considered relative to the lock
485-
file.
483+
- URL where the file was found when the lock file was generated.
486484
- Useful for documenting where the file was originally found and potentially
487485
where to look for the file if it is not already downloaded/available.
488-
- Installers MUST NOT assume the URI will always work, but installers MAY use
489-
the URI if it happens to work.
486+
- Installers MUST NOT assume the URL will always work, but installers MAY use
487+
the URL if it happens to work.
488+
489+
490+
``packages.path``
491+
'''''''''''''''''
492+
493+
- Optional (and mutually exclusive with ``packages.path``)
494+
- String
495+
- File system path to where the file was found when the lock file was generated.
496+
- Path may be relative to the lock file's location or absolute.
497+
- Installers MUST NOT assume the path will always work, but installers MAY use
498+
the path if it happens to work.
490499

491500

492501
``packages.files.hash``
@@ -518,11 +527,22 @@ unless otherwise specified for the same reason.
518527
of the direct URL data structure.
519528

520529

521-
``packages.vcs.origin``
530+
``packages.vcs.url``
522531
'''''''''''''''''''''''
523532

533+
- Mutually exclusive with ``packages.vcs.path``
524534
- String
525-
- The URI of where the repository was located when the lock file was generated.
535+
- The URL of where the repository was located when the lock file was generated.
536+
537+
538+
``packages.vcs.path``
539+
'''''''''''''''''''''
540+
541+
- Mutually exclusive with ``packages.vcs.url``
542+
- String
543+
- The file system path where the repository was located when the lock file was
544+
generated.
545+
- The path may be relative to the lock file or absolute.
526546

527547

528548
``packages.vcs.commit``
@@ -573,27 +593,6 @@ unless otherwise specified for the same reason.
573593
install.
574594

575595

576-
``[[packages.build-requires]]``
577-
-------------------------------
578-
579-
- Optional
580-
- An array of tables whose structure matches that of ``[[packages]]``.
581-
- Each entry represents a package and version to use when building the
582-
enclosing package and version.
583-
- The array is complete/locked like ``[[packages]]`` itself (i.e. installers
584-
follow the same installation procedure for ``[[packages.build-requires]]`` as
585-
``[[packages]]``)
586-
- Selection of which entries to use for an environment as the same as
587-
``[[packages]]`` itself, albeit only applying when installing the build
588-
back-end and its dependencies.
589-
- This helps with reproducibility of the building of a package by recording
590-
either what was or would have been used if the locker needed to build the
591-
packages.
592-
- If the installer and user choose to install from source and this array is
593-
missing then the installer MAY choose to resolve what to install for building
594-
at install time, otherwise the installer MUST raise an error.
595-
596-
597596
``[packages.tool]``
598597
-------------------
599598

@@ -649,7 +648,7 @@ Per-file locking
649648
dependencies = []
650649
direct = false
651650
files = [
652-
{name = 'attrs-23.2.0-py3-none-any.whl', lock = ['CPython 3.12 on manylinux 2.17 x86-64', 'CPython 3.12 on Windows x64'], origin = 'https://files.pythonhosted.org/packages/e0/44/827b2a91a5816512fcaf3cc4ebc465ccd5d598c45cefa6703fcf4a79018f/attrs-23.2.0-py3-none-any.whl', hash = '99b87a485a5820b23b879f04c2305b44b951b502fd64be915879d77a7e8fc6f1'}
651+
{name = 'attrs-23.2.0-py3-none-any.whl', lock = ['CPython 3.12 on manylinux 2.17 x86-64', 'CPython 3.12 on Windows x64'], url = 'https://files.pythonhosted.org/packages/e0/44/827b2a91a5816512fcaf3cc4ebc465ccd5d598c45cefa6703fcf4a79018f/attrs-23.2.0-py3-none-any.whl', hash = '99b87a485a5820b23b879f04c2305b44b951b502fd64be915879d77a7e8fc6f1'}
653652
]
654653
655654
[[packages]]
@@ -662,7 +661,7 @@ Per-file locking
662661
dependencies = ['attrs']
663662
direct = false
664663
files = [
665-
{name = 'cattrs-23.2.3-py3-none-any.whl', lock = ['CPython 3.12 on manylinux 2.17 x86-64', 'CPython 3.12 on Windows x64'], origin = 'https://files.pythonhosted.org/packages/b3/0d/cd4a4071c7f38385dc5ba91286723b4d1090b87815db48216212c6c6c30e/cattrs-23.2.3-py3-none-any.whl', hash = '0341994d94971052e9ee70662542699a3162ea1e0c62f7ce1b4a57f563685108'}
664+
{name = 'cattrs-23.2.3-py3-none-any.whl', lock = ['CPython 3.12 on manylinux 2.17 x86-64', 'CPython 3.12 on Windows x64'], url = 'https://files.pythonhosted.org/packages/b3/0d/cd4a4071c7f38385dc5ba91286723b4d1090b87815db48216212c6c6c30e/cattrs-23.2.3-py3-none-any.whl', hash = '0341994d94971052e9ee70662542699a3162ea1e0c62f7ce1b4a57f563685108'}
666665
]
667666
668667
[[packages]]
@@ -675,15 +674,15 @@ Per-file locking
675674
dependencies = []
676675
direct = false
677676
files = [
678-
{name = 'numpy-2.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl', lock = ['cp312-manylinux_2_17_x86_64'], origin = 'https://files.pythonhosted.org/packages/2c/f3/61eeef119beb37decb58e7cb29940f19a1464b8608f2cab8a8616aba75fd/numpy-2.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl', hash = '6790654cb13eab303d8402354fabd47472b24635700f631f041bd0b65e37298a'},
679-
{name = 'numpy-2.0.1-cp312-cp312-win_amd64.whl', lock = ['cp312-win_amd64'], origin = 'https://files.pythonhosted.org/packages/b5/59/f6ad30785a6578ad85ed9c2785f271b39c3e5b6412c66e810d2c60934c9f/numpy-2.0.1-cp312-cp312-win_amd64.whl', hash = 'bb2124fdc6e62baae159ebcfa368708867eb56806804d005860b6007388df171'}
677+
{name = 'numpy-2.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl', lock = ['cp312-manylinux_2_17_x86_64'], url = 'https://files.pythonhosted.org/packages/2c/f3/61eeef119beb37decb58e7cb29940f19a1464b8608f2cab8a8616aba75fd/numpy-2.0.1-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl', hash = '6790654cb13eab303d8402354fabd47472b24635700f631f041bd0b65e37298a'},
678+
{name = 'numpy-2.0.1-cp312-cp312-win_amd64.whl', lock = ['cp312-win_amd64'], url = 'https://files.pythonhosted.org/packages/b5/59/f6ad30785a6578ad85ed9c2785f271b39c3e5b6412c66e810d2c60934c9f/numpy-2.0.1-cp312-cp312-win_amd64.whl', hash = 'bb2124fdc6e62baae159ebcfa368708867eb56806804d005860b6007388df171'}
680679
]
681680
682681
683682
Per-package locking
684683
===================
685684

686-
Some values for ``packages.files.origin`` left out to make creating this
685+
Some values for ``packages.files.url`` left out to make creating this
687686
example more easily as it was done by hand.
688687

689688
.. code-block:: toml
@@ -706,7 +705,7 @@ example more easily as it was done by hand.
706705
dependencies = []
707706
direct = false
708707
files = [
709-
{name = 'attrs-23.2.0-py3-none-any.whl', lock = ['cp312-manylinux_2_17_x86_64', 'cp312-win_amd64'], origin = 'https://files.pythonhosted.org/packages/e0/44/827b2a91a5816512fcaf3cc4ebc465ccd5d598c45cefa6703fcf4a79018f/attrs-23.2.0-py3-none-any.whl', hash = '99b87a485a5820b23b879f04c2305b44b951b502fd64be915879d77a7e8fc6f1'}
708+
{name = 'attrs-23.2.0-py3-none-any.whl', lock = ['cp312-manylinux_2_17_x86_64', 'cp312-win_amd64'], url = 'https://files.pythonhosted.org/packages/e0/44/827b2a91a5816512fcaf3cc4ebc465ccd5d598c45cefa6703fcf4a79018f/attrs-23.2.0-py3-none-any.whl', hash = '99b87a485a5820b23b879f04c2305b44b951b502fd64be915879d77a7e8fc6f1'}
710709
]
711710
712711
[[packages]]
@@ -719,7 +718,7 @@ example more easily as it was done by hand.
719718
dependencies = ['attrs']
720719
direct = false
721720
files = [
722-
{name = 'cattrs-23.2.3-py3-none-any.whl', lock = ['cp312-manylinux_2_17_x86_64', 'cp312-win_amd64'], origin = 'https://files.pythonhosted.org/packages/b3/0d/cd4a4071c7f38385dc5ba91286723b4d1090b87815db48216212c6c6c30e/cattrs-23.2.3-py3-none-any.whl', hash = '0341994d94971052e9ee70662542699a3162ea1e0c62f7ce1b4a57f563685108'}
721+
{name = 'cattrs-23.2.3-py3-none-any.whl', lock = ['cp312-manylinux_2_17_x86_64', 'cp312-win_amd64'], url = 'https://files.pythonhosted.org/packages/b3/0d/cd4a4071c7f38385dc5ba91286723b4d1090b87815db48216212c6c6c30e/cattrs-23.2.3-py3-none-any.whl', hash = '0341994d94971052e9ee70662542699a3162ea1e0c62f7ce1b4a57f563685108'}
723722
]
724723
725724
[[packages]]
@@ -821,9 +820,6 @@ Example workflow
821820
an error MUST be raised due to ambiguity for what is to be installed.
822821
- Find and verify the candidate files and/or VCS entries based on their hash or
823822
commit ID as appropriate.
824-
- If a source distribution or VCS was selected and
825-
``[[packages.build-requires]]`` exists, then repeat the above process as
826-
appropriate to install the build dependencies necessary to build the package.
827823
- Install the candidate files.
828824

829825

@@ -853,9 +849,6 @@ Example workflow
853849
- If no match is found, an error MUST be raised.
854850
- Find and verify the selected files and/or VCS entries based on their hash or
855851
commit ID as appropriate.
856-
- If the match is a source distribution or VCS and
857-
``[[packages.build-requires]]`` is provided, repeat the above as appropriate
858-
to build the package.
859852
- Install the selected files.
860853

861854

@@ -1096,6 +1089,16 @@ for was considered. In the end, though, it was rejected as it was deemed
10961089
unnecessary bookkeeping.
10971090

10981091

1092+
Locking build requirements for sdists
1093+
=====================================
1094+
1095+
An earlier version of this PEP tried to lock the build requirements for sdists
1096+
under a ``packages.build-requires`` key. Unfortunately it confused enough people
1097+
about how it was expected to operate and there were enough edge case issues to
1098+
decide it wasn't worth trying to do in this PEP upfront. Instead, a future PEP
1099+
could propose a solution.
1100+
1101+
10991102
===========
11001103
Open Issues
11011104
===========
@@ -1133,7 +1136,7 @@ CC0-1.0-Universal license, whichever is more permissive.
11331136
.. _PDM: https://pypi.org/project/pdm/
11341137
.. _pip-tools: https://pypi.org/project/pip-tools/
11351138
.. _Poetry: https://python-poetry.org/
1136-
.. _project detail: https://packaging.python.org/en/latest/specifications/simple-repository-api/#project-detail
1139+
.. _project index: https://packaging.python.org/en/latest/specifications/simple-repository-api/#project-list
11371140
.. _pyproject.toml specification: https://packaging.python.org/en/latest/specifications/pyproject-toml/#pyproject-toml-specification
11381141
.. _Simple Repository API: https://packaging.python.org/en/latest/specifications/simple-repository-api/
11391142
.. _software bill of materials: https://www.cisa.gov/sbom

0 commit comments

Comments
 (0)