Skip to content

Commit efe02b0

Browse files
authored
Merge pull request #286 from authzed/284-use-ruff
Use ruff instead of flake8/black/etc
2 parents 197f84e + afcaef0 commit efe02b0

File tree

4 files changed

+45
-145
lines changed

4 files changed

+45
-145
lines changed

.github/workflows/lint.yaml

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -30,27 +30,10 @@ jobs:
3030
- uses: "actions/setup-python@v6"
3131
with:
3232
python-version: "3.10"
33-
- name: "Setup Python Environment"
34-
run: "pip install -U pip virtualenv"
35-
- name: "Install Dependencies"
36-
run: |
37-
virtualenv ~/.cache/virtualenv/authzedpy
38-
source ~/.cache/virtualenv/authzedpy/bin/activate
39-
pip install poetry
40-
poetry env info
41-
poetry install --only dev
42-
- name: "Pyflakes"
43-
run: |
44-
source ~/.cache/virtualenv/authzedpy/bin/activate
45-
find . -name "*.py" | grep -v "_pb2" | xargs pyflakes
46-
- name: "Blacken"
47-
run: |
48-
source ~/.cache/virtualenv/authzedpy/bin/activate
49-
black --check --diff .
50-
- name: "Isort"
51-
run: |
52-
source ~/.cache/virtualenv/authzedpy/bin/activate
53-
find . -name "*.py" | grep -v "_pb2" | xargs isort --check --diff
33+
# Installs ruff and runs check
34+
- uses: "astral-sh/ruff-action@v3"
35+
# Check formatting as well
36+
- run: "ruff format --check --diff"
5437
codeql:
5538
name: "Analyze with CodeQL"
5639
runs-on: "ubuntu-latest"

poetry.lock

Lines changed: 32 additions & 110 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,24 @@ googleapis-common-protos = "^1.65.0"
2929
protovalidate = ">=0.7.1,<1.1.0"
3030

3131
[tool.poetry.group.dev.dependencies]
32-
black = ">=23.3,<26.0"
3332
grpc-stubs = "^1.53"
3433
grpcio-tools = ">=1.63,<1.72"
35-
isort = ">=5.6.4,<7.0.0"
3634
mypy = "1.18.1"
3735
mypy-protobuf = "3.6.0"
3836
mock = "^5.1.0"
39-
pyflakes = "^3.0.1"
4037
pytest = ">=7.1.3,<9.0.0"
4138
pytest-asyncio = ">=0.21,<1.3"
4239
types-protobuf = ">=5.26,<7.0"
4340
typing-extensions = ">=3.7.4,<5"
41+
ruff = "^0.13.0"
4442

45-
[tool.black]
46-
exclude = '(^\.(.*)|^(.*)_pb2(_grpc)?\.py)'
43+
[tool.ruff]
44+
exclude = [
45+
"*_pb2.py",
46+
"*_grpc.py",
47+
"*_pb2.pyi",
48+
"*_grpc.pyi",
49+
]
4750
line-length = 100
4851

4952
[tool.mypy]
@@ -59,14 +62,6 @@ log_level = "debug"
5962
minversion = "6.0"
6063
asyncio_mode = "auto"
6164

62-
[tool.isort]
63-
ensure_newline_before_comments = true
64-
force_grid_wrap = 0
65-
include_trailing_comma = true
66-
line_length = 100
67-
multi_line_output = 3
68-
use_parentheses = true
69-
7065
[build-system]
7166
build-backend = "poetry.core.masonry.api"
7267
requires = ["poetry-core>=1.0.0"]

tests/v1_test.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ async def test_bulk_export_import(client):
328328

329329
# do bulk import
330330
reqs = [BulkImportRelationshipsRequest(relationships=rels)]
331-
import_rels = await maybe_await(empty_client.BulkImportRelationships(((req for req in reqs))))
331+
import_rels = await maybe_await(empty_client.BulkImportRelationships((req for req in reqs)))
332332
assert import_rels.num_loaded == 4
333333

334334
# validate all relationships were imported

0 commit comments

Comments
 (0)