Skip to content

Document whitespace in quoted dependency specifiers - #2044

Open
Herrtian wants to merge 1 commit into
python:mainfrom
Herrtian:document-spaced-dependency-specifiers
Open

Herrtian wants to merge 1 commit into
python:mainfrom
Herrtian:document-spaced-dependency-specifiers

Conversation

@Herrtian

@Herrtian Herrtian commented May 10, 2026 •

Copy link
Copy Markdown
Contributor

Closes #1226.

Adds a short note that quoted dependency specifier strings may keep optional whitespace for readability.

Checks: uv run --with pre-commit pre-commit run --files source/specifications/dependency-specifiers.rst; uv run --with nox nox -s build


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

@Herrtian
Herrtian force-pushed the document-spaced-dependency-specifiers branch from 8d3a2c1 to 81c0f97 Compare May 12, 2026 14:05
@Herrtian
Herrtian force-pushed the document-spaced-dependency-specifiers branch from 81c0f97 to 0f444ba Compare May 13, 2026 12:46
@Herrtian

Copy link
Copy Markdown
Contributor Author

Added the requested blank lines.

When a dependency specifier is written as a quoted string, authors may keep
optional whitespace for readability, such as around version specifiers and
version clauses.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This restores a blank line between preceding paragraph and following ref target.

@merwok

merwok commented Sep 8, 2026

Copy link
Copy Markdown
Member

LGTM.

I thought about suggesting adding an example, but this is a spec page, not a tutorial, so other sections have grammar but no examples.

Are there other page (tutorial, reference) that could be edited to have whitespace? (say in files, not in commands like pip install project==version)

@rgommers 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.

Thanks @Herrtian and @merwok. This clarification looks like it matches the suggestions in gh-1226 and the grammar indeed already supports this. So this is close to merge-ready. I do have a rephrasing suggestion inline to make it a bit more precise.

Comment on lines +131 to +133
When a dependency specifier is written as a quoted string, authors may keep
optional whitespace for readability, such as around version specifiers and
version clauses.

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.

Two very minor issues here: (1) "a quoted string" isn't all that relevant here, and (2) "Around version specifiers and version clauses” is a little imprecise. So please consider adopting this rephrase:

Suggested change
When a dependency specifier is written as a quoted string, authors may keep
optional whitespace for readability, such as around version specifiers and
version clauses.
For readability, authors can retain the optional whitespace permitted by the
grammar, including around version comparison operators and between version
clauses.

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

Labels

component: specifications type: enhancement A self-contained enhancement or new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Document that sparse identifiers with whitespace are valid if quoted

3 participants