Skip to content

[Chore] Re-enable isort import sorting (pre-commit + sweep) #25

@MatthewGrigsby

Description

@MatthewGrigsby

Context
A recent PR review pointed out imports aren’t consistently sorted, and isort enforcement appears disabled/misconfigured (see PR #22 thread: #22 (comment)).

Current state

  • .pre-commit-config.yaml has the isort hook commented out.
  • Ruff is configured but import sorting (I rules) is not enabled yet (there’s a TODO in pyproject.toml).
  • pyproject.toml already contains a [tool.isort] config (including import section headings like # Standard/# Third-Party/# First-Party).

Goal
Make import sorting deterministic and enforced (pre-commit + CI), without mixing a large formatting sweep into functional PRs.

Proposed plan

  1. Decide enforcement tool

    • Option A: enable isort via pre-commit (preferred if we want to preserve the import section headers as configured).
    • Option B: enable Ruff import sorting (I) instead (fewer tools, but won’t preserve section-header comments the same way).
  2. Enable enforcement

    • Update .pre-commit-config.yaml to enable the chosen hook(s).
    • If using Ruff I, update Ruff config ([tool.ruff.lint] select) and verify settings.
  3. One-time formatting sweep

    • Run the sorter across the repo and commit the result as a dedicated PR.

Acceptance criteria

  • pre-commit run --all-files either fixes import order or fails when imports are out of order.
  • CI (or documented local command) enforces the same behavior.
  • Import grouping stays consistent with the project’s conventions.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions