Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 33.9k
gh-130160: use .. program:: directive for documenting venv CLI#130699
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Conversation
Mr-Sunglasses commented Feb 28, 2025 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
.. program:: directive for documenting venv CLI.. program:: directive for documenting venv CLI
vsajip left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't see what the .. program:: directive does in the documentation preview. It would be good to see screenshot(s) to show rendering of this section before/after your changes.
Mr-Sunglasses commented Feb 28, 2025 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
@vsajip these are the changes ( with screenshot attached ) Before: ![]() After: ![]() |
vsajip commented Feb 28, 2025
So we've duplicated the options information in the bit below "The command, if run with -h, will show the available options:" , in a slightly different formatting? What has that really achieved? And what did the |
Mr-Sunglasses commented Feb 28, 2025 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
@vsajip You're absolutely right that the options information is now duplicated in two slightly different formats:
Now for the second question
The That said, I totally get your point about duplication. If you feel the duplication is unnecessary, we could remove the raw About the It tells Sphinx that the following options ( ref. https://www.sphinx-doc.org/en/master/usage/domains/standard.html#directive-program
My motivation for making this change comes from a few observations in the issue #130160 :
That said, I completely understand your perspective. If the previous presentation wasn’t broken, why fix it? My goal wasn’t to tinker for the sake of tinkering but to subtly improve the docs in a way that aligns with broader Python documentation practices. If you’re not convinced that these changes add enough value, I’m happy to roll them back or refine them further. Please Let me know what you think! |
vsajip commented Feb 28, 2025
Well, that's not good, in my view. I have no particular opinion on the
Well, I didn't see any in But the duplication has to go, IMO. Note that if you remove the I see #130160 is trying to do this across various modules in the stdlib, so fair enough, I suppose ... my main concern is the extra work for maintainers (for this module, that's often me!) when the CLI changes. |
vsajip commented Feb 28, 2025 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
Mr-Sunglasses commented Mar 3, 2025 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
Yeah, we did not want to close it until we update the targeted docs, I'll update it, thanks @vsajip |
Mr-Sunglasses commented Mar 3, 2025 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
Thanks for your suggesstions, @vsajip .
Just my two cents, it will need a little bit of extra work while adding new features but it will make the docs overall better. tagging @picnixz for his views, as he is helping me a lot in this issue and he originally created the issue. TiA.
|
picnixz commented Mar 3, 2025 • edited
Loading Uh oh!
There was an error while loading. Please reload this page.
edited
Uh oh!
There was an error while loading. Please reload this page.
There are benefits for having the
If you however think that it's not worth the change, we can skip that one. I can understand that it's easier to C/C if you already have an ArgumentParser outputting you the options. But for some modules, the option description may use backreferences. |
Mr-Sunglasses left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tagging @vsajip for their opinion on this discussion and their opinion on this PR.
vsajip commented Mar 10, 2025
I thought I'd made that clear, but to reiterate:
I hope that all makes sense! |
Uh oh!
There was an error while loading. Please reload this page.
| The command, if run with ``-h``, will show the available options:: | ||
| usage: venv [-h] [--system-site-packages] [--symlinks | --copies] [--clear] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Mr-Sunglasses I understood that the problem is that there is duplicate information about venv cli (you didn't replace it, you just added a new one, check these lines and below)
could you remove it leaving only the use of .. option:: directives?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you remove it leaving only the use of .. option:: directives?
There should IMO be something that shows how to invoke it, e.g. python -m venv [options] [VENV_DIR ...] appropriately marked up to be as prominent/compatibly styled to the option directive rendering.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are absolutely right. I forgot about it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case, I suggest shortening the help. Currently it's as follows:
Instead I suggest we only keep
usage: venv [-h] [--system-site-packages] [--symlinks | --copies] [--clear] [--upgrade] [--without-pip] [--prompt PROMPT] [--upgrade-deps] [--without-scm-ignore-files] ENV_DIR [ENV_DIR ...] Creates virtual Python environments in one or more target directories. ... Once an environment has been created, you may wish to activate it, e.g. by sourcing an activate script in its bin directory. There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and maybe it would be better to remove following text from code block:
Creates virtual Python environments in one or more target directories. ... Once an environment has been created, you may wish to activate it, e.g. by sourcing an activate script in its bin directory. Uh oh!
There was an error while loading. Please reload this page.
picnixz commented Apr 4, 2025
@Mr-Sunglasses This is the last PR to remain before closing the parent issue. May you address the comments please? (or we can also skip the venv module or take over the PR if you don't want to work on this) |
Mr-Sunglasses commented Apr 5, 2025
Hey @picnixz , Sorry I forgot about this PR, I'll work on it and resolve the issues. |
Co-authored-by: Semyon Moroz <donbarbos@proton.me>
Co-authored-by: Semyon Moroz <donbarbos@proton.me>
Uh oh!
There was an error while loading. Please reload this page.
fb9f933 into python:mainUh oh!
There was an error while loading. Please reload this page.
donbarbos commented Jun 30, 2025
@vsajip issue suggests making backports for such changes, and other PRs also have backports |
…CLI (pythonGH-130699) Co-authored-by: Semyon Moroz <donbarbos@proton.me> Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Thanks @Mr-Sunglasses for the PR, and @vsajip for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14. |
Thanks @Mr-Sunglasses for the PR, and @vsajip for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13. |
…CLI (pythonGH-130699) (cherry picked from commit fb9f933) Co-authored-by: Kanishk Pachauri <itskanishkp.py@gmail.com> Co-authored-by: Semyon Moroz <donbarbos@proton.me> Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
…CLI (pythonGH-130699) (cherry picked from commit fb9f933) Co-authored-by: Kanishk Pachauri <itskanishkp.py@gmail.com> Co-authored-by: Semyon Moroz <donbarbos@proton.me> Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
GH-136550 is a backport of this pull request to the 3.14 branch. |
GH-136551 is a backport of this pull request to the 3.13 branch. |
… CLI (GH-130699) (#136550) gh-130160: use `.. program::` directive for documenting `venv` CLI (GH-130699) (cherry picked from commit fb9f933) Co-authored-by: Kanishk Pachauri <itskanishkp.py@gmail.com> Co-authored-by: Semyon Moroz <donbarbos@proton.me> Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
… CLI (GH-130699) (#136551) gh-130160: use `.. program::` directive for documenting `venv` CLI (GH-130699) (cherry picked from commit fb9f933) Co-authored-by: Kanishk Pachauri <itskanishkp.py@gmail.com> Co-authored-by: Semyon Moroz <donbarbos@proton.me> Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
…CLI (pythonGH-130699) Co-authored-by: Semyon Moroz <donbarbos@proton.me> Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
…CLI (pythonGH-130699) Co-authored-by: Semyon Moroz <donbarbos@proton.me> Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
…CLI (pythonGH-130699) Co-authored-by: Semyon Moroz <donbarbos@proton.me> Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
…CLI (pythonGH-130699) Co-authored-by: Semyon Moroz <donbarbos@proton.me> Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
…`venv` CLI (pythonGH-130699) (python#136550) pythongh-130160: use `.. program::` directive for documenting `venv` CLI (pythonGH-130699) (cherry picked from commit fb9f933) Co-authored-by: Kanishk Pachauri <itskanishkp.py@gmail.com> Co-authored-by: Semyon Moroz <donbarbos@proton.me> Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>





Issue: #130160
.. program::and.. option::directives for modules with a documented CLI #130160📚 Documentation preview 📚: https://cpython-previews--130699.org.readthedocs.build/