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

Unreadable help() with Annotated[str, Doc(...)] #300

Closed
saper opened this issue Nov 15, 2023 · 3 comments
Closed

Unreadable help() with Annotated[str, Doc(...)] #300

saper opened this issue Nov 15, 2023 · 3 comments

Comments

@saper
Copy link

saper commented Nov 15, 2023

fastapi-ugly-help

The above is how pydoc3 fastapi.FastAPI looks in my terminal. Do you have any idea how this could become more readable?

@JelleZijlstra
Copy link
Member

I think there's a couple of things we could do in CPython's implementation of help() if PEP 727 is accepted (which at this point, doesn't look terribly likely):

  • Run inspect.cleandoc on the Doc strings, to get rid of the excessive whitespace and newlines
  • Format the signature so that every parameter ends up on its own line
  • Parse out Doc() instances and format them specially

However, I don't think there's much we can do in typing-extensions.

cc @tiangolo

@JelleZijlstra
Copy link
Member

I feel my second suggestion would be useful regardless of PEP 727, so I filed a CPython feature request for it: python/cpython#112139.

@AlexWaygood
Copy link
Member

Agreed that there's nothing here that's actionable for typing_extensions. Let's continue discussion on the CPython issue; improving the output of help() for functions with long signatures sounds like a great idea!

@AlexWaygood AlexWaygood closed this as not planned Won't fix, can't repro, duplicate, stale Nov 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants