Skip to content

Clarify handling of script metadata#2089

Merged
ewdurbin merged 2 commits into
pypa:mainfrom
pfmoore:script_metadata
Jul 22, 2026
Merged

Clarify handling of script metadata#2089
ewdurbin merged 2 commits into
pypa:mainfrom
pfmoore:script_metadata

Conversation

@pfmoore

@pfmoore pfmoore commented Jul 12, 2026

Copy link
Copy Markdown
Member

The specification states that only top-level comments define script metadata. But recognising precisely top-level comments is difficult, and requires a full Python parse, which (for example) the canonical regex does not do.

Clarify that tools MAY use a simple textual scan, like the regex does, but that users must not rely on comments within other Python constructs being ignored.

See https://discuss.python.org/t/clarify-that-pep-723-inline-script-metadata-recognition-is-textual/108089 for a discussion of this issue.


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

@pfmoore

pfmoore commented Jul 12, 2026

Copy link
Copy Markdown
Member Author

The linkcheck failure appears to only be for files I haven't changed...

@zsol zsol left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Thanks for doing this!

Comment thread source/specifications/inline-script-metadata.rst Outdated
@henryiii

Copy link
Copy Markdown
Contributor

The link check fix in #2084.

@pfmoore

pfmoore commented Jul 22, 2026

Copy link
Copy Markdown
Member Author

I'm not sure how to get the attention of "someone with write access" - @pypa/packaging-user-guide-editors is this the right group?

@ewdurbin
ewdurbin added this pull request to the merge queue Jul 22, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Jul 22, 2026
@ewdurbin
ewdurbin added this pull request to the merge queue Jul 22, 2026
Merged via the queue into pypa:main with commit 8eb9cb2 Jul 22, 2026
6 of 7 checks passed
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.

5 participants