diff --git a/README.md b/README.md index 8c005747..8a17b385 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ We can then read the keys in the python source code. ```python import os -from supabase_py import create_client, Client +from supabase import create_client, Client url: str = os.environ.get("SUPABASE_URL") key: str = os.environ.get("SUPABASE_KEY") @@ -88,7 +88,7 @@ This is a sample of how you'd use supabase-py. Functions and tests are WIP ## Authenticate ```python -from supabase_py import create_client, Client +from supabase import create_client, Client url: str = os.environ.get("SUPABASE_TEST_URL") key: str = os.environ.get("SUPABASE_TEST_KEY") @@ -102,7 +102,7 @@ user = supabase.auth.sign_up(email=random_email, password=random_password) ## Sign-in ```python -from supabase_py import create_client, Client +from supabase import create_client, Client url: str = os.environ.get("SUPABASE_TEST_URL") key: str = os.environ.get("SUPABASE_TEST_KEY") @@ -118,7 +118,7 @@ user = supabase.auth.sign_in(email=random_email, password=random_password) #### Insertion of Data ```python -from supabase_py import create_client, Client +from supabase import create_client, Client url: str = os.environ.get("SUPABASE_TEST_URL") key: str = os.environ.get("SUPABASE_TEST_KEY") @@ -130,7 +130,7 @@ assert len(data.get("data", [])) > 0 #### Selection of Data ```python -from supabase_py import create_client, Client +from supabase import create_client, Client url: str = os.environ.get("SUPABASE_TEST_URL") key: str = os.environ.get("SUPABASE_TEST_KEY") diff --git a/docs/index.rst b/docs/index.rst index ffa0c490..21fe05d0 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -6,7 +6,7 @@ Welcome to supabase's documentation! ==================================== -.. automodule:: supabase_py +.. automodule:: supabase :members: :show-inheritance: diff --git a/docs/query_builder.rst b/docs/query_builder.rst index 7b6717eb..27002456 100644 --- a/docs/query_builder.rst +++ b/docs/query_builder.rst @@ -1,6 +1,6 @@ Query Builder ================ -.. automodule:: supabase_py.lib.query_builder +.. automodule:: supabase.lib.query_builder :members: :show-inheritance: diff --git a/docs/storage_bucket.rst b/docs/storage_bucket.rst index 7feee821..cc92cf1f 100644 --- a/docs/storage_bucket.rst +++ b/docs/storage_bucket.rst @@ -1,6 +1,6 @@ Storage Bucket ================ -.. automodule:: supabase_py.lib.storage.storage_bucket_api +.. automodule:: supabase.lib.storage.storage_bucket_api :members: :show-inheritance: diff --git a/pyproject.toml b/pyproject.toml index 545e8fe6..8148307d 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] -name = "supabase-py" -version = "0.0.2" +name = "supabase" +version = "0.0.3" description = "Supabase client for Python." authors = ["Joel Lee ", "Leon Fedden "] license = "MIT" diff --git a/supabase/__init__.py b/supabase/__init__.py new file mode 100644 index 00000000..6a3ad8e8 --- /dev/null +++ b/supabase/__init__.py @@ -0,0 +1,6 @@ +__version__ = "0.0.3" + +from supabase import client, lib +from supabase.client import Client, create_client + +__all__ = ["client", "lib", "Client", "create_client"] diff --git a/supabase_py/client.py b/supabase/client.py similarity index 95% rename from supabase_py/client.py rename to supabase/client.py index 758fa764..e2981eb5 100644 --- a/supabase_py/client.py +++ b/supabase/client.py @@ -2,11 +2,11 @@ from postgrest_py import PostgrestClient -from supabase_py.lib.auth_client import SupabaseAuthClient -from supabase_py.lib.constants import DEFAULT_HEADERS -from supabase_py.lib.query_builder import SupabaseQueryBuilder -from supabase_py.lib.realtime_client import SupabaseRealtimeClient -from supabase_py.lib.storage_client import SupabaseStorageClient +from supabase.lib.auth_client import SupabaseAuthClient +from supabase.lib.constants import DEFAULT_HEADERS +from supabase.lib.query_builder import SupabaseQueryBuilder +from supabase.lib.realtime_client import SupabaseRealtimeClient +from supabase.lib.storage_client import SupabaseStorageClient DEFAULT_OPTIONS = { "schema": "public", @@ -213,7 +213,7 @@ def create_client(supabase_url: str, supabase_key: str, **options) -> Client: -------- Instanciating the client. >>> import os - >>> from supabase_py import create_client, Client + >>> from supabase import create_client, Client >>> >>> url: str = os.environ.get("SUPABASE_TEST_URL") >>> key: str = os.environ.get("SUPABASE_TEST_KEY") diff --git a/supabase/lib/__init__.py b/supabase/lib/__init__.py new file mode 100644 index 00000000..7b96a426 --- /dev/null +++ b/supabase/lib/__init__.py @@ -0,0 +1,3 @@ +from supabase.lib import auth_client, query_builder, realtime_client + +__all__ = ["auth_client", "query_builder", "realtime_client"] diff --git a/supabase_py/lib/auth_client.py b/supabase/lib/auth_client.py similarity index 100% rename from supabase_py/lib/auth_client.py rename to supabase/lib/auth_client.py diff --git a/supabase_py/lib/constants.py b/supabase/lib/constants.py similarity index 65% rename from supabase_py/lib/constants.py rename to supabase/lib/constants.py index fc02b044..ebba6e60 100644 --- a/supabase_py/lib/constants.py +++ b/supabase/lib/constants.py @@ -1,3 +1,3 @@ -from supabase_py import __version__ +from supabase import __version__ DEFAULT_HEADERS = {"X-Client-Info": f"supabase-py/{__version__}"} diff --git a/supabase_py/lib/query_builder.py b/supabase/lib/query_builder.py similarity index 100% rename from supabase_py/lib/query_builder.py rename to supabase/lib/query_builder.py diff --git a/supabase_py/lib/realtime_client.py b/supabase/lib/realtime_client.py similarity index 100% rename from supabase_py/lib/realtime_client.py rename to supabase/lib/realtime_client.py diff --git a/supabase_py/lib/storage/__init__.py b/supabase/lib/storage/__init__.py similarity index 100% rename from supabase_py/lib/storage/__init__.py rename to supabase/lib/storage/__init__.py diff --git a/supabase_py/lib/storage/storage_bucket_api.py b/supabase/lib/storage/storage_bucket_api.py similarity index 100% rename from supabase_py/lib/storage/storage_bucket_api.py rename to supabase/lib/storage/storage_bucket_api.py diff --git a/supabase_py/lib/storage/storage_file_api.py b/supabase/lib/storage/storage_file_api.py similarity index 100% rename from supabase_py/lib/storage/storage_file_api.py rename to supabase/lib/storage/storage_file_api.py diff --git a/supabase_py/lib/storage_client.py b/supabase/lib/storage_client.py similarity index 82% rename from supabase_py/lib/storage_client.py rename to supabase/lib/storage_client.py index 27e9b7fe..f7737174 100644 --- a/supabase_py/lib/storage_client.py +++ b/supabase/lib/storage_client.py @@ -1,5 +1,5 @@ -from supabase_py.lib.storage.storage_bucket_api import StorageBucketAPI -from supabase_py.lib.storage.storage_file_api import StorageFileAPI +from supabase.lib.storage.storage_bucket_api import StorageBucketAPI +from supabase.lib.storage.storage_file_api import StorageFileAPI class SupabaseStorageClient(StorageBucketAPI): diff --git a/supabase_py/request_builder.py b/supabase/request_builder.py similarity index 100% rename from supabase_py/request_builder.py rename to supabase/request_builder.py diff --git a/supabase_py/__init__.py b/supabase_py/__init__.py deleted file mode 100644 index 8ea17797..00000000 --- a/supabase_py/__init__.py +++ /dev/null @@ -1,6 +0,0 @@ -__version__ = "0.0.2" - -from supabase_py import client, lib -from supabase_py.client import Client, create_client - -__all__ = ["client", "lib", "Client", "create_client"] diff --git a/supabase_py/lib/__init__.py b/supabase_py/lib/__init__.py deleted file mode 100644 index 5e498c18..00000000 --- a/supabase_py/lib/__init__.py +++ /dev/null @@ -1,3 +0,0 @@ -from supabase_py.lib import auth_client, query_builder, realtime_client - -__all__ = ["auth_client", "query_builder", "realtime_client"] diff --git a/tests/conftest.py b/tests/conftest.py index a6d3c3be..5bc27b32 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -4,7 +4,7 @@ import pytest -from supabase_py import Client, create_client +from supabase import Client, create_client @pytest.fixture(scope="session") diff --git a/tests/test_client.py b/tests/test_client.py index f8de8c1b..41db74ef 100644 --- a/tests/test_client.py +++ b/tests/test_client.py @@ -7,7 +7,7 @@ import pytest if TYPE_CHECKING: - from supabase_py import Client + from supabase import Client def _random_string(length: int = 10) -> str: @@ -33,7 +33,7 @@ def _assert_authenticated_user(data: Dict[str, Any]) -> None: @pytest.mark.parametrize("key", ["", None, "valeefgpoqwjgpj", 139, -1, {}, []]) def test_incorrect_values_dont_instanciate_client(url: Any, key: Any) -> None: """Ensure we can't instanciate client with nonesense values.""" - from supabase_py import Client, create_client + from supabase import Client, create_client _: Client = create_client(url, key) diff --git a/tests/test_dummy.py b/tests/test_dummy.py index 54a1a871..86b7e0f0 100644 --- a/tests/test_dummy.py +++ b/tests/test_dummy.py @@ -1,8 +1,8 @@ -import supabase_py +import supabase """ Convert this flow into a test -client = supabase_py.Client("", "") +client = supabase.Client("", "") client.auth.sign_up({"email": "anemail@gmail.com", "password": "apassword"}) """ @@ -13,4 +13,4 @@ def test_dummy() -> None: def test_client_initialziation() -> None: - client = supabase_py.Client("http://testwebsite.com", "atestapi") + client = supabase.Client("http://testwebsite.com", "atestapi")