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

gh-130160: use .. program:: directive for documenting cProfile CLI #130314

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

ApostolFet
Copy link
Contributor

@ApostolFet ApostolFet commented Feb 19, 2025

Use .. program:: and .. option:: directive for documenting cProfile CLI


📚 Documentation preview 📚: https://cpython-previews--130314.org.readthedocs.build/

Copy link
Member

@sobolevn sobolevn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks!
Снимок экрана 2025-02-19 в 21 52 10


.. option:: -m <module>

Specifies that a module is being profiled instead of a script.

.. versionadded:: 3.7
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, indent these values to be in -m section.

@@ -122,24 +122,31 @@ The :class:`pstats.Stats` class reads profile results from a file and formats
them in various ways.

.. _profile-cli:
.. program:: cProfile
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One more idea to test: we have :ref:profile <profile-cli> in Doc/library/cmdline.rst, we can remove this: .. _profile-cli:

and use just :program:profile <cProfile>

Do we also need to add .. program:: profile?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should keep the target, though yes the cross-ref could be updated.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are two references to these section and they are all in cmdline. For the experiment I tried replacing :ref:profile <profile-cli> with :program:profile <cProfile>. But the link is not active.

изображение
изображение

I also tried different variants with :program:cProfile and with :option:cProfile, but the link is active only if we specify an option like: :option:cProfile -o.

изображение

Co-authored-by: Bénédikt Tran <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting review docs Documentation in the Doc dir skip news
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

4 participants