lamindb_setup 1.13.1__py3-none-any.whl → 1.14.0__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 +18 -18
- lamindb_setup/core/__init__.py +6 -11
- lamindb_setup/core/_hub_core.py +7 -2
- lamindb_setup/core/_settings.py +30 -0
- lamindb_setup/core/upath.py +17 -12
- lamindb_setup/errors.py +8 -11
- lamindb_setup/types.py +2 -5
- {lamindb_setup-1.13.1.dist-info → lamindb_setup-1.14.0.dist-info}/METADATA +1 -1
- {lamindb_setup-1.13.1.dist-info → lamindb_setup-1.14.0.dist-info}/RECORD +11 -11
- {lamindb_setup-1.13.1.dist-info → lamindb_setup-1.14.0.dist-info}/LICENSE +0 -0
- {lamindb_setup-1.13.1.dist-info → lamindb_setup-1.14.0.dist-info}/WHEEL +0 -0
lamindb_setup/__init__.py
CHANGED
|
@@ -4,25 +4,17 @@ Many functions in this "setup API" have a matching command in the :doc:`docs:cli
|
|
|
4
4
|
|
|
5
5
|
Guide: :doc:`docs:setup`.
|
|
6
6
|
|
|
7
|
-
Basic operations
|
|
7
|
+
Basic operations
|
|
8
|
+
----------------
|
|
8
9
|
|
|
9
|
-
..
|
|
10
|
-
|
|
10
|
+
.. autofunction:: login
|
|
11
|
+
.. autofunction:: logout
|
|
12
|
+
.. autofunction:: init
|
|
13
|
+
.. autofunction:: disconnect
|
|
14
|
+
.. autofunction:: delete
|
|
11
15
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
init
|
|
15
|
-
disconnect
|
|
16
|
-
delete
|
|
17
|
-
|
|
18
|
-
Instance operations:
|
|
19
|
-
|
|
20
|
-
.. autosummary::
|
|
21
|
-
:toctree:
|
|
22
|
-
|
|
23
|
-
migrate
|
|
24
|
-
|
|
25
|
-
Modules & settings:
|
|
16
|
+
Modules & settings
|
|
17
|
+
------------------
|
|
26
18
|
|
|
27
19
|
.. autosummary::
|
|
28
20
|
:toctree:
|
|
@@ -33,9 +25,17 @@ Modules & settings:
|
|
|
33
25
|
errors
|
|
34
26
|
types
|
|
35
27
|
|
|
28
|
+
Migration management
|
|
29
|
+
--------------------
|
|
30
|
+
|
|
31
|
+
.. autosummary::
|
|
32
|
+
:toctree:
|
|
33
|
+
|
|
34
|
+
migrate
|
|
35
|
+
|
|
36
36
|
"""
|
|
37
37
|
|
|
38
|
-
__version__ = "1.
|
|
38
|
+
__version__ = "1.14.0" # denote a release candidate for 0.1.0 with 0.1rc1
|
|
39
39
|
|
|
40
40
|
import os
|
|
41
41
|
import warnings
|
lamindb_setup/core/__init__.py
CHANGED
|
@@ -1,21 +1,16 @@
|
|
|
1
1
|
"""Core setup library.
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
..
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
SetupSettings
|
|
9
|
-
UserSettings
|
|
10
|
-
InstanceSettings
|
|
11
|
-
StorageSettings
|
|
3
|
+
.. autoclass:: SetupSettings
|
|
4
|
+
.. autoclass:: UserSettings
|
|
5
|
+
.. autoclass:: InstanceSettings
|
|
6
|
+
.. autoclass:: StorageSettings
|
|
12
7
|
|
|
13
8
|
"""
|
|
14
9
|
|
|
15
10
|
from . import django, upath
|
|
16
11
|
from ._clone import connect_local_sqlite, init_local_sqlite
|
|
17
|
-
from ._deprecated import deprecated
|
|
18
|
-
from ._docs import doc_args
|
|
12
|
+
from ._deprecated import deprecated # documented in lamindb.base
|
|
13
|
+
from ._docs import doc_args # documented in lamindb.base
|
|
19
14
|
from ._settings import SetupSettings
|
|
20
15
|
from ._settings_instance import InstanceSettings
|
|
21
16
|
from ._settings_storage import StorageSettings
|
lamindb_setup/core/_hub_core.py
CHANGED
|
@@ -551,6 +551,9 @@ def _connect_instance_hub(
|
|
|
551
551
|
db_user["password" if fine_grained_access else "db_user_password"],
|
|
552
552
|
)
|
|
553
553
|
|
|
554
|
+
db_user_name = "none" if db_user_name is None else db_user_name
|
|
555
|
+
db_user_password = "none" if db_user_password is None else db_user_password
|
|
556
|
+
|
|
554
557
|
if use_proxy_db:
|
|
555
558
|
host = instance.get("proxy_host", None)
|
|
556
559
|
assert host is not None, (
|
|
@@ -560,14 +563,16 @@ def _connect_instance_hub(
|
|
|
560
563
|
assert port is not None, (
|
|
561
564
|
"Database proxy port is not available, please do not pass 'use_proxy_db'."
|
|
562
565
|
)
|
|
566
|
+
# remove supabase project id if present
|
|
567
|
+
db_user_name = db_user_name.rsplit(".", 1)[0]
|
|
563
568
|
else:
|
|
564
569
|
host = instance["db_host"]
|
|
565
570
|
port = instance["db_port"]
|
|
566
571
|
|
|
567
572
|
db_dsn = LaminDsn.build(
|
|
568
573
|
scheme=instance["db_scheme"],
|
|
569
|
-
user=db_user_name
|
|
570
|
-
password=db_user_password
|
|
574
|
+
user=db_user_name,
|
|
575
|
+
password=db_user_password,
|
|
571
576
|
host=host,
|
|
572
577
|
port=port,
|
|
573
578
|
database=instance["db_database"],
|
lamindb_setup/core/_settings.py
CHANGED
|
@@ -5,6 +5,7 @@ import sys
|
|
|
5
5
|
from pathlib import Path
|
|
6
6
|
from typing import TYPE_CHECKING
|
|
7
7
|
|
|
8
|
+
import jwt
|
|
8
9
|
from lamin_utils import logger
|
|
9
10
|
from platformdirs import user_cache_dir
|
|
10
11
|
|
|
@@ -319,6 +320,35 @@ class SetupSettings:
|
|
|
319
320
|
"""
|
|
320
321
|
return SetupPaths
|
|
321
322
|
|
|
323
|
+
def _debug_db_access(self):
|
|
324
|
+
"""Debug database access problems."""
|
|
325
|
+
instance = self.instance
|
|
326
|
+
db_permissions = instance._db_permissions
|
|
327
|
+
print("db connection: ", instance.db)
|
|
328
|
+
print("db permissions: ", db_permissions)
|
|
329
|
+
if db_permissions != "jwt":
|
|
330
|
+
return
|
|
331
|
+
# sets the token if not present yet
|
|
332
|
+
print("available spaces: ", instance.available_spaces)
|
|
333
|
+
|
|
334
|
+
from lamindb_setup.core.django import db_token_manager
|
|
335
|
+
|
|
336
|
+
tokens = db_token_manager.tokens
|
|
337
|
+
if tokens:
|
|
338
|
+
for conn, token in tokens.items():
|
|
339
|
+
token_encoded = token._token
|
|
340
|
+
if token_encoded is None:
|
|
341
|
+
token._refresh_token()
|
|
342
|
+
token_encoded = token._token
|
|
343
|
+
token_decoded = jwt.decode(
|
|
344
|
+
token_encoded, options={"verify_signature": False}
|
|
345
|
+
)
|
|
346
|
+
print(
|
|
347
|
+
f"db token for the connection '{conn}' is '{token_encoded}': {token_decoded}"
|
|
348
|
+
)
|
|
349
|
+
else:
|
|
350
|
+
print("no db tokens are present")
|
|
351
|
+
|
|
322
352
|
def __repr__(self) -> str:
|
|
323
353
|
"""Rich string representation."""
|
|
324
354
|
from lamin_utils import colors
|
lamindb_setup/core/upath.py
CHANGED
|
@@ -737,25 +737,30 @@ UPath.exists.__doc__ = Path.exists.__doc__
|
|
|
737
737
|
UPath.is_dir.__doc__ = Path.is_dir.__doc__
|
|
738
738
|
UPath.is_file.__doc__ = Path.is_file.__doc__
|
|
739
739
|
UPath.unlink.__doc__ = Path.unlink.__doc__
|
|
740
|
-
UPath.rename.__doc__ = """Move file, see fsspec.AbstractFileSystem.mv
|
|
740
|
+
UPath.rename.__doc__ = """Move file, see `fsspec.AbstractFileSystem.mv`.
|
|
741
741
|
|
|
742
|
-
|
|
743
|
-
>>> upath.rename(UPath("s3://my-bucket/my-file-renamed"))
|
|
744
|
-
>>> upath.rename("my-file-renamed")
|
|
742
|
+
For example::
|
|
745
743
|
|
|
746
|
-
|
|
747
|
-
|
|
744
|
+
upath = UPath("s3://my-bucket/my-file")
|
|
745
|
+
upath.rename(UPath("s3://my-bucket/my-file-renamed"))
|
|
746
|
+
upath.rename("my-file-renamed")
|
|
748
747
|
"""
|
|
749
|
-
UPath.__doc__ = """Paths: low-level key-value access to files
|
|
748
|
+
UPath.__doc__ = """Paths: low-level key-value access to files.
|
|
750
749
|
|
|
751
|
-
|
|
752
|
-
and object stores.
|
|
750
|
+
Offers the typical access patterns of file systems and object stores, for instance::
|
|
753
751
|
|
|
754
|
-
|
|
755
|
-
|
|
752
|
+
upath = UPath("s3://my-bucket/my-folder/my-file.txt")
|
|
753
|
+
upath.exists() # file exists in storage
|
|
754
|
+
|
|
755
|
+
LaminDB exposes `universal_pathlib.UPath` and adds functionality related to authentication and the following methods::
|
|
756
|
+
|
|
757
|
+
upath.view_tree() # view a file tree
|
|
758
|
+
upath.upload_from("local-file.txt") # upload a local file
|
|
759
|
+
upath.download_to("local-file.txt") # download a file
|
|
760
|
+
upath.synchronize_to("local-folder/") # synchronize a folder
|
|
756
761
|
|
|
757
762
|
Args:
|
|
758
|
-
pathlike: A string or Path to a local
|
|
763
|
+
pathlike: A string or `Path` to a local or cloud file/directory/folder.
|
|
759
764
|
"""
|
|
760
765
|
|
|
761
766
|
logger.debug("upath.UPath has been patched")
|
lamindb_setup/errors.py
CHANGED
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
"""Errors.
|
|
2
2
|
|
|
3
|
-
..
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
InstanceLockedException
|
|
12
|
-
SettingsEnvFileOutdated
|
|
13
|
-
CannotSwitchDefaultInstance
|
|
3
|
+
.. autoexception:: CurrentInstanceNotConfigured
|
|
4
|
+
.. autoexception:: InstanceNotSetupError
|
|
5
|
+
.. autoexception:: ModuleWasntConfigured
|
|
6
|
+
.. autoexception:: StorageAlreadyManaged
|
|
7
|
+
.. autoexception:: StorageNotEmpty
|
|
8
|
+
.. autoexception:: InstanceLockedException
|
|
9
|
+
.. autoexception:: SettingsEnvFileOutdated
|
|
10
|
+
.. autoexception:: CannotSwitchDefaultInstance
|
|
14
11
|
|
|
15
12
|
"""
|
|
16
13
|
|
lamindb_setup/types.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
lamindb_setup/__init__.py,sha256=
|
|
1
|
+
lamindb_setup/__init__.py,sha256=sxtG8b-Ej77NblAXc9qHKSUFtAnWUSSzNsDtUCwxjTY,3211
|
|
2
2
|
lamindb_setup/_cache.py,sha256=pGvDNVHGx4HWr_6w5ajqEJOdysmaGc6F221qFnXkT-k,2747
|
|
3
3
|
lamindb_setup/_check.py,sha256=28PcG8Kp6OpjSLSi1r2boL2Ryeh6xkaCL87HFbjs6GA,129
|
|
4
4
|
lamindb_setup/_check_setup.py,sha256=ToKMxsUq8dQBQh8baOrNVlSb1iC8h4zTg5dV8wMu0W4,6760
|
|
@@ -17,21 +17,21 @@ lamindb_setup/_schema_metadata.py,sha256=af1Es7qFKGPRdNmk48384HiB2r-cDTdBPu0wB9q
|
|
|
17
17
|
lamindb_setup/_set_managed_storage.py,sha256=y5YQASsWNYVWUYeLgh3N2YBETYP7mBtbpxe3X_Vgb5I,2699
|
|
18
18
|
lamindb_setup/_setup_user.py,sha256=DapdzT3u0f5LN5W9W9A6PWw-n8ejcJciQtHN9b5lidA,5889
|
|
19
19
|
lamindb_setup/_silence_loggers.py,sha256=AKF_YcHvX32eGXdsYK8MJlxEaZ-Uo2f6QDRzjKFCtws,1568
|
|
20
|
-
lamindb_setup/errors.py,sha256=
|
|
20
|
+
lamindb_setup/errors.py,sha256=lccF3X3M2mcbHVG_0HxfuJRFFpUE-42paccIxFOfefQ,1958
|
|
21
21
|
lamindb_setup/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
22
|
-
lamindb_setup/types.py,sha256=
|
|
23
|
-
lamindb_setup/core/__init__.py,sha256=
|
|
22
|
+
lamindb_setup/types.py,sha256=fuQxZJnrGYe7a_Ju9n1RqO-HhkOAr1l1xjpAg9dmBu8,605
|
|
23
|
+
lamindb_setup/core/__init__.py,sha256=z3Gy27SfnbO1gUMi-fVrL0yeLzUQ4K14vHOpw10hENo,536
|
|
24
24
|
lamindb_setup/core/_aws_options.py,sha256=NtDLfR2BIz3MiR4rGrBu4uW70MFy2p3hjxCnN1sGDB8,9414
|
|
25
25
|
lamindb_setup/core/_aws_storage.py,sha256=QEtV-riQrwfivcwqHnXBbkJ-9YyNEXL4fLoCmOHZ1BI,2003
|
|
26
26
|
lamindb_setup/core/_clone.py,sha256=2NlXV04yykqg_k7z59C_kD1F1Hi4H-55H-JtNjhenQ0,3691
|
|
27
27
|
lamindb_setup/core/_deprecated.py,sha256=M3vpM4fZPOncxY2qsXQAPeaEph28xWdv7tYaueaUyAA,2554
|
|
28
28
|
lamindb_setup/core/_docs.py,sha256=3k-YY-oVaJd_9UIY-LfBg_u8raKOCNfkZQPA73KsUhs,276
|
|
29
29
|
lamindb_setup/core/_hub_client.py,sha256=J0x43at0zb0yWP-RoT2lyqaHV66ewUP3OiYVYQCjxe8,9974
|
|
30
|
-
lamindb_setup/core/_hub_core.py,sha256=
|
|
30
|
+
lamindb_setup/core/_hub_core.py,sha256=GAQK5XkHROIuqA-H8sOQZVlxvN4QIH_cmHY0TENnq2U,29090
|
|
31
31
|
lamindb_setup/core/_hub_crud.py,sha256=j6516H82kLjFUNPqFGUINbDw9YbofMgjxadGzYb0OS4,6362
|
|
32
32
|
lamindb_setup/core/_hub_utils.py,sha256=6dyDGyzYFgVfR_lE3VN3CP1jGp98gxPtr-T91PAP05U,2687
|
|
33
33
|
lamindb_setup/core/_private_django_api.py,sha256=By63l3vIEtK1pq246FhHq3tslxsaTJGKm5VakYluWp4,2656
|
|
34
|
-
lamindb_setup/core/_settings.py,sha256=
|
|
34
|
+
lamindb_setup/core/_settings.py,sha256=FRHqCVmKjSqH4Y-33-LHUY9fLx6fEe88gXYUtiyqvmU,15289
|
|
35
35
|
lamindb_setup/core/_settings_instance.py,sha256=7VXd1W88fgqEnAfzFQKUlDnTr3pmA_e8aIag7FqPrJI,23899
|
|
36
36
|
lamindb_setup/core/_settings_load.py,sha256=j20cy3J56ZBHLDfB2A8oKjekNetMNsy0_W3eWD36pWI,5161
|
|
37
37
|
lamindb_setup/core/_settings_save.py,sha256=jh412jXIAbIYvnSoW9riBFePRAa4vmPm-ScYD0smlnw,3292
|
|
@@ -44,8 +44,8 @@ lamindb_setup/core/django.py,sha256=2HwhtfUEX4peSkczc0VSfA-CpfCGL4vNgkPe9Pwu5kw,
|
|
|
44
44
|
lamindb_setup/core/exceptions.py,sha256=qjMzqy_uzPA7mCOdnoWnS_fdA6OWbdZGftz-YYplrY0,84
|
|
45
45
|
lamindb_setup/core/hashing.py,sha256=Y8Uc5uSGTfU6L2R_gb5w8DdHhGRog7RnkK-e9FEMjPY,3680
|
|
46
46
|
lamindb_setup/core/types.py,sha256=T7NwspfRHgIIpYsXDcApks8jkOlGeGRW-YbVLB7jNIo,67
|
|
47
|
-
lamindb_setup/core/upath.py,sha256=
|
|
48
|
-
lamindb_setup-1.
|
|
49
|
-
lamindb_setup-1.
|
|
50
|
-
lamindb_setup-1.
|
|
51
|
-
lamindb_setup-1.
|
|
47
|
+
lamindb_setup/core/upath.py,sha256=bi3k8AYeiGB_NtVTO9e9gHsfs2AFB4fXiVHcbNpnlpI,35780
|
|
48
|
+
lamindb_setup-1.14.0.dist-info/LICENSE,sha256=UOZ1F5fFDe3XXvG4oNnkL1-Ecun7zpHzRxjp-XsMeAo,11324
|
|
49
|
+
lamindb_setup-1.14.0.dist-info/WHEEL,sha256=CpUCUxeHQbRN5UGRQHYRJorO5Af-Qy_fHMctcQ8DSGI,82
|
|
50
|
+
lamindb_setup-1.14.0.dist-info/METADATA,sha256=r0iCqy4CfmQ5hL_EExFqA32kGvZ3Rq8oQYZ7PcBjAEU,1798
|
|
51
|
+
lamindb_setup-1.14.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|