Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

MAINT: increase max line length from 79 to 88, upgrade pycodestyle #27320

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

Merged
merged 2 commits into from
Sep 1, 2024

Conversation

DimitriPapadopoulos
Copy link
Contributor

@DimitriPapadopoulos DimitriPapadopoulos commented Sep 1, 2024

In preparation for #24994.

Addresses #24994 (comment).

There are of course pros and cons, and PEP 8 still recommends 79. However, lots of tools have increased max line length:

  • black and ruff have bumped the limit to 88,
  • the Linux script checkpatch.pl eventually bumped the limit from 80 to 100 characters.

Also, the current codebase contains > 1800 lines wider than 79, against < 600 lines wider than 88:

$ pycodestyle --exclude vendored-meson --exclude numpy/typing/tests/data --exclude numpy/typing/_char_codes.py --exclude numpy/__config__.py --exclude numpy/f2py --exclude numpy/distutils -qq --select=E501 --statistics .
1837    E501 line too long (117 > 79 characters)
$ 
$ pycodestyle --exclude vendored-meson --exclude numpy/typing/tests/data --exclude numpy/typing/_char_codes.py --exclude numpy/__config__.py --exclude numpy/f2py --exclude numpy/distutils -qq --select=E501 --max-line-length=88 --statistics .
594     E501 line too long (117 > 88 characters)
$ 

Also bump pycodestyle version.

@DimitriPapadopoulos DimitriPapadopoulos changed the title MAINT: increase max line length from 79 to 80 MAINT: increase max line length from 79 to 80, upgrade pycodestyle Sep 1, 2024
@DimitriPapadopoulos DimitriPapadopoulos changed the title MAINT: increase max line length from 79 to 80, upgrade pycodestyle MAINT: increase max line length from 79 to 88, upgrade pycodestyle Sep 1, 2024
There are of course pros and cons, and PEP 8 still recommends 79. However,
lots of tools and recommendations have increased max line length:
- black and ruff have bumped the limit to 88,
- the Linux kernel coding style eventualy bumped the recommended limit from
  80 to 100 characters.

Also, the current codebase contains > 1880 lines wider than 79, against
around 500 lines wider than 88.
@charris
Copy link
Member

charris commented Sep 1, 2024

Also .editorconfig needs update.

@DimitriPapadopoulos DimitriPapadopoulos marked this pull request as ready for review September 1, 2024 12:06
@DimitriPapadopoulos
Copy link
Contributor Author

DimitriPapadopoulos commented Sep 1, 2024

File .editorconfig is about C source code, not Python code (hence the different 80 vs. 79 limit). Perhaps this file and NEP 45 should be updated separately:

No line should be longer than 80 characters. If this and the previous rule together don’t give you enough room to code, your code is too complicated – consider using subroutines.

@charris charris merged commit cf39f56 into numpy:main Sep 1, 2024
66 checks passed
@charris
Copy link
Member

charris commented Sep 1, 2024

Thanks @DimitriPapadopoulos . Might as well do this, I think it is inevitable in the long run. The c style enforcement is in .clang-format,

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.

2 participants
Morty Proxy This is a proxified and sanitized view of the page, visit original site.