-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
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
base: main
Are you sure you want to change the base?
Conversation
.. program::
directive for documenting venv
CLI.. program::
directive for documenting venv
CLI
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.
@vsajip these are the changes ( with screenshot attached ) Before: ![]() After: ![]() |
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 |
@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! |
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. |
Yeah, we did not want to close it until we update the targeted docs, I'll update it, thanks @vsajip |
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.
|
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. |
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.
I thought I'd made that clear, but to reiterate:
I hope that all makes sense! |
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.
@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) |
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>
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 missed some stuff before. Please address them.
.. versionchanged:: 3.5 | ||
The use of ``venv`` is now recommended for creating virtual environments. | ||
|
||
.. deprecated-removed:: 3.6 3.8 | ||
:program:`pyvenv` was the recommended tool for creating virtual environments | ||
for Python 3.3 and 3.4, and replaced in 3.5 by executing ``venv`` directly. |
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.
Why was this removed?
.. code-block:: ps1con | ||
|
||
PS> python -m venv C:\path\to\new\virtual\environment |
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.
Why was this removed?
A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated. Once you have made the requested changes, please leave a comment on this pull request containing the phrase |
Issue: #130160
.. program::
and.. option::
directives for modules with a documented CLI #130160📚 Documentation preview 📚: https://cpython-previews--130699.org.readthedocs.build/