Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat/update pre commit #771

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: Pre Commit

on: [pull_request]

jobs:
pre-commit:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.11", "3.12"]

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Run pre-commit hooks
uses: pre-commit/action@v3.0.0
65 changes: 16 additions & 49 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,53 +1,20 @@
exclude: '^.*\.(md|MD)$'
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.1.0
hooks:
- id: trailing-whitespace
- id: check-added-large-files
- id: end-of-file-fixer
- id: mixed-line-ending
args: ["--fix=lf"]
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.4
hooks:
- id: ruff
args: [--fix]
- id: ruff-format

- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
args:
[
"--profile",
"black",
"--multi-line=3",
"--trailing-comma",
"--force-grid-wrap=0",
"--use-parentheses",
"--line-width=88",
]
- repo: https://github.com/asottile/pyupgrade
rev: v2.31.0
hooks:
- id: pyupgrade
args: ["--py37-plus", "--keep-runtime-typing"]

- repo: https://github.com/myint/autoflake.git
rev: v2.3.0
hooks:
- id: autoflake
args:
[
"--in-place",
"--remove-all-unused-imports",
"--ignore-init-module-imports",
]

- repo: https://github.com/psf/black
rev: "23.1.0"
hooks:
- id: black

- repo: https://github.com/asottile/pyupgrade
rev: v2.31.0
hooks:
- id: pyupgrade
args: ["--py37-plus", "--keep-runtime-typing"]

- repo: https://github.com/commitizen-tools/commitizen
rev: v2.20.3
hooks:
- id: commitizen
stages: [commit-msg]
- repo: https://github.com/commitizen-tools/commitizen
rev: v2.20.3
hooks:
- id: commitizen
stages: [commit-msg]
2 changes: 2 additions & 0 deletions supabase/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

__all__ = [
"acreate_client",
"AClientOptions",
"AClient",
"ASupabaseAuthClient",
"ASupabaseStorageClient",
Expand All @@ -35,5 +36,6 @@
"PostgrestAPIError",
"PostgrestAPIResponse",
"StorageException",
"ClientOptions",
"__version__",
]
2 changes: 1 addition & 1 deletion supabase/_async/auth_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def __init__(
persist_session: bool = True,
storage: AsyncSupportedStorage = AsyncMemoryStorage(),
http_client: Optional[AsyncClient] = None,
flow_type: AuthFlowType = "implicit"
flow_type: AuthFlowType = "implicit",
):
"""Instantiate SupabaseAuthClient instance."""
if headers is None:
Expand Down
2 changes: 1 addition & 1 deletion supabase/_sync/auth_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def __init__(
persist_session: bool = True,
storage: SyncSupportedStorage = SyncMemoryStorage(),
http_client: Optional[SyncClient] = None,
flow_type: AuthFlowType = "implicit"
flow_type: AuthFlowType = "implicit",
):
"""Instantiate SupabaseAuthClient instance."""
if headers is None:
Expand Down
6 changes: 3 additions & 3 deletions supabase/lib/client_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ class ClientOptions:
realtime: Optional[Dict[str, Any]] = None
"""Options passed to the realtime-py instance"""

postgrest_client_timeout: Union[
int, float, Timeout
] = DEFAULT_POSTGREST_CLIENT_TIMEOUT
postgrest_client_timeout: Union[int, float, Timeout] = (
DEFAULT_POSTGREST_CLIENT_TIMEOUT
)
"""Timeout passed to the SyncPostgrestClient instance."""

storage_client_timeout: Union[int, float, Timeout] = DEFAULT_STORAGE_CLIENT_TIMEOUT
Expand Down
2 changes: 1 addition & 1 deletion tests/test_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def test_supports_setting_a_global_authorization_header() -> None:
url = os.environ.get("SUPABASE_TEST_URL")
key = os.environ.get("SUPABASE_TEST_KEY")

authorization = f"Bearer secretuserjwt"
authorization = "Bearer secretuserjwt"

options = ClientOptions(headers={"Authorization": authorization})

Expand Down
Loading