lamindb_setup 1.6.0__py3-none-any.whl → 1.6.1__py3-none-any.whl
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.
- lamindb_setup/__init__.py +1 -1
- lamindb_setup/_connect_instance.py +2 -2
- lamindb_setup/core/_hub_client.py +17 -6
- lamindb_setup/core/_hub_core.py +2 -2
- lamindb_setup/core/_settings_storage.py +1 -3
- lamindb_setup/core/cloud_sqlite_locker.py +8 -1
- lamindb_setup/core/upath.py +1 -1
- lamindb_setup/py.typed +0 -0
- {lamindb_setup-1.6.0.dist-info → lamindb_setup-1.6.1.dist-info}/METADATA +1 -1
- {lamindb_setup-1.6.0.dist-info → lamindb_setup-1.6.1.dist-info}/RECORD +12 -11
- {lamindb_setup-1.6.0.dist-info → lamindb_setup-1.6.1.dist-info}/LICENSE +0 -0
- {lamindb_setup-1.6.0.dist-info → lamindb_setup-1.6.1.dist-info}/WHEEL +0 -0
lamindb_setup/__init__.py
CHANGED
|
@@ -2,7 +2,7 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
import importlib
|
|
4
4
|
import os
|
|
5
|
-
from typing import TYPE_CHECKING
|
|
5
|
+
from typing import TYPE_CHECKING, Any
|
|
6
6
|
from uuid import UUID
|
|
7
7
|
|
|
8
8
|
from lamin_utils import logger
|
|
@@ -189,7 +189,7 @@ def _connect_instance(
|
|
|
189
189
|
|
|
190
190
|
|
|
191
191
|
@unlock_cloud_sqlite_upon_exception(ignore_prev_locker=True)
|
|
192
|
-
def connect(instance: str | None = None, **kwargs) -> str | tuple | None:
|
|
192
|
+
def connect(instance: str | None = None, **kwargs: Any) -> str | tuple | None:
|
|
193
193
|
"""Connect to an instance.
|
|
194
194
|
|
|
195
195
|
Args:
|
|
@@ -2,6 +2,7 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
import json
|
|
4
4
|
import os
|
|
5
|
+
from typing import Literal
|
|
5
6
|
from urllib.request import urlretrieve
|
|
6
7
|
|
|
7
8
|
from gotrue.errors import AuthUnknownError
|
|
@@ -25,7 +26,7 @@ def load_fallback_connector() -> Connector:
|
|
|
25
26
|
return connector
|
|
26
27
|
|
|
27
28
|
|
|
28
|
-
PROD_URL = "https://
|
|
29
|
+
PROD_URL = "https://laesaummdydllppgfchu.supabase.co"
|
|
29
30
|
PROD_ANON_KEY = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImxhZXNhdW1tZHlkbGxwcGdmY2h1Iiwicm9sZSI6ImFub24iLCJpYXQiOjE2NTY4NDA1NTEsImV4cCI6MTk3MjQxNjU1MX0.WUeCRiun0ExUxKIv5-CtjF6878H8u26t0JmCWx3_2-c"
|
|
30
31
|
|
|
31
32
|
|
|
@@ -197,10 +198,20 @@ def requests_client():
|
|
|
197
198
|
return requests
|
|
198
199
|
|
|
199
200
|
|
|
200
|
-
def
|
|
201
|
+
def request_with_auth(
|
|
202
|
+
url: str,
|
|
203
|
+
method: Literal["get", "post", "put", "delete", "head", "options"],
|
|
204
|
+
access_token: str,
|
|
205
|
+
renew_token: bool = True,
|
|
206
|
+
**kwargs,
|
|
207
|
+
):
|
|
201
208
|
requests = requests_client()
|
|
202
209
|
|
|
203
|
-
|
|
210
|
+
headers = kwargs.pop("headers", {})
|
|
211
|
+
headers["Authorization"] = f"Bearer {access_token}"
|
|
212
|
+
|
|
213
|
+
make_request = getattr(requests, method)
|
|
214
|
+
response = make_request(url, headers=headers, **kwargs)
|
|
204
215
|
# upate access_token and try again if failed
|
|
205
216
|
if response.status_code != 200 and renew_token:
|
|
206
217
|
from lamindb_setup import settings
|
|
@@ -212,7 +223,7 @@ def request_get_auth(url: str, access_token: str, renew_token: bool = True):
|
|
|
212
223
|
settings.user.access_token = access_token
|
|
213
224
|
save_user_settings(settings.user)
|
|
214
225
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
)
|
|
226
|
+
headers["Authorization"] = f"Bearer {access_token}"
|
|
227
|
+
|
|
228
|
+
response = make_request(url, headers=headers, **kwargs)
|
|
218
229
|
return response
|
lamindb_setup/core/_hub_core.py
CHANGED
|
@@ -17,7 +17,7 @@ from ._hub_client import (
|
|
|
17
17
|
call_with_fallback,
|
|
18
18
|
call_with_fallback_auth,
|
|
19
19
|
connect_hub,
|
|
20
|
-
|
|
20
|
+
request_with_auth,
|
|
21
21
|
)
|
|
22
22
|
from ._hub_crud import (
|
|
23
23
|
_delete_instance_record,
|
|
@@ -495,7 +495,7 @@ def access_db(
|
|
|
495
495
|
)
|
|
496
496
|
url = instance_api_url + url
|
|
497
497
|
|
|
498
|
-
response =
|
|
498
|
+
response = request_with_auth(url, "get", access_token, renew_token) # type: ignore
|
|
499
499
|
response_json = response.json()
|
|
500
500
|
if response.status_code != 200:
|
|
501
501
|
raise PermissionError(
|
|
@@ -2,9 +2,7 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
import os
|
|
4
4
|
import secrets
|
|
5
|
-
import shutil
|
|
6
5
|
import string
|
|
7
|
-
from pathlib import Path
|
|
8
6
|
from typing import TYPE_CHECKING, Any, Literal
|
|
9
7
|
|
|
10
8
|
import fsspec
|
|
@@ -208,7 +206,7 @@ class StorageSettings:
|
|
|
208
206
|
):
|
|
209
207
|
self._uid = uid
|
|
210
208
|
self._uuid_ = uuid
|
|
211
|
-
self._root_init = UPath(root)
|
|
209
|
+
self._root_init = UPath(root).expanduser()
|
|
212
210
|
if isinstance(self._root_init, LocalPathClasses): # local paths
|
|
213
211
|
try:
|
|
214
212
|
(self._root_init / ".lamindb").mkdir(parents=True, exist_ok=True)
|
|
@@ -9,12 +9,17 @@ from lamin_utils import logger
|
|
|
9
9
|
from .upath import UPath, create_mapper, infer_filesystem
|
|
10
10
|
|
|
11
11
|
if TYPE_CHECKING:
|
|
12
|
+
from collections.abc import Callable
|
|
12
13
|
from pathlib import Path
|
|
14
|
+
from typing import ParamSpec, TypeVar
|
|
13
15
|
from uuid import UUID
|
|
14
16
|
|
|
15
17
|
from ._settings_instance import InstanceSettings
|
|
16
18
|
from ._settings_user import UserSettings
|
|
17
19
|
|
|
20
|
+
P = ParamSpec("P")
|
|
21
|
+
R = TypeVar("R")
|
|
22
|
+
|
|
18
23
|
EXPIRATION_TIME = 24 * 60 * 60 * 7 # 7 days
|
|
19
24
|
|
|
20
25
|
MAX_MSG_COUNTER = 100 # print the msg after this number of iterations
|
|
@@ -207,7 +212,9 @@ def clear_locker():
|
|
|
207
212
|
|
|
208
213
|
|
|
209
214
|
# decorator
|
|
210
|
-
def unlock_cloud_sqlite_upon_exception(
|
|
215
|
+
def unlock_cloud_sqlite_upon_exception(
|
|
216
|
+
ignore_prev_locker: bool = False,
|
|
217
|
+
) -> Callable[[Callable[P, R]], Callable[P, R]]:
|
|
211
218
|
"""Decorator to unlock a cloud sqlite instance upon an exception.
|
|
212
219
|
|
|
213
220
|
Ignores `InstanceLockedException`.
|
lamindb_setup/core/upath.py
CHANGED
|
@@ -821,7 +821,7 @@ register_implementation("s3", S3QueryPath, clobber=True)
|
|
|
821
821
|
|
|
822
822
|
|
|
823
823
|
def create_path(path: UPathStr, access_token: str | None = None) -> UPath:
|
|
824
|
-
upath = UPath(path)
|
|
824
|
+
upath = UPath(path).expanduser()
|
|
825
825
|
|
|
826
826
|
if upath.protocol == "s3":
|
|
827
827
|
# add managed credentials and other options for AWS s3 paths
|
lamindb_setup/py.typed
ADDED
|
File without changes
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
lamindb_setup/__init__.py,sha256=
|
|
1
|
+
lamindb_setup/__init__.py,sha256=m38LZFyp_VF7qZdwLHYO-6TxKvZo3vTYw9mvjFFdsv4,2754
|
|
2
2
|
lamindb_setup/_cache.py,sha256=ixasm_9pUFy-ztbhbqJRVP88uTbFclL60MwUUvZhMFs,1509
|
|
3
3
|
lamindb_setup/_check.py,sha256=28PcG8Kp6OpjSLSi1r2boL2Ryeh6xkaCL87HFbjs6GA,129
|
|
4
4
|
lamindb_setup/_check_setup.py,sha256=uveV6CGiwm9M5OMe3lxfAMDs5SU7j1EogJsQB03ZaRw,5928
|
|
5
|
-
lamindb_setup/_connect_instance.py,sha256=
|
|
5
|
+
lamindb_setup/_connect_instance.py,sha256=JhC5A8mlJjV_XFmLFfwMf4LN9_wr5StOEOexAMitK3k,18270
|
|
6
6
|
lamindb_setup/_delete.py,sha256=2KnZOqd5Kgr45XzjiDE9der35LODDUajZD6_hcurGtQ,5676
|
|
7
7
|
lamindb_setup/_disconnect.py,sha256=p6tRLhixU4CuSxMKqzGTr-ovKmTRlZ8aID5dWQxOsg8,1092
|
|
8
8
|
lamindb_setup/_django.py,sha256=uIQflpkp8l3axyPaKURlk3kacgpElVP5KOKmFxYSMGk,1454
|
|
@@ -17,13 +17,14 @@ lamindb_setup/_schema_metadata.py,sha256=x4u15X_X-4dsS0Zot3mOwn_IWO0e7LL0Ip8vyUO
|
|
|
17
17
|
lamindb_setup/_set_managed_storage.py,sha256=qC3ACD_PWG-MrzcS3fQpjDEOuxAaJBgPqCU_bDvqtXo,2043
|
|
18
18
|
lamindb_setup/_setup_user.py,sha256=8BSGsW5jfmB4FlkhMt5osYXBbVCdOQeAVATb-oAYxa0,4495
|
|
19
19
|
lamindb_setup/_silence_loggers.py,sha256=AKF_YcHvX32eGXdsYK8MJlxEaZ-Uo2f6QDRzjKFCtws,1568
|
|
20
|
+
lamindb_setup/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
20
21
|
lamindb_setup/core/__init__.py,sha256=BxIVMX5HQq8oZ1OuY_saUEJz5Tdd7gaCPngxVu5iou4,417
|
|
21
22
|
lamindb_setup/core/_aws_options.py,sha256=BLLAtasJp7T0quMG7KgH8PmfHAn62izBwA7bYFwLV88,7748
|
|
22
23
|
lamindb_setup/core/_aws_storage.py,sha256=nEjeUv4xUVpoV0Lx-zjjmyb9w804bDyaeiM-OqbfwM0,1799
|
|
23
24
|
lamindb_setup/core/_deprecated.py,sha256=HN7iUBdEgahw5e4NHCd1VJooUfieNb6GRzS5x8jU-q8,2549
|
|
24
25
|
lamindb_setup/core/_docs.py,sha256=3k-YY-oVaJd_9UIY-LfBg_u8raKOCNfkZQPA73KsUhs,276
|
|
25
|
-
lamindb_setup/core/_hub_client.py,sha256=
|
|
26
|
-
lamindb_setup/core/_hub_core.py,sha256=
|
|
26
|
+
lamindb_setup/core/_hub_client.py,sha256=TD92DxeDC1mJvPuA8Y03DVKcAiLGr8uaddPiQ66KXm0,7788
|
|
27
|
+
lamindb_setup/core/_hub_core.py,sha256=iLzPWbTwlUxmaCMOnU2jFtRqSYvP05DDI5IM5hUZVN0,22560
|
|
27
28
|
lamindb_setup/core/_hub_crud.py,sha256=IAuPZes1am8OFwtcf5jSRQPGG1eKwVTEsp9Li-uq0cQ,5377
|
|
28
29
|
lamindb_setup/core/_hub_utils.py,sha256=6dyDGyzYFgVfR_lE3VN3CP1jGp98gxPtr-T91PAP05U,2687
|
|
29
30
|
lamindb_setup/core/_private_django_api.py,sha256=By63l3vIEtK1pq246FhHq3tslxsaTJGKm5VakYluWp4,2656
|
|
@@ -31,17 +32,17 @@ lamindb_setup/core/_settings.py,sha256=rpakpthAcvjOeAmldvZquml-7NJ8i44Hu_P8pJV_c
|
|
|
31
32
|
lamindb_setup/core/_settings_instance.py,sha256=ftHAFFbg_0iThuywuQM37RIiCQnMEOc1dftTig1_DZo,19382
|
|
32
33
|
lamindb_setup/core/_settings_load.py,sha256=adVwwEiwglrNNpZFgoP-EENZkzxZvKOzUr3z204pe94,4658
|
|
33
34
|
lamindb_setup/core/_settings_save.py,sha256=P04ZnWFSN4Qq_QFWXNvJDs4yxrY9CjQBol_BDku_JEw,3227
|
|
34
|
-
lamindb_setup/core/_settings_storage.py,sha256=
|
|
35
|
+
lamindb_setup/core/_settings_storage.py,sha256=mo7KyhRUbGx38m3ahFfsEKMhLUvXcHun7TE7Al2D0QE,14177
|
|
35
36
|
lamindb_setup/core/_settings_store.py,sha256=Qe5tsTtQO9TJ5jqr-VgiDs6MOkFrxO6y0kYEVveCN-I,2450
|
|
36
37
|
lamindb_setup/core/_settings_user.py,sha256=5hmnMu6fxrHAcwBEtIL0P9N8V4B0SjhzIdqFQ9o3Tsg,1476
|
|
37
38
|
lamindb_setup/core/_setup_bionty_sources.py,sha256=ox3X-SHiHa2lNPSWjwZhINypbLacX6kGwH6hVVrSFZc,1505
|
|
38
|
-
lamindb_setup/core/cloud_sqlite_locker.py,sha256=
|
|
39
|
+
lamindb_setup/core/cloud_sqlite_locker.py,sha256=UBpmWcFLPhxwSWIF98n461NUJSYAHVXhsYmk8LpUTQU,7288
|
|
39
40
|
lamindb_setup/core/django.py,sha256=6nKn_sokPqXqWE9EdRvhNzS5tjsMo3IZSfHiwTN_HcI,9348
|
|
40
41
|
lamindb_setup/core/exceptions.py,sha256=4NpLUNUIfXYVTFX2FvLZF8RW34exk2Vn2X3G4YhnTRg,276
|
|
41
42
|
lamindb_setup/core/hashing.py,sha256=M3Q1-ywnqh4Uy5zojbQfLju19HU0ySp8Oi7FGIJXfFI,3667
|
|
42
43
|
lamindb_setup/core/types.py,sha256=zJii2le38BJUmsNVvzDrbzGYr0yaeb-9Rw9IKmsBr3k,523
|
|
43
|
-
lamindb_setup/core/upath.py,sha256=
|
|
44
|
-
lamindb_setup-1.6.
|
|
45
|
-
lamindb_setup-1.6.
|
|
46
|
-
lamindb_setup-1.6.
|
|
47
|
-
lamindb_setup-1.6.
|
|
44
|
+
lamindb_setup/core/upath.py,sha256=5ECvPWBfgxqRuvr0oOpsmUHyXrMVmt5TTSqevh9CIwU,33889
|
|
45
|
+
lamindb_setup-1.6.1.dist-info/LICENSE,sha256=UOZ1F5fFDe3XXvG4oNnkL1-Ecun7zpHzRxjp-XsMeAo,11324
|
|
46
|
+
lamindb_setup-1.6.1.dist-info/WHEEL,sha256=CpUCUxeHQbRN5UGRQHYRJorO5Af-Qy_fHMctcQ8DSGI,82
|
|
47
|
+
lamindb_setup-1.6.1.dist-info/METADATA,sha256=O6yvdWQMBiPbQNx3Ly31rC_emPl29gDKwY8XasMeYWs,1792
|
|
48
|
+
lamindb_setup-1.6.1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|