Skip to content

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

Description

@picnixz

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

Activity

  1. tomasr8 commented on Feb 15, 2025

    @tomasr8
    Member

    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.

  2. picnixz commented on Feb 15, 2025

    @picnixz
    MemberAuthor

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

  3. added a commit that references this issue on Feb 18, 2025
  4. added a commit that references this issue on Feb 18, 2025
  5. added a commit that references this issue on Feb 18, 2025
  6. Mr-Sunglasses commented on Feb 18, 2025

    @Mr-Sunglasses
    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.

  7. added 2 commits that reference this issue on Feb 18, 2025
  8. added a commit that references this issue on Feb 18, 2025
  9. 60 remaining items

  10. added 2 commits that reference this issue on Jul 11, 2025
  11. added 2 commits that reference this issue on Jul 12, 2025
  12. added a commit that references this issue on Jul 13, 2025
  13. added a commit that references this issue on Aug 4, 2025
  14. added a commit that references this issue on Aug 19, 2025
  15. added a commit that references this issue on Sep 9, 2025
  16. added a commit that references this issue on Nov 17, 2025
  17. added a commit that references this issue on Nov 17, 2025
  18. added a commit that references this issue on Nov 17, 2025
  19. added a commit that references this issue on Nov 17, 2025
  20. added a commit that references this issue on Nov 17, 2025
  21. added a commit that references this issue on Dec 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dir

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions