Skip to content

Line overflow in pydoc output due to long docstrings #150285

Description

@serhiy-storchaka

Following PEP 8 automatically leads to pydoc generating outpurt that fits in 80 columns, except some long signatures, inherited standard docstrings and URIs. Exceptions happen here and there, and I usually fix them whem working on the module. Things are more complicated with the C code. Old docstrings mostly fit in 80 columns, but Argument Clinic provokes writing longer lines. There is a check for docstring line width, but it is incorrect. It's now a chicken and egg problem. We cannot simply fix the limits in Argument Clinic, because this will produce a large amount of warnings and errors (especially in recently added modules), but until it was fixed, the new code will add too long docstrings.

There are only few modules which need large number of corrections and many modules which require only 1-2 fixes. Most modules do not need any changes. I am going to fix large modules in separate PRs, then fix many simple cases at once and fix the limits in Argument Clinic.

Linked PRs

Activity

  1. added 2 commits that reference this issue on May 23, 2026
  2. omkar-334 commented on May 23, 2026

    @omkar-334
    Contributor

    hey @serhiy-storchaka is there any module i can help with, maybe the many small modules with 1-2 fixes?

  3. serhiy-storchaka commented on May 23, 2026

    @serhiy-storchaka
    MemberAuthor

    No, I already wrote them. I wait for merging the submitted PRs before uploading the rest.

  4. omkar-334 commented on May 23, 2026

    @omkar-334
    Contributor

    ok, got it, thanks!....i am interested in contributing more so i had asked

  5. added 3 commits that reference this issue on May 24, 2026
  6. 65 remaining items

  7. added 6 commits that reference this issue on Jun 11, 2026
  8. hugovk commented on Jun 14, 2026

    @hugovk
    Member

    @AlexWaygood Is there a Ruff rule that can prevent future overlong docstrings being introduced?

    I don't know of one, unfortunately. A good way of answering that kind of question is usually to go to the Ruff playground, enable ALL in the configuration settings, and see if the code triggers any lints. We can see here that the very long first line triggers E501 (a general lint about lines being too long, which would also be triggered if it was a short sentence that was heavily indented), but doesn't trigger any specific lints about the first line of the docstring being a sentence that's too long. play.ruff.rs/c4ac905d-e485-4b24-a035-833ef07c4e84

    I'd personally be happy to consider adding a rule like this (but I can't speak for the whole Ruff team -- definitely open an issue if it's something you're interested in!)

    There's almost a rule for this, I've opened astral-sh/ruff#25995 :)

  9. added 6 commits that reference this issue on Jun 17, 2026
  10. added a commit that references this issue on Jul 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

3.15bugs and security fixes3.16new features, bugs and security fixesdocsDocumentation in the Doc dirtopic-argument-clinic

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions