The Wayback Machine - https://web.archive.org/web/20221223070501/https://github.com/python/cpython/pull/20295
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

pydoc.py: Wrapping (output) text at col 72 (PEP 8) #20295

Closed
wants to merge 1 commit into from

Conversation

edneville
Copy link

@edneville edneville commented May 21, 2020

Trivial change, pydoc --help had different length line wraps which didn't line up well.

Signed-off-by: ed [email protected]

@the-knights-who-say-ni
Copy link

the-knights-who-say-ni commented May 21, 2020

Hello, and thanks for your contribution!

I'm a bot set up to make sure that the project can legally accept this contribution by verifying everyone involved has signed the PSF contributor agreement (CLA).

Recognized GitHub username

We couldn't find a bugs.python.org (b.p.o) account corresponding to the following GitHub usernames:

@edneville

This might be simply due to a missing "GitHub Name" entry in one's b.p.o account settings. This is necessary for legal reasons before we can look at this contribution. Please follow the steps outlined in the CPython devguide to rectify this issue.

You can check yourself to see if the CLA has been received.

Thanks again for the contribution, we look forward to reviewing it!

@remilapeyre
Copy link
Contributor

remilapeyre commented May 21, 2020

Hi @edneville, PR that only make stylistic changes are usually refused as they create code churn without improving the codebase.

If you are looking to contribute to Python, you can have a look at https://bugs.python.org for the issues marked easy, easy (C) or newcomer friendly for things to work on :)

@edneville
Copy link
Author

edneville commented May 21, 2020

@remilapeyre, well, looking at the --help it make me itchy so I thought I should do something about it. Not sure what you mean by churn, it's either beneficial or not. I can create a ticket if it needs it, the PR auto comment said trivial didn't need a ticket IIRC.

@csabella
Copy link
Contributor

csabella commented May 22, 2020

@edneville, thank you for the suggestion and for the PR. @remilapeyre pretty much defined what he meant by churn in his explanation - stylistic changes without improving the codebase. Even though we strive to follow PEP 8 for new changes, we don't apply it to existing code unless we are making some other modification at the same time. If we did, there would be a lot of 'churn' in the codebase and it wouldn't be worth the risk/reward.

But as he also said, please take a look at the bug tracker if you're interested in contributing to the project. Thanks! :-)

@csabella csabella closed this May 22, 2020
@remilapeyre
Copy link
Contributor

remilapeyre commented May 23, 2020

Hi @csabella, actually I made a mistake because despite the PR title this is not a change to make pydoc.py respect PEP8, it's to improve the help message in the command line so it is a user visible change that may be worth merging.

Here's what pydoc --help currently shows:

$ pydoc3 --help
pydoc - the Python documentation tool

pydoc3 <name> ...
    Show text documentation on something.  <name> may be the name of a
    Python keyword, topic, function, module, or package, or a dotted
    reference to a class or function within a module or module in a
    package.  If <name> contains a '/', it is used as the path to a
    Python source file to document. If name is 'keywords', 'topics',
    or 'modules', a listing of these things is displayed.

pydoc3 -k <keyword>
    Search for a keyword in the synopsis lines of all available modules.

pydoc3 -n <hostname>
    Start an HTTP server with the given hostname (default: localhost).

pydoc3 -p <port>
    Start an HTTP server on the given port on the local machine.  Port
    number 0 can be used to get an arbitrary unused port.

pydoc3 -b
    Start an HTTP server on an arbitrary unused port and open a Web browser
    to interactively browse documentation.  This option can be used in
    combination with -n and/or -p.

pydoc3 -w <name> ...
    Write out the HTML documentation for a module to a file in the current
    directory.  If <name> contains a '/', it is treated as a filename; if
    it names a directory, documentation is written for all the contents.

The messages do not wrap consistently.

This change tries to fix that but it fails to account for the length of the sep string that gets formatted into the help message. Maybe the best way would be to avoid formatting the help manually, it's not very valuable to focus on this, by just converting the module to argparse?

@csabella
Copy link
Contributor

csabella commented May 23, 2020

@remilapeyre, thanks for clarifying. I still think it's code churn since the longer line lengths don't seem to be causing any issues. If @edneville is interested in changing pydoc to use argparse instead of getopt, the best route would be to create a bug ticket on the tracker to see if others agree.

@edneville
Copy link
Author

edneville commented May 23, 2020

@csabella/@remilapeyre, the line wrapping and inconsistent spacing after fullstops looked peculiar to me so I just wanted to fix that. Since that's the important part for me feel free to create a bug ticket and tag me, or reference it here and I'll look at implementing it using your choice of method otherwise I could just end up going round in circles.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants