← Back to issue list

feat: replace flake8 + plugins and isort with ruff

View original Github issue

Metadata

Project
charmcraft
Number
#932
Type
pull request
State
merged
Author
jnsgruk
Labels
—
Created
Updated
Closed

Current evaluation

Merged PR #932 (commit ac847a31, branch ruff-in-template) replaced flake8 + plugins and isort with Ruff in charmcraft, cutting the lint dependency tree and CI instability from flake8 plugin breakage.

Resolution: closed resolved

Reason: The PR itself was merged into main via merge commit ac847a31 (feature commit 8efd451f), moving lint config to Ruff and dropping flake8/isort. Follow-up #1941 (9aba24c4) later extended Ruff to the generated templates.

Evaluated by: mr-cal-bot

No scores available.

Issue body

We have previously standardised on using `flake8` with a number of plugins, and `pyproject-flake8` to enable us to configure all of our linting tools in one place (`pyproject.toml`) Over the past months, there have been two major releases of `flake8`, and both have caused various issues with the various plugins and their dependencies, leading to instability in CI pipelines. I've been following [ruff](https://github.com/charliermarsh/ruff) for a while. It's a Python linter, written in Rust, that combines a lot of the rules we were using from these other plugins. It's actively maintained, and all under one project, reducing the complexity of the dependency tree a little. It's got adoption from some pretty large projects like FastAPI and pydantic. Proposing here for discussion.

Evaluation history

Date Model Scores Action Summary
stealth/space-bunny-alpha — closed resolved Merged PR #932 (commit ac847a31, branch ruff-in-template) replaced flake8 + plugins and isort with Ruff in charmcraft, cutting the lint dependency tree and CI instability from flake8 plugin breakage.
stealth/space-bunny-alpha — closed resolved Merged PR #932 replaced flake8, its plugins, and isort with Ruff, simplifying Python linting and reducing dependency-related CI instability (merge ac847a31).
qwen/qwen3.6-35b-a3b — — Merged after approval and passing CI checks, replacing flake8, plugins, and isort with ruff to resolve CI instability from dependency conflicts. Updated six files to streamline Python linting.
qwen3.6-35b-a3b-mtp-q6 — — Merged an external PR replacing flake8, plugins, and isort with ruff. This resolves CI instability from flake8 dependency conflicts, consolidating linting and formatting into a single, faster Rust-based tool.

Update history

No update history recorded yet.

Related work

  • Likely Fixed By: canonical/charmcraft#1941 (confidence 72%)

    Follow-up merged PR replacing flake8 and pydocstyle with Ruff in charmcraft templates, closing the remaining flake8 usage

  • Related To: canonical/craft-parts#337 (confidence 60%)

    Sibling canonical project migration from flake8 to Ruff, part of the same cross-project linter standardisation

  • Related To: canonical/craft-providers#288 (confidence 55%)

    Parallel canonical project effort swapping flake8/isort/pylint for Ruff

Related issues

Issue Project State Summary Similarity
#1941 fix(templates): replace flake8 and pydocstyle with ruff charmcraft merged Merged PR #1941 (commit 9aba24c4) replaced flake8 and pydocstyle with Ruff in Charmcraft templates, resolving #1461.
85%
#1461 Replace flake8 and pydocstyle template tests with ruff charmcraft closed Ruff replaced flake8 and pydocstyle in Charmcraft template validation via merged PR #1941 (commit 9aba24c4).
80%
#4012 linters: migrate to ruff snapcraft merged Merged PR #4012 (commit a6e7d5f9d, CRAFT-1505): replaced the flake8/isort/black lint setup with Ruff, config ported from craft-parts#337, plus a legacy-specific ruff.toml; dependency updates from #4011 were included.
79%
#2383 style: update to ruff 0.12 charmcraft merged Merged PR #2383 updated Charmcraft to Ruff 0.12 and applied the associated lint and formatting changes across nine files.
76%
#288 lint: add ruff, remove autoflake, flake8, isort, pydocstyle, pylint craft-providers merged Merged PR #288 in commit 42a7920, replacing autoflake, flake8, isort, pydocstyle, and pylint with Ruff; deferred Ruff rule cleanup was tracked in #287.
76%
#337 Linters: migrate from flake8 to ruff craft-parts merged Merged PR #337 in commit 487e049f, making Ruff the default linter while retaining flake8 through the optional make test-flake8 target.
75%
#1517 build: update ruff settings charmcraft merged Merged into charmcraft as commit 33854f04, updating the project's Ruff lint configuration (+6/-6).
73%
#2229 style: fix linting errors charmcraft merged Merged charmcraft#2229 as commit 134e1cb6, fixing lint failures from the latest Ruff and Pyright across eight files.
72%
#33 lint: fix lint issues with newer ruff craft-archives merged PR #33 merged as commit c2a6687, fixing new lint failures introduced by a newer Ruff release across3 files (+5/-3). Maintainer deferred extra unit tests to CRAFT-1641.
71%