Skip to content

Conversation

@ncoghlan
Copy link
Member

@ncoghlan ncoghlan commented Jan 10, 2026

Preparation for the release of packaging 25.1 revealed multiple deficiencies in the specification of environment marker evaluation. Review of the proposed amendments to resolve those deficiencies highlighted multiple other problems, including some dating from the original PEP 508 specification:

  • other pages still referencing PEP 508 instead of the living spec
  • direct reference to PEP 685 instead of the core metadata spec
  • the "extra" special case not being properly defined
  • lacking guidance to tool developers regarding what should be considered errors to disallow entirely vs issues to work around

Inspired by the initial PR at #1971

discuss.python.org thread: https://discuss.python.org/t/spec-change-bugfix-dependency-specifiers-simplification-pep-508


📚 Documentation preview 📚: https://python-packaging-user-guide--1988.org.readthedocs.build/en/1988/

ncoghlan and others added 2 commits January 10, 2026 16:33
Preparation for the release of packaging 25.1 revealed multiple
deficiencies in the specification of environment marker evaluation.
Review of the proposed amendments to resolve those deficiencies
highlighted multiple other problems, including some dating from the
original PEP 508 specification:

* other pages still referencing PEP 508 instead of the living spec
* direct reference to PEP 685 instead of the core metadata spec
* the "extra" special case not being properly defined
* lacking guidance to tool developers regarding what should be
  considered errors to disallow entirely vs issues to work around

Inspired by the initial PR at pypa#1971

For ``Set of String`` fields, as there is no marker syntax for set literals,
the only valid operations are ``in`` and ``not in`` comparisons with a user
supplied string literal as the left operand.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Publishing tools should emit an error for other operations, consuming tools may just treat the operations as false

defined as they are for ``String`` fields. However, there is no expectation
that the parsing of the marker field value or the user supplied constant as a
valid version will succeed, so tools MUST fall back to processing the field as
a ``String`` field. Alternatively, tools MAY unconditionally treat such fields
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The established use of platform_release as a version on macOS means that this field really does need to be checked as a version first.

Due to iOS and Android, platform_version potentially needs the same handling.

'''''''''''''''''''''

References to unknown marker fields MUST raise an error rather than resulting
in a comparison that evaluates to True or False.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Explain that this so unknown markers result in a clear installation failure rather than an installation with potentially missing dependencies that then fails at runtime. Soften it to a SHOULD.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant