Skip to content

[FEATURE] PEP 8 Support #690

@Vicente-Pastor

Description

@Vicente-Pastor

Summary

The project currently uses Black (line-length 88) and isort for formatting but lacks a linter to enforce PEP 8 naming, unused imports, and other non-formatting rules.

Proposal

Add Ruff as a single-tool replacement for flake8/pycodestyle/pydocstyle with auto-fix support.

Suggested pyproject.toml configuration

[tool.ruff]
line-length = 88
target-version = "py312"

[tool.ruff.lint]
select = ["E", "F", "W", "I", "N", "UP", "B"]

Rule sets

Code Category Description
E pycodestyle errors Core PEP 8 style
F pyflakes Unused imports, undefined names
W pycodestyle warnings Whitespace issues
I isort Import ordering (replaces standalone isort)
N pep8-naming Naming conventions
UP pyupgrade Modernize Python syntax
B flake8-bugbear Common bug patterns

Rollout plan

  1. Add Ruff to [project.optional-dependencies] dev
  2. Run ruff check --fix . for auto-fixable violations
  3. Run black . and isort . to reformat
  4. Manual review for remaining violations
  5. Add ruff check to CI pipeline
  6. Use git blame --ignore-rev to exclude the formatting commit

Notes

  • Ruff is 10-100x faster than flake8/pylint
  • Already Black-compatible out of the box
  • Existing code largely follows PEP 8 naming conventions already
  • Keep line-length at 88 to match existing Black config
  • Do this as a separate PR to avoid polluting git blame

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestneeds-triageNew issue, not yet reviewed by maintainers

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions