This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: pydoc terminal suboptimal rendering of complex annotations
Type: Stage: patch review
Components: Library (Lib) Versions: Python 3.10
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: dw
Priority: normal Keywords: patch

Created on 2021-03-09 19:12 by dw, last changed 2022-04-11 14:59 by admin.

Pull Requests
URL Status Linked Edit
PR 24802 open dw, 2021-03-09 19:16
Messages (1)
msg388373 - (view) Author: David Wilson (dw) * Date: 2021-03-09 19:12
When viewing docs for classes that use annotations, pydoc's rendering of argument lists is regularly truncated at the terminal edge (if using `less -S`), or wrapped in a manner where quickly scanning the output is next to impossible.

My 'classic' example is 'pydoc aiohttp.client.ClientSession', where the __init__ argument list wraps to 24 lines.

The pull request attached to this issue works around the problem by formatting arguments one-per-line if the sum of the arguments would exceed a hard-coded width of 150 characters. It is more of an RFC than a suggested fix. It produces acceptable formatting, but I'm not sure where the correct fix should be made -- in the inspect module, or somehow in the pydoc module, or even what the correct fix shuld be.

I will include a before/after screenshot in the pull request

I will attach before/after screenshot
Date User Action Args
2022-04-11 14:59:42adminsetgithub: 87617
2021-03-09 19:16:59dwsetkeywords: + patch
stage: patch review
pull_requests: + pull_request23570
2021-03-09 19:12:29dwcreate