@@ -210,7 +210,7 @@ consistent order. Usage of inline tables SHOULD also be kept consistent.
210
210
211
211
- **Type **: Array of strings
212
212
- **Required? **: no; defaults to ``[] ``
213
- - **Inspiration **: :ref: `packaging:pyproject-tool-table `
213
+ - **Inspiration **: :ref: `packaging:core-metadata-provides-extra `
214
214
- The list of :ref: `extras <packaging:core-metadata-provides-extra >` supported
215
215
by this lock file.
216
216
- Lockers MAY choose to not support writing lock files that support extras and
@@ -240,6 +240,22 @@ consistent order. Usage of inline tables SHOULD also be kept consistent.
240
240
is, in effect, multi-use even if it only looks to be single-use.
241
241
242
242
243
+ ``default-group ``
244
+ =================
245
+
246
+ - **Type **: String
247
+ - **Required? **: no
248
+ - **Inspiration **: Poetry _, PDM _
249
+ - The name of a synthetic dependency group to represent what should be installed
250
+ by default (e.g. what ``project.dependencies `` implicitly represents).
251
+ - Meant to be used in situations where ``packages.marker `` necessitates such a
252
+ group to exist.
253
+ - The group listed by this key SHOULD NOT be listed in ``dependency-groups `` as
254
+ the group is not meant to be directly exposed to users by name but instead via
255
+ an installer's UI.
256
+ - This group can only be specified when ``dependency-groups `` has values.
257
+
258
+
243
259
``created-by ``
244
260
==============
245
261
@@ -455,7 +471,12 @@ consistent order. Usage of inline tables SHOULD also be kept consistent.
455
471
- **Type **: boolean
456
472
- **Required? **: no; defaults to ``false ``
457
473
- **Inspiration **: :ref: `packaging:direct-url-data-structure-local-directory `
458
- - A flag representing whether the source tree should be installed as editable.
474
+ - A flag representing whether the source tree was an editable install at lock
475
+ time.
476
+ - Installer MAY choose to ignore this flag if user actions or context would make
477
+ an editable install unnecessary or undesirable (e.g. a container image that
478
+ will not be mounted for development purposes but instead deployed to
479
+ production where it would be treated at read-only).
459
480
460
481
461
482
``packages.directory.subdirectory ``
@@ -567,7 +588,8 @@ See ``packages.vcs.subdirectory``.
567
588
'''''''''''''''''''''''
568
589
569
590
- **Type **: string
570
- - **Required? **: yes
591
+ - **Required? **: no, not when the last component of ``path ``/ ``url `` would be
592
+ the same value
571
593
- **Inspiration **: PDM _, Poetry _, uv _
572
594
- The file name of the :ref: `packaging:source-distribution-format-sdist ` file.
573
595
@@ -620,7 +642,8 @@ See ``packages.archive.hashes``.
620
642
''''''''''''''''''''''''
621
643
622
644
- **Type **: string
623
- - **Required? **: yes
645
+ - **Required? **: no, not when the last component of ``path ``/ ``url `` would be
646
+ the same value
624
647
- **Inspiration **: PDM _, Poetry _, uv _
625
648
- The file name of the :ref: `packaging:binary-distribution-format ` file.
626
649
@@ -715,22 +738,69 @@ contexts where marker syntax is used (e.g. ``METADATA``, ``pyproject.toml``).
715
738
716
739
First, two new markers will be introduced: ``extras `` and
717
740
``dependency_groups ``. They represent the extras and dependency groups that have
718
- been requested to be installed, respectively.
719
-
720
- Second, the marker specification will be changed to allow for containers and not
721
- just strings for values. ONLY the new markers introduced in this PEP MAY and
722
- MUST be used with a :py:class: `collections.abc.Container ` type for their
723
- value (which default to empty containers). An assumption of the type of
724
- container used MUST NOT be made (e.g. could be a set, list, or tuple).
741
+ been requested to be installed, respectively:
742
+
743
+ .. code-block :: diff
744
+
745
+ diff --git a/source/specifications/dependency-specifiers.rst b/source/specifications/dependency-specifiers.rst
746
+ index 06897da2..c9ab247f 100644
747
+ --- a/source/specifications/dependency-specifiers.rst
748
+ +++ b/source/specifications/dependency-specifiers.rst
749
+ @@ -87,7 +87,7 @@ environments::
750
+ 'platform_system' | 'platform_version' |
751
+ 'platform_machine' | 'platform_python_implementation' |
752
+ 'implementation_name' | 'implementation_version' |
753
+ - 'extra' # ONLY when defined by a containing layer
754
+ + 'extra' | 'extras' | 'dependency_groups' # ONLY when defined by a containing layer
755
+ )
756
+ marker_var = wsp* (env_var | python_str)
757
+ marker_expr = marker_var marker_op marker_var
758
+
759
+ This does NOT preclude using the same syntax parser in other contexts, only
760
+ where the new markers happen to be considered valid based on context.
761
+
762
+ Second, the marker specification will be changed to allow sets for values (on
763
+ top of the current support for strings and versions). ONLY the new markers
764
+ introduced in this PEP will allow for a set for their value (which defaults to
765
+ an empty set). This specifically does NOT update the spec to allow for set
766
+ literals.
767
+
768
+ Third, the marker expression syntax specification will be updated to allow for
769
+ operations involving sets:
770
+
771
+ .. code-block :: diff
772
+
773
+ diff --git a/source/specifications/dependency-specifiers.rst b/source/specifications/dependency-specifiers.rst
774
+ index 06897da2..ac29d796 100644
775
+ --- a/source/specifications/dependency-specifiers.rst
776
+ +++ b/source/specifications/dependency-specifiers.rst
777
+ @@ -196,15 +196,16 @@ safely evaluate it without running arbitrary code that could become a security
778
+ vulnerability. Markers were first standardised in :pep:`345`. This document
779
+ fixes some issues that were observed in the design described in :pep:`426`.
780
+
781
+ -Comparisons in marker expressions are typed by the comparison operator. The
782
+ -<marker_op> operators that are not in <version_cmp> perform the same as they
783
+ -do for strings in Python. The <version_cmp> operators use the version comparison
784
+ -rules of the :ref:`Version specifier specification <version-specifiers>`
785
+ -when those are defined (that is when both sides have a valid
786
+ -version specifier). If there is no defined behaviour of this specification
787
+ -and the operator exists in Python, then the operator falls back to
788
+ -the Python behaviour. Otherwise an error should be raised. e.g. the following
789
+ -will result in errors::
790
+ +Comparisons in marker expressions are typed by the comparison operator and the
791
+ +type of the marker value. The <marker_op> operators that are not in
792
+ +<version_cmp> perform the same as they do for strings or sets in Python based on
793
+ +whether the marker value is a string or set itself. The <version_cmp> operators
794
+ +use the version comparison rules of the
795
+ +:ref:`Version specifier specification <version-specifiers>` when those are
796
+ +defined (that is when both sides have a valid version specifier). If there is no
797
+ +defined behaviour of this specification and the operator exists in Python, then
798
+ +the operator falls back to the Python behaviour for the types involved.
799
+ +Otherwise an error should be raised. e.g. the following will result in errors::
800
+
801
+ "dog" ~= "fred"
802
+ python_version ~= "surprise"
725
803
726
- Third, the "<marker_op> operators that are not in <version_cmp>" will be changed
727
- from operating "the same as they do for *strings *" to "the same as they
728
- do for *containers *". There are no backwards-compatibility concerns as strings
729
- are containers themselves.
730
-
731
- Fourth, a tool MUST raise an error if an extra or dependency group is specified
732
- in a marker expression that does not exist in ``extras `` or
733
- ``dependency-groups ``, respectively.
734
804
735
805
These changes, along with ``packages.extras ``/ ``packages.dependency-groups ``
736
806
and marker expressions' Boolean logic support, allow for expressing arbitrary,
@@ -806,10 +876,6 @@ Example
806
876
run-on = 2025-03-06T12:28:57.760769
807
877
808
878
809
-
810
-
811
-
812
-
813
879
------------
814
880
Installation
815
881
------------
@@ -923,6 +989,17 @@ file. Recording the sdist file name is for the same reason.
923
989
924
990
This PEP supports multi-use lock files while requirements files are single-use.
925
991
992
+ This PEP does NOT fully replace requirements files because:
993
+
994
+ - They support specifying installation
995
+ `options <https://pip.pypa.io/en/stable/reference/requirements-file-format/#supported-options >`__
996
+ at install-time (e.g. ``--index-url ``, ``--constrants ``).
997
+ - They can
998
+ `reference other requirements files <https://pip.pypa.io/en/stable/reference/requirements-file-format/#referring-to-other-requirements-files >`__
999
+ via ``-r ``.
1000
+ - They can
1001
+ `use environment variables <https://pip.pypa.io/en/stable/reference/requirements-file-format/#using-environment-variables >`__ .
1002
+
926
1003
927
1004
=======================
928
1005
Backwards Compatibility
@@ -997,6 +1074,13 @@ lock files at least support single-use lock files. Neither type of lock file
997
1074
is better or worse than the other, it just changes how much can be written down
998
1075
in a single file (which can influence how manageable).
999
1076
1077
+ Lock files that follow this PEP can be installed by any installer that
1078
+ implements the specification. This allows users of a lock file to not not be
1079
+ tied to the locker used by the person who produced the lock file. But it is not
1080
+ the case that using a different locker will lead to the same result. This could
1081
+ be for various reasons, including using different algorithms to determine what
1082
+ to lock.
1083
+
1000
1084
1001
1085
========================
1002
1086
Reference Implementation
0 commit comments