corebase 1.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. corebase-1.0.0/LICENSE +21 -0
  2. corebase-1.0.0/PKG-INFO +78 -0
  3. corebase-1.0.0/README.md +57 -0
  4. corebase-1.0.0/pyproject.toml +33 -0
  5. corebase-1.0.0/src/corebase/__init__.py +108 -0
  6. corebase-1.0.0/src/corebase/_async/__init__.py +1 -0
  7. corebase-1.0.0/src/corebase/_async/auth_client.py +55 -0
  8. corebase-1.0.0/src/corebase/_async/client.py +398 -0
  9. corebase-1.0.0/src/corebase/_sync/__init__.py +1 -0
  10. corebase-1.0.0/src/corebase/_sync/auth_client.py +55 -0
  11. corebase-1.0.0/src/corebase/_sync/client.py +393 -0
  12. corebase-1.0.0/src/corebase/auth/__init__.py +20 -0
  13. corebase-1.0.0/src/corebase/auth/_async/__init__.py +1 -0
  14. corebase-1.0.0/src/corebase/auth/_async/gotrue_admin_api.py +356 -0
  15. corebase-1.0.0/src/corebase/auth/_async/gotrue_admin_mfa_api.py +32 -0
  16. corebase-1.0.0/src/corebase/auth/_async/gotrue_admin_oauth_api.py +93 -0
  17. corebase-1.0.0/src/corebase/auth/_async/gotrue_base_api.py +78 -0
  18. corebase-1.0.0/src/corebase/auth/_async/gotrue_client.py +1404 -0
  19. corebase-1.0.0/src/corebase/auth/_async/gotrue_mfa_api.py +94 -0
  20. corebase-1.0.0/src/corebase/auth/_async/storage.py +31 -0
  21. corebase-1.0.0/src/corebase/auth/_sync/__init__.py +1 -0
  22. corebase-1.0.0/src/corebase/auth/_sync/gotrue_admin_api.py +356 -0
  23. corebase-1.0.0/src/corebase/auth/_sync/gotrue_admin_mfa_api.py +32 -0
  24. corebase-1.0.0/src/corebase/auth/_sync/gotrue_admin_oauth_api.py +93 -0
  25. corebase-1.0.0/src/corebase/auth/_sync/gotrue_base_api.py +78 -0
  26. corebase-1.0.0/src/corebase/auth/_sync/gotrue_client.py +1394 -0
  27. corebase-1.0.0/src/corebase/auth/_sync/gotrue_mfa_api.py +94 -0
  28. corebase-1.0.0/src/corebase/auth/_sync/storage.py +31 -0
  29. corebase-1.0.0/src/corebase/auth/constants.py +15 -0
  30. corebase-1.0.0/src/corebase/auth/errors.py +259 -0
  31. corebase-1.0.0/src/corebase/auth/helpers.py +288 -0
  32. corebase-1.0.0/src/corebase/auth/py.typed +0 -0
  33. corebase-1.0.0/src/corebase/auth/timer.py +53 -0
  34. corebase-1.0.0/src/corebase/auth/types.py +1021 -0
  35. corebase-1.0.0/src/corebase/auth/version.py +1 -0
  36. corebase-1.0.0/src/corebase/client.py +12 -0
  37. corebase-1.0.0/src/corebase/functions/__init__.py +47 -0
  38. corebase-1.0.0/src/corebase/functions/_async/__init__.py +1 -0
  39. corebase-1.0.0/src/corebase/functions/_async/functions_client.py +218 -0
  40. corebase-1.0.0/src/corebase/functions/_sync/__init__.py +1 -0
  41. corebase-1.0.0/src/corebase/functions/_sync/functions_client.py +218 -0
  42. corebase-1.0.0/src/corebase/functions/errors.py +62 -0
  43. corebase-1.0.0/src/corebase/functions/py.typed +0 -0
  44. corebase-1.0.0/src/corebase/functions/utils.py +33 -0
  45. corebase-1.0.0/src/corebase/functions/version.py +1 -0
  46. corebase-1.0.0/src/corebase/lib/__init__.py +3 -0
  47. corebase-1.0.0/src/corebase/lib/client_options.py +189 -0
  48. corebase-1.0.0/src/corebase/migrate/__init__.py +374 -0
  49. corebase-1.0.0/src/corebase/migrate/__main__.py +7 -0
  50. corebase-1.0.0/src/corebase/postgrest/__init__.py +62 -0
  51. corebase-1.0.0/src/corebase/postgrest/_async/__init__.py +1 -0
  52. corebase-1.0.0/src/corebase/postgrest/_async/client.py +206 -0
  53. corebase-1.0.0/src/corebase/postgrest/_async/request_builder.py +503 -0
  54. corebase-1.0.0/src/corebase/postgrest/_sync/__init__.py +1 -0
  55. corebase-1.0.0/src/corebase/postgrest/_sync/client.py +206 -0
  56. corebase-1.0.0/src/corebase/postgrest/_sync/request_builder.py +503 -0
  57. corebase-1.0.0/src/corebase/postgrest/base_client.py +61 -0
  58. corebase-1.0.0/src/corebase/postgrest/base_request_builder.py +787 -0
  59. corebase-1.0.0/src/corebase/postgrest/constants.py +6 -0
  60. corebase-1.0.0/src/corebase/postgrest/exceptions.py +115 -0
  61. corebase-1.0.0/src/corebase/postgrest/py.typed +0 -0
  62. corebase-1.0.0/src/corebase/postgrest/types.py +72 -0
  63. corebase-1.0.0/src/corebase/postgrest/utils.py +91 -0
  64. corebase-1.0.0/src/corebase/postgrest/version.py +1 -0
  65. corebase-1.0.0/src/corebase/py.typed +0 -0
  66. corebase-1.0.0/src/corebase/realtime/__init__.py +17 -0
  67. corebase-1.0.0/src/corebase/realtime/_async/__init__.py +0 -0
  68. corebase-1.0.0/src/corebase/realtime/_async/channel.py +766 -0
  69. corebase-1.0.0/src/corebase/realtime/_async/client.py +498 -0
  70. corebase-1.0.0/src/corebase/realtime/_async/presence.py +185 -0
  71. corebase-1.0.0/src/corebase/realtime/_async/push.py +162 -0
  72. corebase-1.0.0/src/corebase/realtime/_async/timer.py +41 -0
  73. corebase-1.0.0/src/corebase/realtime/_sync/__init__.py +0 -0
  74. corebase-1.0.0/src/corebase/realtime/_sync/channel.py +30 -0
  75. corebase-1.0.0/src/corebase/realtime/_sync/client.py +71 -0
  76. corebase-1.0.0/src/corebase/realtime/_sync/presence.py +10 -0
  77. corebase-1.0.0/src/corebase/realtime/exceptions.py +38 -0
  78. corebase-1.0.0/src/corebase/realtime/message.py +176 -0
  79. corebase-1.0.0/src/corebase/realtime/py.typed +0 -0
  80. corebase-1.0.0/src/corebase/realtime/transformers.py +9 -0
  81. corebase-1.0.0/src/corebase/realtime/types.py +246 -0
  82. corebase-1.0.0/src/corebase/realtime/utils.py +5 -0
  83. corebase-1.0.0/src/corebase/realtime/version.py +1 -0
  84. corebase-1.0.0/src/corebase/storage/__init__.py +56 -0
  85. corebase-1.0.0/src/corebase/storage/_async/__init__.py +1 -0
  86. corebase-1.0.0/src/corebase/storage/_async/analytics.py +82 -0
  87. corebase-1.0.0/src/corebase/storage/_async/bucket.py +142 -0
  88. corebase-1.0.0/src/corebase/storage/_async/client.py +106 -0
  89. corebase-1.0.0/src/corebase/storage/_async/file_api.py +630 -0
  90. corebase-1.0.0/src/corebase/storage/_async/request.py +32 -0
  91. corebase-1.0.0/src/corebase/storage/_async/vectors.py +213 -0
  92. corebase-1.0.0/src/corebase/storage/_sync/__init__.py +1 -0
  93. corebase-1.0.0/src/corebase/storage/_sync/analytics.py +80 -0
  94. corebase-1.0.0/src/corebase/storage/_sync/bucket.py +142 -0
  95. corebase-1.0.0/src/corebase/storage/_sync/client.py +106 -0
  96. corebase-1.0.0/src/corebase/storage/_sync/file_api.py +630 -0
  97. corebase-1.0.0/src/corebase/storage/_sync/request.py +32 -0
  98. corebase-1.0.0/src/corebase/storage/_sync/vectors.py +199 -0
  99. corebase-1.0.0/src/corebase/storage/constants.py +16 -0
  100. corebase-1.0.0/src/corebase/storage/exceptions.py +84 -0
  101. corebase-1.0.0/src/corebase/storage/py.typed +0 -0
  102. corebase-1.0.0/src/corebase/storage/types.py +313 -0
  103. corebase-1.0.0/src/corebase/storage/utils.py +26 -0
  104. corebase-1.0.0/src/corebase/storage/version.py +1 -0
  105. corebase-1.0.0/src/corebase/types.py +8 -0
  106. corebase-1.0.0/src/corebase/version.py +1 -0
