Skip to content
Merged
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
12 changes: 9 additions & 3 deletions .github/workflows/pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,17 @@ jobs:
- name: Install dependencies
run: poetry install

- name: Add Poetry Python binary to PATH
run: echo "$(poetry env info --path)/bin" >> $GITHUB_PATH

- name: Lint
run: poetry run ruff check
run: ruff check

- name: Check formatting
run: poetry run ruff format --check
run: ruff format --check

- name: Type check
uses: jakebailey/pyright-action@v2

- name: Test
run: poetry run pytest --cov=./
run: pytest --cov=./
7 changes: 7 additions & 0 deletions tws/_async/client.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
from supabase import create_async_client as create_async_supabase_client
from supabase import AsyncClient as SupabaseAsyncClient, AsyncClientOptions

from tws.base.client import TWSClient, ClientException


class AsyncClient(TWSClient):
api_client_options: AsyncClientOptions
api_client: SupabaseAsyncClient

@classmethod
async def create(cls, public_key: str, secret_key: str, api_url: str):
self = cls(public_key, secret_key, api_url)
try:
self.api_client_options = AsyncClientOptions(
headers={"Authorization": secret_key}
)
self.api_client = await create_async_supabase_client(
api_url, public_key, self.api_client_options
)
Expand Down
7 changes: 7 additions & 0 deletions tws/_sync/client.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
from supabase import create_client as create_supabase_client
from supabase import Client as SyncSupabaseClient, ClientOptions

from tws.base.client import TWSClient, ClientException


class SyncClient(TWSClient):
api_client_options: ClientOptions
api_client: SyncSupabaseClient

@classmethod
def create(cls, public_key: str, secret_key: str, api_url: str):
self = cls(public_key, secret_key, api_url)
try:
self.api_client_options = ClientOptions(
headers={"Authorization": secret_key}
)
self.api_client = create_supabase_client(
api_url, public_key, self.api_client_options
)
Expand Down
4 changes: 0 additions & 4 deletions tws/base/client.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import re

from supabase import ClientOptions


# TODO something better than Exception?
class ClientException(Exception):
Expand All @@ -28,5 +26,3 @@ def __init__(
r"^[A-Za-z0-9-_=]+\.[A-Za-z0-9-_=]+\.?[A-Za-z0-9-_.+/=]*$", secret_key
):
raise ClientException("Malformed secret key")

self.api_client_options = ClientOptions(headers={"Authorization": secret_key})
Loading