chore: replace flake8 and black with ruff - #1954
Draft
WilliamBergamin wants to merge 2 commits into
Draft
Conversation
Swap the two separate dev tools -- flake8 (lint) and black (format) -- for
a single ruff binary that does both.
- pyproject.toml: add [tool.ruff] (line-length = 125) and [tool.ruff.lint]
with select = ["E", "W", "F"]; ignore = ["E402"] (the only code that
fires, all in the generated legacy_client.py header region). Drop
[tool.black].
- requirements/tools.txt: replace flake8 and black with ruff==0.16.4.
- delete .flake8 (its only setting, max-line-length, now lives in
[tool.ruff]).
- scripts/format.sh: ruff check --fix + ruff format.
- scripts/lint.sh: ruff format --check + ruff check.
- scripts/{run_tests,run_validation,run_integration_tests}.sh: update the
"Running black" echo to reference ruff.
- scripts/codegen.py: emit `ruff format slack_sdk/` in the generated-file
header; regenerate async_client.py, legacy_client.py, async_chat_stream.py.
- .vscode/settings.json: use the ruff extension for formatting/linting.
- AGENTS.md: update formatter/linter/tooling references to ruff.
Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
One-time mechanical reformat from adopting `ruff format` in place of black. Only the documented ruff-vs-black differences (implicit string-concat joining, f-string inner-quote normalization, blank-line-at-block-start removal, subscript/lambda reflow) plus ruff's formatting of Python code blocks inside Markdown. No behavior changes. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #1954 +/- ##
==========================================
- Coverage 84.06% 84.03% -0.03%
==========================================
Files 118 118
Lines 13506 13506
==========================================
- Hits 11354 11350 -4
- Misses 2152 2156 +4 ☔ View full report in Codecov by Harness. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces the two separate dev tools — flake8 (lint) and black (format) — with a single ruff binary that does both. This mirrors slackapi/bolt-python#1566.
Chosen for the simplest config that changes the source the least: a narrow lint
select = ["E", "W", "F"](mirroring flake8's pycodestyle + pyflakes) withignore = ["E402"], andruff format(a near-drop-in for black).Two commits:
chore: replace flake8 and black with ruff— the tooling swap:[tool.ruff]+[tool.ruff.lint]inpyproject.toml, delete.flake8,ruff==0.16.4inrequirements/tools.txt, rewritescripts/format.sh/scripts/lint.sh, update the "Running black" echoes in the runner scripts, pointscripts/codegen.py's generated-file header atruff format, update.vscode/settings.jsonandAGENTS.md.style: apply ruff format across the codebase— a one-time mechanical reformat. Only the documented ruff-vs-black differences (implicit string-concat joining, f-string inner-quote normalization, blank-line-at-block-start removal, subscript/lambda reflow) plus ruff's formatting of Python code blocks inside Markdown. No behavior changes.Notes for reviewers:
ignorelist is["E402"]only — this repo's.flake8carried no ignores, and E402 is the only code that fires (all in the generatedslack_sdk/web/legacy_client.pyheader region). Existing inline# noqa: F821comments keep handling those spots precisely.# fmt: skipguards were needed: mypy (warn_unused_ignores) passes clean because the reflow-sensitive# type: ignorelines keep their magic trailing commas..git-blame-ignore-revssogit blameskips the reformat.Testing
./scripts/lint.sh --no-install→455 files already formatted/All checks passed!./scripts/run_mypy.sh --no-install→Successpython scripts/codegen.py --path .+./scripts/format.sh --no-install→ generated files stable and referenceruff formatrun_validation.shnot yet run end-to-end locally — left for final verification.Category
tests/integration_tests(Automated tests for this library)/docs(Documents)Requirements
python3 -m venv .venv && source .venv/bin/activate && ./scripts/run_validation.shafter making the changes.🤖 Generated with Claude Code