From a5c2d1c0519a1122775fe463d6df731eac666668 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Tue, 26 May 2026 00:27:23 -0400 Subject: [PATCH 1/4] chore: migrate from flake8/isort/black to ruff Replace flake8 (with bugbear, comprehensions, typing-as-t plugins), isort, and black pre-commit hooks with ruff lint and format hooks. - Remove .flake8 config file - Replace [tool.isort] with [tool.ruff] config in pyproject.toml - Map flake8 plugin rules to ruff select categories (B, C4, I, TCH) - Ignore E203 for black/ruff-format compat - Fix known-first-party from stale 'mddj' to 'dependency_groups' Assisted-by: OpenCode:glm-5 --- .flake8 | 4 ---- .pre-commit-config.yaml | 22 ++++++---------------- pyproject.toml | 13 ++++++++++--- 3 files changed, 16 insertions(+), 23 deletions(-) delete mode 100644 .flake8 diff --git a/.flake8 b/.flake8 deleted file mode 100644 index e5d1fda..0000000 --- a/.flake8 +++ /dev/null @@ -1,4 +0,0 @@ -[flake8] -exclude = .git,.tox,__pycache__,.eggs,dist,.venv* -max-line-length = 88 -extend-ignore = W503,W504,E203 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index f1835a8..272fd77 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -20,22 +20,12 @@ repos: hooks: - id: pyupgrade args: ["--py39-plus"] - - repo: https://github.com/psf/black-pre-commit-mirror - rev: 24.10.0 - hooks: - - id: black - - repo: https://github.com/PyCQA/flake8 - rev: 7.1.1 - hooks: - - id: flake8 - additional_dependencies: - - 'flake8-bugbear==24.12.12' - - 'flake8-comprehensions==3.16.0' - - 'flake8-typing-as-t==1.0.0' - - repo: https://github.com/PyCQA/isort - rev: 5.13.2 - hooks: - - id: isort + - repo: https://github.com/astral-sh/ruff-pre-commit + rev: v0.11.8 + hooks: + - id: ruff + args: [--fix] + - id: ruff-format - repo: https://github.com/sirosen/slyp rev: 0.8.1 hooks: diff --git a/pyproject.toml b/pyproject.toml index 6a4151d..97887a7 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -95,9 +95,16 @@ ignore_missing_imports = true disallow_subclassing_any = false files = ["src"] -[tool.isort] -profile = "black" -known_first_party = ["mddj"] +[tool.ruff] +line-length = 88 +src = ["src"] + +[tool.ruff.lint] +select = ["E4", "E7", "E9", "F", "B", "C4", "I", "TCH"] +ignore = ["E203"] + +[tool.ruff.lint.isort] +known-first-party = ["dependency_groups"] [tool.check-sdist] git-only = [".*", "Makefile", "docs/*", "scripts/*"] From 257683584202f552ae9c7b64039ecf35c67805b6 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Tue, 26 May 2026 00:32:41 -0400 Subject: [PATCH 2/4] chore: replace pyupgrade with ruff UP rules Remove pyupgrade pre-commit hook in favor of ruff's UP (pyupgrade) rule category. Set target-version = "py39" to match the previous --py39-plus behavior. Assisted-by: OpenCode:glm-5 --- .pre-commit-config.yaml | 5 ----- pyproject.toml | 3 ++- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 272fd77..fcf7359 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -15,11 +15,6 @@ repos: rev: 0.31.0 hooks: - id: check-github-workflows - - repo: https://github.com/asottile/pyupgrade - rev: v3.19.1 - hooks: - - id: pyupgrade - args: ["--py39-plus"] - repo: https://github.com/astral-sh/ruff-pre-commit rev: v0.11.8 hooks: diff --git a/pyproject.toml b/pyproject.toml index 97887a7..3d6e90e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -98,9 +98,10 @@ files = ["src"] [tool.ruff] line-length = 88 src = ["src"] +target-version = "py39" [tool.ruff.lint] -select = ["E4", "E7", "E9", "F", "B", "C4", "I", "TCH"] +select = ["E4", "E7", "E9", "F", "B", "C4", "I", "TCH", "UP"] ignore = ["E203"] [tool.ruff.lint.isort] From 570471292f519c2bbcded298346432856faf0e92 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Tue, 26 May 2026 00:40:46 -0400 Subject: [PATCH 3/4] chore: minor updates after transition Signed-off-by: Henry Schreiner --- .pre-commit-config.yaml | 4 ++-- pyproject.toml | 3 +-- scripts/bump-version.py | 2 +- 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index fcf7359..1061064 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -16,9 +16,9 @@ repos: hooks: - id: check-github-workflows - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.11.8 + rev: v0.15.14 hooks: - - id: ruff + - id: ruff-check args: [--fix] - id: ruff-format - repo: https://github.com/sirosen/slyp diff --git a/pyproject.toml b/pyproject.toml index 3d6e90e..290afb6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -97,8 +97,7 @@ files = ["src"] [tool.ruff] line-length = 88 -src = ["src"] -target-version = "py39" +show-fixes = true [tool.ruff.lint] select = ["E4", "E7", "E9", "F", "B", "C4", "I", "TCH", "UP"] diff --git a/scripts/bump-version.py b/scripts/bump-version.py index 5d643fd..abcc3ce 100755 --- a/scripts/bump-version.py +++ b/scripts/bump-version.py @@ -37,7 +37,7 @@ def update_changelog(new_version): ---------- {new_version} -{'-' * len(new_version)} +{"-" * len(new_version)} """, content, From a03dbeeb5297dd585ec666b71f2df3a7f441f4e0 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Tue, 26 May 2026 15:21:38 -0400 Subject: [PATCH 4/4] chore: restore flake8-typing-as-t Assisted-by: OpenCode:glm-5.1 Signed-off-by: Henry Schreiner --- .pre-commit-config.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 1061064..bc55171 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -15,6 +15,11 @@ repos: rev: 0.31.0 hooks: - id: check-github-workflows + - repo: https://github.com/PyCQA/flake8 + rev: 7.3.0 + hooks: + - id: flake8 + additional_dependencies: [flake8-typing-as-t] - repo: https://github.com/astral-sh/ruff-pre-commit rev: v0.15.14 hooks: