-
Notifications
You must be signed in to change notification settings - Fork 1.5k
fix(markers): Fix/change dependency specifiers #1971
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
henryiii
wants to merge
4
commits into
pypa:main
Choose a base branch
from
henryiii:henryiii/fix/depspecversion
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -196,20 +196,31 @@ safely evaluate it without running arbitrary code that could become a security | |
| vulnerability. Markers were first standardised in :pep:`345`. This document | ||
| fixes some issues that were observed in the design described in :pep:`426`. | ||
|
|
||
| Comparisons in marker expressions are typed by the comparison operator and the | ||
| type of the marker value. The <marker_op> operators that are not in | ||
| <version_cmp> perform the same as they do for strings or sets in Python based on | ||
| whether the marker value is a string or set itself. The <version_cmp> operators | ||
| use the version comparison rules of the | ||
| :ref:`Version specifier specification <version-specifiers>` when those are | ||
| defined (that is when both sides have a valid version specifier). If there is no | ||
| defined behaviour of this specification and the operator exists in Python, then | ||
| the operator falls back to the Python behaviour for the types involved. | ||
| Otherwise an error should be raised. e.g. the following will result in errors:: | ||
| Comparisons in marker expressions are based on the types in the table below. | ||
| The variables marked with ``Version`` or ``Version | String`` use the version | ||
| comparison rules of the :ref:`Version specifier specification | ||
| <version-specifiers>` when those are defined (that is when both sides have a | ||
| valid version specifier). If either side is not expressible as a ``Version``, | ||
| then ``>=`` and``<=``, are equivalent to ``==``; no ordering is | ||
| assumed. The ``<`` and ``>`` operators always return false on strings. The | ||
| ``===`` legacy arbitrary equivalence operator does an exact, case insensitive | ||
| comparison regardless of if a string fallback is used. On other operators, | ||
| operators perform the same as they do for strings or sets in Python based on | ||
| whether the marker value is a string or set itself. Otherwise an error should | ||
| be raised; it should be noted that ``~=`` does not support string fallback. | ||
| e.g. the following will result in errors:: | ||
|
|
||
| "dog" ~= "fred" | ||
| python_version ~= "surprise" | ||
|
|
||
| Variables that are marked solely as ``String`` support ``==`` and ``!=``; | ||
| ordered comparison operators may also follow same rules as ``Version`` defined | ||
| above when one side is not a valid Version, with ``>=`` and ``<=`` being | ||
| equivalent to ``==``, and ``<`` and ``>`` always evaluating to ``False``. This | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. They should be equivalent to |
||
| is legacy behavior due to an older version of this spec, and tools may choose | ||
| to warn or fail if ordered comparisons are used on ``String`` markers. ``~=`` | ||
| and ``====`` (legacy arbitrary equivalence) are not supported on string fields. | ||
|
|
||
| User supplied constants are always encoded as strings with either ``'`` or | ||
| ``"`` quote marks. Note that backslash escapes are not defined, but existing | ||
| implementations do support them. They are not included in this | ||
|
|
@@ -267,7 +278,7 @@ an error like all other unknown variables. | |
| - ``CPython``, ``Jython`` | ||
| * - ``platform_release`` | ||
| - :py:func:`platform.release()` | ||
| - String | ||
| - Version | String | ||
| - ``3.14.1-x86_64-linode39``, ``14.5.0``, ``1.8.0_51`` | ||
| * - ``platform_system`` | ||
| - :py:func:`platform.system()` | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They should also support
===