Skip to content
This repository was archived by the owner on Sep 8, 2025. It is now read-only.

Commit 9efb7c2

Browse files
authored
chore: replace isort, black, pyupgrade and autoflake with ruff (#730)
1 parent 7e63772 commit 9efb7c2

File tree

7 files changed

+87
-199
lines changed

7 files changed

+87
-199
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/ambv/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: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ pyjwt = "^2.10.1"
2323
[tool.poetry.group.dev.dependencies]
2424
pytest = "^8.4.1"
2525
pytest-mock = "^3.14.0"
26-
flake8 = "^7.3.0"
27-
black = "^25.1.0"
28-
isort = "^6.0.1"
2926
pre-commit = "^4.2.0"
3027
pytest-cov = "^6.2.1"
3128
pytest-depends = "^1.0.1"
@@ -34,6 +31,29 @@ Faker = "^37.4.0"
3431
unasync-cli = { git = "https://github.com/supabase-community/unasync-cli.git", branch = "main" }
3532
pygithub = ">=1.57,<3.0"
3633
respx = ">=0.20.2,<0.23.0"
34+
ruff = "^0.12.1"
35+
36+
[tool.ruff.lint]
37+
select = [
38+
# pycodestyle
39+
"E",
40+
# Pyflakes
41+
"F",
42+
# pyupgrade
43+
"UP",
44+
# flake8-bugbear
45+
# "B",
46+
# flake8-simplify
47+
# "SIM",
48+
# isort
49+
"I",
50+
]
51+
ignore = ["F401", "F403", "F841", "E712", "E501", "E402", "E722", "E731", "UP006", "UP035"]
52+
# isort.required-imports = ["from __future__ import annotations"]
53+
54+
[tool.ruff.lint.pyupgrade]
55+
# Preserve types, even if a file imports `from __future__ import annotations`.
56+
keep-runtime-typing = true
3757

3858
[build-system]
3959
requires = ["poetry-core>=1.0.0"]

supabase_auth/__init__.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,15 @@
22

33
from ._async.gotrue_admin_api import AsyncGoTrueAdminAPI # type: ignore # noqa: F401
44
from ._async.gotrue_client import AsyncGoTrueClient # type: ignore # noqa: F401
5-
from ._async.storage import AsyncMemoryStorage # type: ignore # noqa: F401
6-
from ._async.storage import AsyncSupportedStorage # type: ignore # noqa: F401
5+
from ._async.storage import (
6+
AsyncMemoryStorage, # type: ignore # noqa: F401
7+
AsyncSupportedStorage, # type: ignore # noqa: F401
8+
)
79
from ._sync.gotrue_admin_api import SyncGoTrueAdminAPI # type: ignore # noqa: F401
810
from ._sync.gotrue_client import SyncGoTrueClient # type: ignore # noqa: F401
9-
from ._sync.storage import SyncMemoryStorage # type: ignore # noqa: F401
10-
from ._sync.storage import SyncSupportedStorage # type: ignore # noqa: F401
11+
from ._sync.storage import (
12+
SyncMemoryStorage, # type: ignore # noqa: F401
13+
SyncSupportedStorage, # type: ignore # noqa: F401
14+
)
1115
from .types import * # type: ignore # noqa: F401, F403
1216
from .version import __version__

tests/_async/test_gotrue_admin_api.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -367,11 +367,13 @@ async def test_verify_otp_with_invalid_phone_number():
367367

368368
async def test_sign_in_with_id_token():
369369
try:
370-
await client_api_auto_confirm_off_signups_enabled_client().sign_in_with_id_token(
371-
{
372-
"provider": "google",
373-
"token": "123456",
374-
}
370+
await (
371+
client_api_auto_confirm_off_signups_enabled_client().sign_in_with_id_token(
372+
{
373+
"provider": "google",
374+
"token": "123456",
375+
}
376+
)
375377
)
376378
except AuthApiError as e:
377379
assert e.to_dict()
@@ -398,7 +400,6 @@ async def test_sign_in_with_oauth():
398400

399401

400402
async def test_link_identity_missing_session():
401-
402403
with pytest.raises(AuthSessionMissingError) as exc:
403404
await client_api_auto_confirm_off_signups_enabled_client().link_identity(
404405
{

tests/_sync/test_gotrue_admin_api.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,6 @@ def test_sign_in_with_oauth():
400400

401401

402402
def test_link_identity_missing_session():
403-
404403
with pytest.raises(AuthSessionMissingError) as exc:
405404
client_api_auto_confirm_off_signups_enabled_client().link_identity(
406405
{

0 commit comments

Comments
 (0)