Skip to content

Commit 29dbaed

Browse files
WilliamBergaminClaude
andcommitted
chore: replace flake8 and black with ruff
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"] plus the ignore set carried over from .flake8 (F841, F821, E402); drop [tool.black]. - requirements/dev_tools.txt: replace flake8 and black with ruff. - delete .flake8 (settings now live in pyproject.toml). - scripts/format.sh: ruff check --fix + ruff format. - scripts/lint.sh: ruff check. - rename the file-level `# flake8: noqa` directives to `# ruff: noqa`. - freeze three middleware/handler dispatch calls with `# fmt: skip` so ruff format cannot detach their `# type: ignore` comments (which would break mypy under warn_unused_ignores). - record the reformat commit in .git-blame-ignore-revs. Co-Authored-By: Claude <svc-devxp-claude@slack-corp.com>
1 parent 07e8ac9 commit 29dbaed

12 files changed

Lines changed: 24 additions & 21 deletions

File tree

‎.flake8‎

Lines changed: 0 additions & 3 deletions
This file was deleted.

‎.git-blame-ignore-revs‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
# change black settings
22
0e4cd56b69e8f83166cd262f762802b7f18c3d21
3+
4+
# apply ruff format across the codebase
5+
07e8ac9d98c535ade20040883a04734b4c9d04b8

‎AGENTS.md‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ Slack Bolt for Python -- a framework for building Slack apps in Python.
1616

1717
## Environment Setup
1818

19-
You can verify the venv is active by checking `echo $VIRTUAL_ENV`. If tools like `black`, `flake8`, `mypy` or `pytest` are not found, ask the user to activate the venv.
19+
You can verify the venv is active by checking `echo $VIRTUAL_ENV`. If tools like `ruff`, `mypy` or `pytest` are not found, ask the user to activate the venv.
2020

2121
A python virtual environment (`venv`) should be activated before running any commands.
2222

@@ -65,10 +65,10 @@ Always use the project scripts instead of calling `pytest` directly:
6565
### Formatting, Linting, Type Checking
6666

6767
```bash
68-
# Format -- Black, configured in pyproject.toml
68+
# Format -- Ruff formatter (+ lint autofix), configured in pyproject.toml
6969
./scripts/format.sh --no-install
7070

71-
# Lint -- Flake8, configured in .flake8
71+
# Lint -- Ruff linter, configured in pyproject.toml
7272
./scripts/lint.sh --no-install
7373

7474
# Type check -- mypy, configured in pyproject.toml
@@ -210,7 +210,7 @@ The core package has a **single required runtime dependency**: `slack_sdk` (defi
210210
- `test_async.txt` -- test runner deps (`pytest`, `pytest-asyncio`, includes `async_dev.txt`)
211211
- `test.txt` -- test deps without async (`pytest`, `pytest-cov`)
212212
- `test_adapter.txt` -- adapter-specific test deps (`moto`, `boddle`, `sanic-testing`)
213-
- `dev_tools.txt` -- dev tools (`mypy`, `flake8`, `black`)
213+
- `dev_tools.txt` -- dev tools (`mypy`, `ruff`)
214214

215215
When adding a new dependency: add it to the appropriate `requirements/*.txt` file with version constraints, never to `pyproject.toml` `dependencies` (unless it's a core runtime dep, which is very rare).
216216

‎examples/assistants/async_interaction_app.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# flake8: noqa F811
1+
# ruff: noqa: F811
22
import asyncio
33
import logging
44
import os

‎pyproject.toml‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,13 @@ readme = { file = ["README.md"], content-type = "text/markdown" }
3838
[tool.distutils.bdist_wheel]
3939
universal = true
4040

41-
[tool.black]
41+
[tool.ruff]
4242
line-length = 125
4343

44+
[tool.ruff.lint]
45+
select = ["E", "W", "F"]
46+
ignore = ["F841", "F821", "E402"]
47+
4448
[tool.pytest.ini_options]
4549
testpaths = ["tests"]
4650
log_file = "logs/pytest.log"

‎requirements/dev_tools.txt‎

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@
33
# mypy
44
mypy==2.3.0
55

6-
# flake8
7-
flake8==7.3.0
8-
9-
# black
10-
black==26.3.1
6+
# ruff
7+
# Note: replaces flake8 (lint) and black (format)
8+
ruff==0.16.4

‎scripts/format.sh‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,5 @@ if [[ "$1" != "--no-install" ]]; then
1010
pip install -U -r requirements/dev_tools.txt
1111
fi
1212

13-
black slack_bolt/ tests/
13+
ruff check --fix slack_bolt/ examples/
14+
ruff format slack_bolt/ tests/

‎scripts/lint.sh‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ if [[ "$1" != "--no-install" ]]; then
99
pip install -U -r requirements/dev_tools.txt
1010
fi
1111

12-
flake8 slack_bolt/ && flake8 examples/
12+
ruff check slack_bolt/ examples/

‎slack_bolt/adapter/asgi/base_handler.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ async def __call__(self, scope: scope_type, receive: Callable, send: Callable) -
5959
if scope["type"] == "http":
6060
response: AsgiHttpResponse = await self._get_http_response(
6161
method=scope["method"], path=scope["path"], request=AsgiHttpRequest(scope, receive) # type: ignore[arg-type]
62-
)
62+
) # fmt: skip
6363
await send(response.get_response_start())
6464
await send(response.get_response_body())
6565
return

‎slack_bolt/app/__init__.py‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# flake8: noqa
1+
# ruff: noqa
22
"""Application interface in Bolt.
33
44
For most use cases, we recommend using `slack_bolt.app.app`.

0 commit comments

Comments
 (0)