FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Clarify nested inline metadata blocks by jw9829 · Pull Request #2138 · pypa/packaging.python.org · GitHub

Repository navigation

Clarify nested inline metadata blocks - #2138

Open
jw9829 wants to merge 1 commit into
pypa:mainfrom
jw9829:clarify-pep-723-nested-blocks
Open

jw9829 wants to merge 1 commit into
pypa:mainfrom
jw9829:clarify-pep-723-nested-blocks

Conversation

jw9829 commented Sep 27, 2026 •
edited by github-actions Bot
Loading

Copy link
Copy Markdown
Contributor

The reference regex treats a second starting line before the closing line as content of the existing block.

Fixes #1960.


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

rgommers left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Thanks for working on this @jw9829. I checked the history in gh-1960: the greedy behavior was deliberate, and the closing-marker precedence paragraph and C# example were added specifically to explain it. So a clarification to the text is correct in principle.

The proposed sentence is accurate, but doesn't quite address the surprising part of gh-1960. Its examples already have a closing marker before the second opener. What's unclear is why that apparent closing marker becomes content.

Here is a suggested revision. This also changes # /// text to # /// text. so the example doesn’t conflict with the prohibition on nested openers.

@@
-    # /// text
+    # /// text.
@@
 A starting line MUST NOT be placed between another starting line and its ending
-line. The reference regular expression treats a second starting line as content
-of the existing block, not as a new block. Tools MAY produce an error in this
-case. Unclosed blocks MUST be ignored.
+line. In such cases tools MAY produce an error. Unclosed blocks MUST be ignored.
@@
 In circumstances where there is a discrepancy between the text specification
 and the regular expression, the text specification takes precedence.

+The regular expression intentionally matches greedily, using the last possible
+ending line within an uninterrupted sequence of valid embedded content lines.
+This permits a standalone ``///`` within embedded content, as in the C# example
+above; non-greedy matching would truncate that example. Consequently, apparent
+blocks separated only by valid embedded content lines, including ``#``, are
+matched as one block, with intervening delimiters included as content. An actual
+blank line separates blocks; multiple separate blocks of the same type remain
+an error.
+

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Note greediness of PEP 723 reference parser

3 participants


Back | FazBrowse Home | New Git URL