Skip to content

gh-126031: Mark argparse parameter headings as code - #160632

Open
techi101 wants to merge 2 commits into
python:mainfrom
techi101:gh-126031-argparse-parameter-headings
Open

techi101 wants to merge 2 commits into
python:mainfrom
techi101:gh-126031-argparse-parameter-headings

Conversation

@techi101

@techi101 techi101 commented Oct 25, 2026 •

Copy link
Copy Markdown

Closes #126031.

Mark the 15 ArgumentParser constructor parameter headings and the 12 add_argument() parameter headings as inline code. Their extracted translation messages currently contain bare words such as description, usage, and action; literal markup identifies them as API parameter names, following the approach discussed in the issue. In the name or flags heading, only name and flags are formatted as code.

The section structure and existing links are preserved. This adds a translation cue; the messages remain available for translation.

Validation on Windows with Python 3.12 and Sphinx 8.2.3:

  • Full HTML build with warnings treated as errors: python -m sphinx -q -W --keep-going -b html -d build/doctrees-html . build/html (from Doc).
  • Gettext build: python -m sphinx -q -W --keep-going -b gettext -d build/doctrees-gettext . build/gettext library/argparse.rst (from Doc).
  • python -m sphinxlint --enable=default-role Doc/library/argparse.rst, git diff --check, and python -m pip check.
  • Compared the generated HTML and gettext catalog with unmodified main: all 27 parameter headings contain the intended literal markup, all HTML IDs and fragment links and the visible heading text/order are preserved, and exactly the 27 bare parameter heading messages are replaced by literal-marked messages. No unrelated gettext messages change.

AI assistance: OpenAI Codex prepared the documentation edits and performed the local builds and output verification.

@python-cla-bot

python-cla-bot Bot commented Oct 25, 2026 •

Copy link
Copy Markdown

All commit authors signed the Contributor License Agreement.

CLA signed

@StanFromIreland

Copy link
Copy Markdown
Member

Please also do the same for add_argument()'s parameters.

@techi101 techi101 changed the title gh-126031: Mark argparse constructor parameter headings as code gh-126031: Mark argparse parameter headings as code Oct 25, 2026
@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #35392032 | 📁 Comparing 9350a5f against main (7159b15)

  🔍 Preview build  

1 file changed
± whatsnew/changelog.html

@StanFromIreland StanFromIreland left a comment

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.

LGTM, I think this is a nice improvement, it will solve the mistaken-translation issue, and makes it clearer overall that these are parameters:

Image

Any thoughts @savannahostrowski ?

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

Labels

awaiting merge docs Documentation in the Doc dir skip news

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

argparse ArgumentParser kw args confusing translators

2 participants