Skip to content

Conversation

@henryiii
Copy link
Contributor

@henryiii henryiii commented Nov 17, 2025

  • Change is either:
    • To a Draft PEP
    • To an Accepted or Final PEP, with Steering Council approval
    • To fix an editorial issue (markup, typo, link, header, etc)
  • PR title prefixed with PEP number (e.g. PEP 123: Summary of changes)

This adds a backward compat example for static tooling based on @sirosen's comment in https://discuss.python.org/t/104883. This shows an example of how to read this in Python, along with a note about how it could have been done before in a way that would be incorrect now (only in that you wouldn't know the metadata you were computing was incomplete).

Tested which the following quickly thrown together snippet:

class my:
    key = "dependencies"


def f(pyproject):
    match pyproject["project"]:
       # New in PEP 808
       case {my.key: value, "dynamic": dyn} if my.key in dyn:
           print(f"Partial {my.key}: {value}")
       case {"dynamic": dyn} if my.key in dyn:
           print(f"Fully dynamic {my.key}")
       case {my.key: value}:
           print(f"Fully static {my.key}: {value}")
       case _:
           print(f"No metadata for {my.key}")


f({"project": {"dynamic": ["dependencies"], "dependencies": ["numpy"]}})
f({"project": {"dynamic": ["dependencies"]}})
f({"project": {"dependencies": ["numpy"]}})
f({"project": {}})

(Marked as draft until @sirosen (and maybe @pfmoore) can verify this addresses their comments)


📚 Documentation preview 📚: https://pep-previews--4710.org.readthedocs.build/

Signed-off-by: Henry Schreiner <henryfs@princeton.edu>
@henryiii henryiii requested a review from FFY00 as a code owner November 17, 2025 17:10
@henryiii henryiii marked this pull request as draft November 17, 2025 17:15
@henryiii henryiii marked this pull request as ready for review November 17, 2025 18:52
@hugovk hugovk merged commit 93f3c30 into python:main Nov 17, 2025
6 checks passed
@henryiii henryiii deleted the henryiii/pep808/backwardscompat branch November 17, 2025 22:52
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.

4 participants