corebase-1.0.0/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020 Supabase
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,78 @@
1
+ Metadata-Version: 2.4
2
+ Name: corebase
3
+ Version: 1.0.0
4
+ Summary: Corebase client for Python: database, auth, realtime, storage and functions. Drop-in replacement for supabase-py.
5
+ Keywords: corebase,postgres,postgrest,realtime,auth
6
+ Author: Corebase
7
+ License-Expression: MIT
8
+ License-File: LICENSE
9
+ Classifier: Programming Language :: Python :: 3
10
+ Classifier: Operating System :: OS Independent
11
+ Requires-Dist: deprecation>=2.1.0
12
+ Requires-Dist: httpx[http2]>=0.26,<0.29
13
+ Requires-Dist: pydantic>=2.11.7,<3,<3.0.0
14
+ Requires-Dist: pyjwt[crypto]>=2.15.1
15
+ Requires-Dist: typing-extensions>=4.14.0
16
+ Requires-Dist: websockets>=11,<16
17
+ Requires-Dist: yarl>=1.20.1,>=1.22.0
18
+ Requires-Python: >=3.11
19
+ Project-URL: Homepage, https://corebase.so
20
+ Description-Content-Type: text/markdown
21
+
22
+ # corebase
23
+
24
+ Corebase client for Python: database, auth, realtime, storage and functions.
25
+
26
+ A drop-in replacement for `supabase` (supabase-py): the same API, built from
27
+ the same source, published under Corebase's name.
28
+
29
+ ```bash
30
+ pip install corebase
31
+ ```
32
+
33
+ ```python
34
+ from corebase import create_client, acreate_client
35
+
36
+ corebase = create_client("https://<ref>.corebase.so", "<service or anon key>")
37
+ rows = corebase.table("todos").select("*").execute()
38
+ ```
39
+
40
+ ## Moving from supabase-py
41
+
42
+ supabase-py is six packages with their own top-level modules. Here they are
43
+ one package, with the libraries inside it, so both can be installed at once:
44
+
45
+ | Before | After |
46
+ | --- | --- |
47
+ | `supabase` | `corebase` |
48
+ | `postgrest` | `corebase.postgrest` |
49
+ | `supabase_auth` (`gotrue`) | `corebase.auth` |
50
+ | `realtime` | `corebase.realtime` |
51
+ | `storage3` | `corebase.storage` |
52
+ | `supabase_functions` | `corebase.functions` |
53
+
54
+ Only the module names change; every class and function keeps its upstream
55
+ name (`create_client`, `acreate_client`, `Client`, `AsyncClient`,
56
+ `ClientOptions`, `AsyncClientOptions`, `APIError`, ...). For example:
57
+
58
+ ```python
59
+ # before
60
+ from supabase import acreate_client
61
+ from supabase.lib.client_options import AsyncClientOptions
62
+ from postgrest.exceptions import APIError
63
+
64
+ # after
65
+ from corebase import acreate_client
66
+ from corebase.lib.client_options import AsyncClientOptions
67
+ from corebase.postgrest.exceptions import APIError
68
+ ```
69
+
70
+ `CorebaseClient`, `AsyncCorebaseClient` and `CorebaseException` are also
71
+ exported as aliases of `Client`, `AsyncClient` and `SupabaseException`.
72
+
73
+ Needs Python 3.11 or newer.
74
+
75
+ ## Licence
76
+
77
+ MIT. Based on supabase-py (see `UPSTREAM` for the version), whose copyright
78
+ notice is kept in `LICENSE`.
@@ -0,0 +1,57 @@
1
+ # corebase
2
+
3
+ Corebase client for Python: database, auth, realtime, storage and functions.
4
+
5
+ A drop-in replacement for `supabase` (supabase-py): the same API, built from
6
+ the same source, published under Corebase's name.
7
+
8
+ ```bash
9
+ pip install corebase
10
+ ```
11
+
12
+ ```python
13
+ from corebase import create_client, acreate_client
14
+
15
+ corebase = create_client("https://<ref>.corebase.so", "<service or anon key>")
16
+ rows = corebase.table("todos").select("*").execute()
17
+ ```
18
+
19
+ ## Moving from supabase-py
20
+
21
+ supabase-py is six packages with their own top-level modules. Here they are
22
+ one package, with the libraries inside it, so both can be installed at once:
23
+
24
+ | Before | After |
25
+ | --- | --- |
26
+ | `supabase` | `corebase` |
27
+ | `postgrest` | `corebase.postgrest` |
28
+ | `supabase_auth` (`gotrue`) | `corebase.auth` |
29
+ | `realtime` | `corebase.realtime` |
30
+ | `storage3` | `corebase.storage` |
31
+ | `supabase_functions` | `corebase.functions` |
32
+
33
+ Only the module names change; every class and function keeps its upstream
34
+ name (`create_client`, `acreate_client`, `Client`, `AsyncClient`,
35
+ `ClientOptions`, `AsyncClientOptions`, `APIError`, ...). For example:
36
+
37
+ ```python
38
+ # before
39
+ from supabase import acreate_client
40
+ from supabase.lib.client_options import AsyncClientOptions
41
+ from postgrest.exceptions import APIError
42
+
43
+ # after
44
+ from corebase import acreate_client
45
+ from corebase.lib.client_options import AsyncClientOptions
46
+ from corebase.postgrest.exceptions import APIError
47
+ ```
48
+
49
+ `CorebaseClient`, `AsyncCorebaseClient` and `CorebaseException` are also
50
+ exported as aliases of `Client`, `AsyncClient` and `SupabaseException`.
51
+
52
+ Needs Python 3.11 or newer.
53
+
54
+ ## Licence
55
+
56
+ MIT. Based on supabase-py (see `UPSTREAM` for the version), whose copyright
57
+ notice is kept in `LICENSE`.
@@ -0,0 +1,33 @@
1
+ [project]
2
+ name = "corebase"
3
+ version = "1.0.0"
4
+ description = "Corebase client for Python: database, auth, realtime, storage and functions. Drop-in replacement for supabase-py."
5
+ readme = "README.md"
6
+ license = "MIT"
7
+ license-files = ["LICENSE"]
8
+ authors = [{ name = "Corebase" }]
9
+ requires-python = ">=3.11"
10
+ keywords = ["corebase", "postgres", "postgrest", "realtime", "auth"]
11
+ classifiers = [
12
+ "Programming Language :: Python :: 3",
13
+ "Operating System :: OS Independent",
14
+ ]
15
+ dependencies = [
16
+ "deprecation>=2.1.0",
17
+ "httpx[http2]>=0.26,<0.29",
18
+ "pydantic>=2.11.7,<3,<3.0.0",
19
+ "pyjwt[crypto]>=2.15.1",
20
+ "typing-extensions>=4.14.0",
21
+ "websockets>=11,<16",
22
+ "yarl>=1.22.0,>=1.20.1",
23
+ ]
24
+
25
+ [project.urls]
26
+ Homepage = "https://corebase.so"
27
+
28
+ [build-system]
29
+ requires = ["uv_build>=0.8.3,<0.9.0"]
30
+ build-backend = "uv_build"
31
+
32
+ [tool.uv.build-backend]
33
+ module-name = "corebase"
@@ -0,0 +1,108 @@
1
+ from corebase.postgrest import APIError as PostgrestAPIError
2
+ from corebase.postgrest import APIResponse as PostgrestAPIResponse
3
+ from corebase.realtime import AuthorizationError, NotConnectedError
4
+ from corebase.storage.utils import StorageException
5
+ from corebase.auth.errors import (
6
+ AuthApiError,
7
+ AuthError,
8
+ AuthImplicitGrantRedirectError,
9
+ AuthInvalidCredentialsError,
10
+ AuthRetryableError,
11
+ AuthSessionMissingError,
12
+ AuthUnknownError,
13
+ AuthWeakPasswordError,
14
+ )
15
+ from corebase.functions.errors import (
16
+ FunctionsError,
17
+ FunctionsHttpError,
18
+ FunctionsRelayError,
19
+ )
20
+
21
+ # Async Client
22
+ from ._async.auth_client import AsyncSupabaseAuthClient as ASupabaseAuthClient
23
+ from ._async.client import AsyncClient
24
+ from ._async.client import AsyncClient as AClient
25
+ from ._async.client import AsyncStorageClient as ASupabaseStorageClient
26
+ from ._async.client import SupabaseException as ASupabaseException
27
+ from ._async.client import SupabaseException as AsyncSupabaseException
28
+ from ._async.client import create_client as acreate_client
29
+ from ._async.client import create_client as create_async_client
30
+
31
+ # Sync Client
32
+ from ._sync.auth_client import SyncSupabaseAuthClient as SupabaseAuthClient
33
+ from ._sync.client import Client, SupabaseException, create_client
34
+ from ._sync.client import SupabaseException as SyncSupabaseException
35
+ from ._sync.client import SyncStorageClient as SupabaseStorageClient
36
+
37
+ # Corebase names for the same clients
38
+ from ._async.client import AsyncClient as AsyncCorebaseClient
39
+ from ._sync.client import Client as CorebaseClient
40
+ from ._sync.client import SupabaseException as CorebaseException
41
+
42
+ # Corebase's own: moving a Postgres database into a project (corebase.migrate)
43
+ from .migrate import (
44
+ MigrationError,
45
+ migrate_from_postgres,
46
+ follow_migration,
47
+ check_migration,
48
+ start_migration,
49
+ get_migration,
50
+ cancel_migration,
51
+ migration_percent,
52
+ )
53
+
54
+ # Lib
55
+ from .lib.client_options import AsyncClientOptions
56
+ from .lib.client_options import AsyncClientOptions as AClientOptions
57
+ from .lib.client_options import SyncClientOptions as ClientOptions
58
+
59
+ # Version
60
+ from .version import __version__
61
+
62
+ __all__ = (
63
+ "MigrationError",
64
+ "migrate_from_postgres",
65
+ "follow_migration",
66
+ "check_migration",
67
+ "start_migration",
68
+ "get_migration",
69
+ "cancel_migration",
70
+ "migration_percent",
71
+ "AsyncCorebaseClient",
72
+ "CorebaseClient",
73
+ "CorebaseException",
74
+ "acreate_client",
75
+ "create_async_client",
76
+ "AClient",
77
+ "ASupabaseAuthClient",
78
+ "ASupabaseStorageClient",
79
+ "AClientOptions",
80
+ "AsyncClient",
81
+ "AsyncClientOptions",
82
+ "create_client",
83
+ "Client",
84
+ "SupabaseAuthClient",
85
+ "SupabaseStorageClient",
86
+ "ClientOptions",
87
+ "PostgrestAPIError",
88
+ "PostgrestAPIResponse",
89
+ "StorageException",
90
+ "__version__",
91
+ "AuthApiError",
92
+ "AuthError",
93
+ "AuthImplicitGrantRedirectError",
94
+ "AuthInvalidCredentialsError",
95
+ "AuthRetryableError",
96
+ "AuthSessionMissingError",
97
+ "AuthWeakPasswordError",
98
+ "AuthUnknownError",
99
+ "FunctionsHttpError",
100
+ "FunctionsRelayError",
101
+ "FunctionsError",
102
+ "AuthorizationError",
103
+ "NotConnectedError",
104
+ "SupabaseException",
105
+ "ASupabaseException",
106
+ "AsyncSupabaseException",
107
+ "SyncSupabaseException",
108
+ )
@@ -0,0 +1 @@
1
+ from __future__ import annotations
@@ -0,0 +1,55 @@
1
+ from httpx import AsyncClient
2
+ from corebase.auth import (
3
+ AsyncGoTrueClient,
4
+ AsyncSupportedStorage,
5
+ AuthFlowType,
6
+ )
7
+
8
+
9
+ class AsyncSupabaseAuthClient(AsyncGoTrueClient):
10
+ """Supabase Auth Client for asynchronous operations."""
11
+
12
+ def __init__(
13
+ self,
14
+ *,
15
+ url: str,
16
+ headers: dict[str, str] | None = None,
17
+ storage_key: str | None = None,
18
+ auto_refresh_token: bool = True,
19
+ persist_session: bool = True,
20
+ storage: AsyncSupportedStorage | None = None,
21
+ http_client: AsyncClient | None = None,
22
+ flow_type: AuthFlowType = "implicit",
23
+ verify: bool = True,
24
+ proxy: str | None = None,
25
+ ) -> None:
26
+ """
27
+ Instantiate a SupabaseAuthClient instance.
28
+
29
+ Args:
30
+ url (str): The URL of the Supabase instance.
31
+ headers (Optional[Dict[str, str]]): Optional headers to include in requests.
32
+ storage_key (Optional[str]): Key to store session information.
33
+ auto_refresh_token (bool): Whether to automatically refresh the token. Defaults to True.
34
+ persist_session (bool): Whether to persist the session. Defaults to True.
35
+ storage (AsyncSupportedStorage): Storage mechanism. Defaults to AsyncMemoryStorage().
36
+ http_client (Optional[AsyncClient]): HTTP client for making requests. Defaults to None.
37
+ flow_type (AuthFlowType): Type of authentication flow. Defaults to "implicit".
38
+ verify (bool): Whether to verify SSL certificates. Defaults to True.
39
+ proxy (Optional[str]): Proxy URL. Defaults to None.
40
+ """
41
+ if headers is None:
42
+ headers = {}
43
+
44
+ super().__init__(
45
+ url=url,
46
+ headers=headers,
47
+ storage_key=storage_key,
48
+ auto_refresh_token=auto_refresh_token,
49
+ persist_session=persist_session,
50
+ storage=storage,
51
+ http_client=http_client,
52
+ flow_type=flow_type,
53
+ verify=verify,
54
+ proxy=proxy,
55
+ )