Skip to content

Commit 09af8a0

Browse files
committed
Clarify that yoda specifiers are not allowed
1 parent a9b1f5e commit 09af8a0

1 file changed

Lines changed: 8 additions & 5 deletions

File tree

‎source/specifications/dependency-specifiers.rst‎

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,8 @@ environments::
9393
'implementation_name' | 'implementation_version' |
9494
'extra' | 'extras' | 'dependency_groups' # ONLY when defined by a containing layer
9595
)
96-
marker_var = wsp* (env_var | python_str)
97-
marker_expr = marker_var marker_op marker_var
98-
| wsp* '(' marker wsp* ')'
96+
marker_expr = env_var wsp* marker_op wsp* python_str
97+
| '(' marker ')'
9998
marker_and = marker_expr wsp* 'and' marker_expr
10099
| marker_expr
101100
marker_or = marker_and wsp* 'or' marker_and
@@ -523,8 +522,7 @@ The complete parsley grammar::
523522
'implementation_name' | 'implementation_version' |
524523
'extra' | 'extras' | 'dependency_groups' # ONLY when defined by a containing layer
525524
):varname -> lookup(varname)
526-
marker_var = wsp* (env_var | python_str)
527-
marker_expr = marker_var:l marker_op:o marker_var:r -> (o, l, r)
525+
marker_expr = wsp* env_var:l wsp* marker_op:o wsp* python_str:r -> (o, l, r)
528526
| wsp* '(' marker:m wsp* ')' -> m
529527
marker_and = marker_expr:l wsp* 'and' marker_expr:r -> ('and', l, r)
530528
| marker_expr:m -> m
@@ -630,6 +628,9 @@ A test program - if the grammar is in a string ``grammar``:
630628
"name@http://foo.com",
631629
"name [fred,bar] @ http://foo.com ; python_version=='2.7'",
632630
"name[quux, strange];python_version<'2.7' and platform_version=='2'",
631+
"name; python_version > '3.10'",
632+
# Yoda specifiers are rejected
633+
# "name; '3.10' < python_version",
633634
"name; os_name=='a' or os_name=='b'",
634635
# Should parse as (a and b) or c
635636
"name; os_name=='a' and os_name=='b' or os_name=='c'",
@@ -707,6 +708,8 @@ History
707708
work. [#marker_comparison_logic]_
708709
- January 2026: fix outdated references to other documents that were
709710
inadvertently retained from :pep:`508`
711+
- May 2026: Clarify that Yoda specifiers like ``'3.10' < python_version`` are not
712+
allowed.
710713

711714

712715
References

0 commit comments

Comments
 (0)