Skip to content
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

Use .. program:: and .. option:: directives for modules with a documented CLI #130160

Open
5 of 6 tasks
picnixz opened this issue Feb 15, 2025 · 10 comments · Fixed by #130253 or #130278
Open
5 of 6 tasks

Use .. program:: and .. option:: directives for modules with a documented CLI #130160

picnixz opened this issue Feb 15, 2025 · 10 comments · Fixed by #130253 or #130278
Labels
docs Documentation in the Doc dir

Comments

@picnixz
Copy link
Member

picnixz commented Feb 15, 2025

This is something (#129607 (comment)) I thought of when reviewing #129607. It's usually fine not to have links, but once we begin adding new command-line options to specific modules (e.g., http.server), I think it'd be nice to be able to reference them using Sphinx.

Using the .. program:: directive also improves readability. For instance, compare https://docs.python.org/3/library/dis.html#command-line-interface with https://docs.python.org/3/library/http.server.html where the CLI documentation is at the end of the page, without even a dedicated section.

I suggest going through the modules in #109435 and select those whose documentation page can be improved. By looking at the list, I found the following that can be improved:

quopri is both missing a documentation for its CLI so we can also add it. base64 as well, but I think it's meant to be undocumented. More modules can be found in #93096 as well.

For now, I suggest focusing on only those who already have a documented command-line interface and just improving them. Whether a module should have its main() function documented or not is out-of-scope for this issue.

Important

For those who want to work on the issue, please:

Linked PRs

@picnixz picnixz added the docs Documentation in the Doc dir label Feb 15, 2025
@picnixz picnixz added the easy label Feb 15, 2025
@tomasr8
Copy link
Member

tomasr8 commented Feb 15, 2025

Tangentially related, but the dis module uses the cmdoption directive (as opposed to option) to document its CLI. We might want to switch to option for consistency.

@picnixz
Copy link
Member Author

picnixz commented Feb 15, 2025

Yes, and cmdoption is actually deprecated so it's better to use option :)

@Mr-Sunglasses
Copy link
Contributor

@pfmoore , @sobolevn

There are more files related that need to be changed that are mentioned in this issue, so it's good that we should reopen this until all those changes are encountered.

@sobolevn sobolevn reopened this Feb 18, 2025
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Feb 18, 2025
…pip` CLI (pythongh-130253)

(cherry picked from commit 8cd7f8b)

Co-authored-by: Kanishk Pachauri <itskanishkp.py@gmail.com>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Feb 18, 2025
…pip` CLI (pythongh-130253)

(cherry picked from commit 8cd7f8b)

Co-authored-by: Kanishk Pachauri <itskanishkp.py@gmail.com>
pfmoore pushed a commit that referenced this issue Feb 18, 2025
…epip` CLI (gh-130253) (gh-130259)

gh-130160: use `.. program::` directive for documenting `ensurepip` CLI (gh-130253)
(cherry picked from commit 8cd7f8b)

Co-authored-by: Kanishk Pachauri <itskanishkp.py@gmail.com>
pfmoore pushed a commit that referenced this issue Feb 18, 2025
…epip` CLI (gh-130253) (gh-130258)

gh-130160: use `.. program::` directive for documenting `ensurepip` CLI (gh-130253)
(cherry picked from commit 8cd7f8b)

Co-authored-by: Kanishk Pachauri <itskanishkp.py@gmail.com>
sobolevn added a commit to sobolevn/cpython that referenced this issue Feb 18, 2025
…st` (pythonGH-130255)

(cherry picked from commit 97d0011)

Co-authored-by: sobolevn <mail@sobolevn.me>
sobolevn added a commit to sobolevn/cpython that referenced this issue Feb 18, 2025
sobolevn added a commit that referenced this issue Feb 18, 2025
Mr-Sunglasses added a commit to Mr-Sunglasses/cpython that referenced this issue Feb 18, 2025
gaogaotiantian pushed a commit that referenced this issue Mar 9, 2025
…CLI (GH-130996) (#131014)

gh-130160: use `.. program::` directive for documenting `pdb` CLI (GH-130996)
(cherry picked from commit c240c2d)

Co-authored-by: donBarbos <donbarbos@proton.me>
gaogaotiantian pushed a commit that referenced this issue Mar 9, 2025
…CLI (GH-130996) (#131013)

gh-130160: use `.. program::` directive for documenting `pdb` CLI (GH-130996)
(cherry picked from commit c240c2d)

Co-authored-by: donBarbos <donbarbos@proton.me>
@picnixz
Copy link
Member Author

picnixz commented Mar 9, 2025

Except for venv where we may not want to do this, and for http.server which is the reason why I initially created this issue, I don't think we need to do more.

Exposing more CLIs likely requires a separate feature request for each module and deciding the fate of each existing CLI option such as those for self-testing should be tracked separately as well. So, once we're done with http.server and once we are done with venv as well, we will close this issue.

As such I'll remove the easy label as there is no "new" task apart from the ongoing ones.

@picnixz picnixz removed the easy label Mar 9, 2025
@donBarbos
Copy link
Contributor

donBarbos commented Mar 10, 2025

@picnixz

Exposing more CLIs likely requires a separate feature request for each module and deciding the fate of each existing CLI option such as those for self-testing should be tracked separately as well. So, once we're done with http.server and once we are done with venv as well, we will close this issue.

everything is fine but I thought that doctest doesn't have a description of the CLI as a separate section at all.
it seems to be documented in detail but the information about the flags is scattered across different parts of the page.

maybe we could accept these changes :-)

@sobolevn
Copy link
Member

@donBarbos yes, sounds nice! Thanks!

@donBarbos
Copy link
Contributor

donBarbos commented Mar 10, 2025

if we decide to update some cli docs why not link to their anchors in https://docs.python.org/dev/library/cmdline.html (instead of * :mod:`doctest` use * :ref:`doctest <doctest-cli>` )

@picnixz
Copy link
Member Author

picnixz commented Mar 10, 2025

We can do it once we're done with the modules. And yes documenting doctest like that is a good idea.

miss-islington pushed a commit to miss-islington/cpython that referenced this issue Mar 15, 2025
…erver` CLI (pythonGH-131010)

(cherry picked from commit 7ae9c5d)

Co-authored-by: donBarbos <donbarbos@proton.me>
donBarbos added a commit to donBarbos/cpython that referenced this issue Mar 15, 2025
hugovk pushed a commit that referenced this issue Mar 15, 2025
…server` CLI (GH-131010) (#131293)

gh-130160: use `.. program::` directive for documenting `http.server` CLI (GH-131010)
(cherry picked from commit 7ae9c5d)

Co-authored-by: donBarbos <donbarbos@proton.me>
picnixz added a commit that referenced this issue Mar 16, 2025
…#131034)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Mar 16, 2025
…t` CLI (pythonGH-131034)

(cherry picked from commit 9558d22)

Co-authored-by: donBarbos <donbarbos@proton.me>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Mar 16, 2025
…t` CLI (pythonGH-131034)

(cherry picked from commit 9558d22)

Co-authored-by: donBarbos <donbarbos@proton.me>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
picnixz added a commit that referenced this issue Mar 16, 2025
…st` CLI (GH-131034) (#131320)

gh-130160: use `.. program::` directive for documenting `doctest` CLI (GH-131034)
(cherry picked from commit 9558d22)

Co-authored-by: donBarbos <donbarbos@proton.me>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
picnixz added a commit that referenced this issue Mar 16, 2025
…st` CLI (GH-131034) (#131321)

gh-130160: use `.. program::` directive for documenting `doctest` CLI (GH-131034)
(cherry picked from commit 9558d22)

Co-authored-by: donBarbos <donbarbos@proton.me>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
mikec9 pushed a commit to mikec9/cpython that referenced this issue Mar 17, 2025
…`http.server` CLI (pythonGH-131010) (python#131293)

pythongh-130160: use `.. program::` directive for documenting `http.server` CLI (pythonGH-131010)
(cherry picked from commit 7ae9c5d)

Co-authored-by: donBarbos <donbarbos@proton.me>
mikec9 pushed a commit to mikec9/cpython that referenced this issue Mar 17, 2025
…`doctest` CLI (pythonGH-131034) (python#131320)

pythongh-130160: use `.. program::` directive for documenting `doctest` CLI (pythonGH-131034)
(cherry picked from commit 9558d22)

Co-authored-by: donBarbos <donbarbos@proton.me>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
hugovk added a commit that referenced this issue Mar 17, 2025
…server` CLI (GH-131010) (#131294)

Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
plashchynski pushed a commit to plashchynski/cpython that referenced this issue Mar 17, 2025
plashchynski pushed a commit to plashchynski/cpython that referenced this issue Mar 17, 2025
…t` CLI (python#131034)

Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir
Projects
Status: Todo
7 participants
@sobolevn @tomasr8 @picnixz @terryjreedy @donBarbos @Mr-Sunglasses and others