Skip to content

Commit a1db7a7

Browse files
authored
chore: replace isort, black, pyupgrade and autoflake with ruff (#1165)
1 parent b657308 commit a1db7a7

File tree

7 files changed

+47
-189
lines changed

7 files changed

+47
-189
lines changed

.pre-commit-config.yaml

Lines changed: 10 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -9,42 +9,17 @@ repos:
99
- id: mixed-line-ending
1010
args: ["--fix=lf"]
1111

12-
- repo: https://github.com/pycqa/isort
13-
rev: 6.0.0
12+
- repo: https://github.com/astral-sh/ruff-pre-commit
13+
# Ruff version.
14+
rev: v0.12.1
1415
hooks:
15-
- id: isort
16-
args:
17-
[
18-
"--profile",
19-
"black",
20-
"--multi-line=3",
21-
"--trailing-comma",
22-
"--force-grid-wrap=0",
23-
"--use-parentheses",
24-
"--line-width=88",
25-
]
26-
27-
- repo: https://github.com/myint/autoflake.git
28-
rev: v2.3.1
29-
hooks:
30-
- id: autoflake
31-
args:
32-
[
33-
"--in-place",
34-
"--remove-all-unused-imports",
35-
"--ignore-init-module-imports",
36-
]
37-
38-
- repo: https://github.com/psf/black
39-
rev: "24.4.0"
40-
hooks:
41-
- id: black
42-
43-
- repo: https://github.com/asottile/pyupgrade
44-
rev: v3.15.2
45-
hooks:
46-
- id: pyupgrade
47-
args: ["--py37-plus", "--keep-runtime-typing"]
16+
# Run the linter.
17+
- id: ruff
18+
types_or: [ python, pyi ]
19+
args: [ --fix ]
20+
# Run the formatter.
21+
- id: ruff-format
22+
types_or: [ python, pyi ]
4823

4924
- repo: https://github.com/commitizen-tools/commitizen
5025
rev: v3.22.0

poetry.lock

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

pyproject.toml

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,23 +23,19 @@ httpx = ">=0.26,<0.29"
2323
storage3 = ">=0.10,<0.13"
2424
supafunc = ">=0.9,<0.11"
2525

26-
[tool.poetry.dev-dependencies]
26+
[tool.poetry.group.dev.dependencies]
2727
pre-commit = "^4.1.0"
28-
black = "^25.1"
2928
pytest = "^8.4.1"
30-
flake8 = "^7.3.0"
31-
isort = "^6.0.1"
3229
pytest-cov = "^6.2.1"
3330
commitizen = "^4.8.3"
3431
python-dotenv = "^1.1.1"
32+
unasync-cli = { git = "https://github.com/supabase-community/unasync-cli.git", branch = "main" }
33+
pytest-asyncio = ">=0.24,<1.1"
34+
ruff = "^0.12.1"
3535

3636
[tool.poetry.scripts]
3737
tests = 'poetry_scripts:run_tests'
3838

39-
[tool.poetry.group.dev.dependencies]
40-
unasync-cli = { git = "https://github.com/supabase-community/unasync-cli.git", branch = "main" }
41-
pytest-asyncio = ">=0.24,<1.1"
42-
4339
[tool.pytest.ini_options]
4440
asyncio_mode = "auto"
4541

supabase/_async/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ async def create(
105105
try:
106106
session = await client.auth.get_session()
107107
session_access_token = client._create_auth_header(session.access_token)
108-
except Exception as err:
108+
except Exception:
109109
session_access_token = None
110110

111111
client.options.headers.update(

supabase/_sync/client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ def create(
104104
try:
105105
session = client.auth.get_session()
106106
session_access_token = client._create_auth_header(session.access_token)
107-
except Exception as err:
107+
except Exception:
108108
session_access_token = None
109109

110110
client.options.headers.update(

tests/test_client_options.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55

66
class TestClientOptions:
7-
87
def test_replace_returns_updated_aclient_options(self):
98
storage = SyncMemoryStorage()
109
storage.set_item("key", "value")

tests/test_realtime.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ def test_realtime_client_initialization() -> None:
1111

1212
url = "http://localhost:54322"
1313
sp_local = supabase.Client(url, key)
14-
assert sp_local.realtime_url == f"ws://localhost:54322/realtime/v1"
14+
assert sp_local.realtime_url == "ws://localhost:54322/realtime/v1"
1515

1616

1717
def test_sync_realtime():
@@ -22,6 +22,6 @@ def test_sync_realtime():
2222
sp = supabase.Client(url, key)
2323

2424
try:
25-
channel = sp.realtime.channel("test")
25+
sp.realtime.channel("test")
2626
except NotImplementedError:
2727
pass

0 commit comments

Comments
 (0)