Skip to content

MAINT: Enable linting with ruff E501 #28947

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

Open
10 of 19 tasks
eendebakpt opened this issue May 12, 2025 · 2 comments
Open
10 of 19 tasks

MAINT: Enable linting with ruff E501 #28947

eendebakpt opened this issue May 12, 2025 · 2 comments
Labels
03 - Maintenance sprintable Issue fits the time-frame and setting of a sprint

Comments

@eendebakpt
Copy link
Contributor

eendebakpt commented May 12, 2025

Within the numpy codebase we aim to keep the maximum line length at 88 (#27320). We will enforce the ruff E501 rule for the codebase step by step:

List of files to be handled:

  • test*.py
  • benchmarks/*.py
  • numpy/_build_utils/*py
  • numpy/init.py
  • numpy/_core/**
  • numpy/_core/tests/**
  • numpy/core/**
  • numpy/_typing/*py
  • numpy/lib/*py
  • numpy/lib/tests/*py
  • numpy/linalg/*py
  • numpy/linalg/tests/*py
  • numpy/ma/*py
  • numpy/ma/tests/*py
  • numpy/polynomial/*py
  • numpy/tests/*py
  • numpy/random/*py
  • numpy/f2py/*py"
  • numpy*pyi"

Procedure:

  1. Select a couple of files to fix (for example all python files in numpy/random)
  2. Update ruff.toml to enable ruff E501
  3. Change python files to have maximum line length 88
  4. If some formatting really is better with longer lines, use # noqa: E501 to make an exception
@eendebakpt
Copy link
Contributor Author

@jorenham Many typing files (.pyi) also have too long lines, but maybe we can keep those as is?

@eendebakpt eendebakpt added 03 - Maintenance sprintable Issue fits the time-frame and setting of a sprint labels May 12, 2025
@jorenham
Copy link
Member

@jorenham Many typing files (.pyi) also have too long lines, but maybe we can keep those as is?

The idea was to follow the the official Python stub style guide, which sets the max line length for .pyi files at 130. But it's unfortunately not possible (yet?) to configure this on a per-file basis in ruff (astral-sh/ruff#16057, astral-sh/ruff#7696)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
03 - Maintenance sprintable Issue fits the time-frame and setting of a sprint
Projects
None yet
Development

No branches or pull requests

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy