Skip to content

Commit 8b7f9a9

Browse files
committed
Drop black in favor of ruff
1 parent 18dc258 commit 8b7f9a9

File tree

4 files changed

+13
-19
lines changed

4 files changed

+13
-19
lines changed

Makefile

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,21 @@
11
.DEFAULT_GOAL := all
2-
black = black granian tests
3-
ruff = ruff granian tests
2+
pysources = granian tests
43

54
.PHONY: build-dev
65
build-dev:
76
@rm -f granian/*.so
8-
maturin develop --extras test
7+
maturin develop --extras lint,test
98

109
.PHONY: format
1110
format:
12-
$(black)
13-
$(ruff) --fix --exit-zero
11+
ruff --fix $(pysources)
12+
ruff format $(pysources)
1413
cargo fmt
1514

1615
.PHONY: lint-python
1716
lint-python:
18-
$(ruff)
19-
$(black) --check --diff
17+
ruff $(pysources)
18+
ruff format --check $(pysources)
2019

2120
.PHONY: lint-rust
2221
lint-rust:

granian/_internal.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def load_module(module_name: str, raise_on_failure: bool = True) -> Optional[Mod
4141
except ImportError:
4242
if sys.exc_info()[-1].tb_next:
4343
raise RuntimeError(
44-
f"While importing '{module_name}', an ImportError was raised:" f"\n\n{traceback.format_exc()}"
44+
f"While importing '{module_name}', an ImportError was raised:" f'\n\n{traceback.format_exc()}'
4545
)
4646
elif raise_on_failure:
4747
raise RuntimeError(f"Could not import '{module_name}'.")

granian/server.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -436,9 +436,9 @@ def serve(
436436
if sys.platform == 'win32' and self.workers > 1:
437437
self.workers = 1
438438
logger.warn(
439-
"Due to a bug in Windows unblocking socket implementation "
439+
'Due to a bug in Windows unblocking socket implementation '
440440
"granian can't support multiple workers on this platform. "
441-
"Number of workers will now fallback to 1."
441+
'Number of workers will now fallback to 1.'
442442
)
443443

444444
if self.websockets:

pyproject.toml

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,7 @@ dependencies = [
4040

4141
[project.optional-dependencies]
4242
lint = [
43-
'black~=23.9.0',
44-
'ruff~=0.0.292',
43+
'ruff~=0.1.0',
4544
]
4645
test = [
4746
'httpx~=0.25.0',
@@ -92,6 +91,9 @@ extend-ignore = [
9291
flake8-quotes = { inline-quotes = 'single', multiline-quotes = 'double' }
9392
mccabe = { max-complexity = 13 }
9493

94+
[tool.ruff.format]
95+
quote-style = 'single'
96+
9597
[tool.ruff.isort]
9698
combine-as-imports = true
9799
lines-after-imports = 2
@@ -101,12 +103,5 @@ known-first-party = ['granian', 'tests']
101103
'granian/_granian.pyi' = ['I001']
102104
'tests/**' = ['B018', 'S110', 'S501']
103105

104-
[tool.black]
105-
color = true
106-
line-length = 120
107-
target-version = ['py38', 'py39', 'py310', 'py311', 'py312']
108-
skip-string-normalization = true # leave this to ruff
109-
skip-magic-trailing-comma = true # leave this to ruff
110-
111106
[tool.pytest.ini_options]
112107
asyncio_mode = 'auto'

0 commit comments

Comments
 (0)