Changes between Initial Version and Version 8 of Ticket #36500


Ignore:
Timestamp:
Jul 21, 2025, 5:01:12 PM (2 months ago)
Author:
Mike Edmunds
Comment:

The consensus in the forum discussion seems to be to remove the separate 79-char limit for docstrings and comments.

There's also a strong argument for keeping the requirement and bringing the existing code in compliance so it can be enforced by flake8.

I've opened PRs for both options. (The second one is, naturally, quite a bit more complicated. It would require some additional manual reformatting and careful review/merge coordination.)

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #36500

    • Property Has patch set
    • Property Cc David Smith added
    • Property Component PackagingCore (Other)
    • Property Version 5.2dev
    • Property Status assignednew
    • Property Keywords flake8 added
    • Property Summary pre-commit should enforce 79 char limit for docstrings and commentsinconsistent 79 char limit for docstrings and comments
    • Property Type Cleanup/optimizationBug
  • Ticket #36500 – Description

    initial v8  
    11Django's coding style has long required [https://docs.djangoproject.com/en/5.2/internals/contributing/writing-code/coding-style/#python-style:~:text=We%20allow%20up%20to%2088%20characters%20as%20this%20is%20the%20line%20length%20used%20by%20black.%20This%20check%20is%20included%20when%20you%20run%20flake8.%20Documentation%2C%20comments%2C%20and%20docstrings%20should%20be%20wrapped%20at%2079%20characters%2C%20even%20though%20PEP%208%20suggests%2072. limiting docstrings and comments] to 79 characters, while allowing a larger 88-char limit for code lines. (The latter matches Black's default.)
    22
    3 Currently, only the 88 char limit is enforced by pre-commit linting, via flake8. The 79 char limit is manually enforced during PR review.
     3But a large number of files in Django's source code have docstrings and block comments with lines that are between 80–88 characters long, violating this coding standard.
     4
     5Currently, only the 88 char limit is enforced by pre-commit linting, via flake8. The 79 char limit is (sometimes) manually enforced during PR review.
    46
    57Early versions of flake8 supported only a single `max-line-length ` limit that applied to both code and comments/docstrings. flake8 3.7.8 (2019-07-08) added a separate `max-doc-length` configuration option.
    68
    7 Django should set that option so reviewers and contributors don't need to spend time cycling on line length.
     9Django should either automatically enforce (via flake8 and pre-commit) this requirement or remove it so reviewers and contributors don't need to spend time cycling on line length.
     10
     11[Edited to clarify discrepancy between existing coding standard and existing code.]
Back to Top