8000 gh-100583: Improving the `pydoc` doc by ramvikrams · Pull Request #100590 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-100583: Improving the pydoc doc #100590

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

Merged
merged 5 commits into from
Dec 29, 2022
Merged

gh-100583: Improving the pydoc doc #100590

merged 5 commits into from
Dec 29, 2022

Conversation

ramvikrams
Copy link
Contributor

gh-100583: changed the doc for calling pydoc my making it platform agnostic

@Fidget-Spinner
Copy link
Member

Thanks. You need to change all occurences of this command. Also we usually dont write python you are using like that (sorry if I misled you). Just writing python -m pydoc is sufficient.

@ramvikrams
Copy link
Contributor Author

Thanks. You need to change all occurences of this command. Also we usually dont write python you are using like that (sorry if I misled you). Just writing python -m pydoc is sufficient.

Thanks I'll do it

@slateny
Copy link
Contributor
slateny commented Dec 29, 2022

I wonder if being so explicit would instead be a bit too noisy, especially with it being bolded. Here's the preview for reference.

Maybe the first instance of the command can be (for example) the full python -m pydoc sys, and then it's implicit for subsequent mentions in the page? If too subtle, then a small note noting that pydoc is just an alias for python -m pydoc could work too.

@ramvikrams
Copy link
Contributor Author

or I was thinking to mention once <python> -m pydoc when running in the start and for subsequent reference we could substitute it like pydoc_means=<python> -m pydoc. What do you think about it.

Comment on lines 38 to 44
at a shell prompt will display documentation on the :mod:`sys` module, in a
style similar to the manual pages shown by the Unix :program:`man` command. The
argument to :program:`pydoc` can be the name of a function, module, or package,
argument to :program:`<python> -m pydoc` can be the name of a function, module, or package,
or a dotted reference to a class, method, or function within a module or module
in a package. If the argument to :program:`pydoc` looks like a path (that is,
in a package. If the argument to :program:`<python> -m pydoc` looks like a path (that is,
it contains the path separator for your operating system, such as a slash in
Unix), and refers to an existing Python source file, then documentation is
Copy link
Member

Choose a reason for hiding this comment

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

I don't think these need changing. Please revert the changes.

Comment on lines 54 to 56
When printing output to the console, :program:`pydoc` attempts to paginate the
When printing output to the console, :program:`<python> -m pydoc` attempts to paginate the
output for easier reading. If the :envvar:`PAGER` environment variable is set,
:program:`pydoc` will use its value as a pagination program.
:program:`<python> -m pydoc` will use its value as a pagination program.
Copy link
Member

Choose a reason for hiding this comment

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

Please revert these changes too. These are not command examples.

Comment on lines 85 to 86
When :program:`<python> -m pydoc` generates documentation, it uses the current environment
and path to locate modules. Thus, invoking :program:`<python> -m pydoc spam`
Copy link
Member

Choose a reason for hiding this comment

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

These don't need changing. Please revert the changes.

Comment on lines 67 to 79
You can also use :program:`pydoc` to start an HTTP server on the local machine
that will serve documentation to visiting web browsers. :program:`pydoc -p 1234`
that will serve documentation to visiting web browsers. :program:`<python> -m pydoc -p 1234`
will start a HTTP server on port 1234, allowing you to browse the
documentation at ``http://localhost:1234/`` in your preferred web browser.
Specifying ``0`` as the port number will select an arbitrary unused port.

:program:`pydoc -n <hostname>` will start the server listening at the given
:program:`<python> -m pydoc -n <hostname>` will start the server listening at the given
hostname. By default the hostname is 'localhost' but if you want the server to
be reached from other machines, you may want to change the host name that the
server responds to. During development this is especially useful if you want
to run pydoc from within a container.

:program:`pydoc -b` will start the server and additionally open a web
:program:`<python> -m pydoc -b` will start the server and additionally open a web
Copy link
Member

Choose a reason for hiding this comment

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

I think we can keep these.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated the doc

Copy link
Member

Choose a reason for hiding this comment

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

Great! You can click "resolve conversation" after you feel that the review comment has been addressed.

@@ -65,18 +65,18 @@ manner similar to the Unix :program:`man` command. The synopsis line of a
module is the first line of its documentation string.

You can also use :program:`pydoc` to start an HTTP server on the local machine
that will serve documentation to visiting web browsers. :program:`pydoc -p 1234`
that will serve documentation to visiting web browsers. :program:`python -m pydoc -p 1234`
Copy link
Member

Choose a reason for hiding this comment

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

Please leave the leading space alone. reStructuredText allows for one or two spaces after a period.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes will do

Copy link
Member
@Fidget-Spinner Fidget-Spinner left a comment

Choose a reason for hiding this comment

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

This LGTM. Does anyone else have any feedback?

@ambv ambv added 3.11 only security fixes 3.12 only security fixes needs backport to 3.11 only security fixes labels Dec 29, 2022
@ambv
Copy link
Contributor
ambv commented Dec 29, 2022

We never used <python> -m ... in the docs before. We always just said python -m .... I think we should stick to that for consistency with the rest of the documentation.

@kumaraditya303 kumaraditya303 merged commit 7223d50 into python:main Dec 29, 2022
@miss-islington
Copy link
Contributor

Thanks @ramvikrams for the PR, and @kumaraditya303 for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Dec 29, 2022
(cherry picked from commit 7223d50)

Co-authored-by: ram vikram singh <ramvikrams243@gmail.com>
@bedevere-bot
Copy link

GH-100606 is a backport of this pull request to the 3.11 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.11 only security fixes label Dec 29, 2022
@kumaraditya303
Copy link
Contributor

Thanks!

miss-islington added a commit that referenced this pull request Dec 29, 2022
(cherry picked from commit 7223d50)

Co-authored-by: ram vikram singh <ramvikrams243@gmail.com>
@CAM-Gerlach CAM-Gerlach added the needs backport to 3.10 only security fixes label Dec 29, 2022
@miss-islington
Copy link
Contributor

Thanks @ramvikrams for the PR, and @kumaraditya303 for merging it 🌮🎉.. I'm working now to backport this PR to: 3.10.
🐍🍒⛏🤖

@CAM-Gerlach
Copy link
Member

Too late now for this PR, but just FYI, the :program: role is only intended to be used for the name of an [external] executable program. not the full invocation, and will render in bold, non-monospaced text. In future versions of Sphinx, with the appropriate setup, we may be able to use :option: for this, but for now the standard literal role, ``, is the best option here (no pun intended).

Also, since the 3.10 branch is equivalently active to the 3.11 branch in bugfix mode, and the problem reported against both branches, I'm not sure why it wasn't marked for backport against both—for docs changes, backporting things incompletely makes it more likely to hit merge conflicts on future backports, so AFAIK we generally try to backport to all bugfix branches to which the change is applicable.

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Dec 29, 2022
(cherry picked from commit 7223d50)

Co-authored-by: ram vikram singh <ramvikrams243@gmail.com>
@bedevere-bot
Copy link

GH-100607 is a backport of this pull request to the 3.10 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.10 only security fixes label Dec 29, 2022
kumaraditya303 pushed a commit that referenced this pull request Dec 29, 2022
)

gh-100583: Improve the `pydoc` documentation  (GH-100590)
(cherry picked from commit 7223d50)

Co-authored-by: ram vikram singh <ramvikrams243@gmail.com>
@ramvikrams ramvikrams deleted the t65 branch January 1, 2023 09:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.11 only security fixes 3.12 only security fixes docs Documentation in the Doc dir skip news
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants
0