lamindb_setup 1.7.1__tar.gz → 1.7.3__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.
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/PKG-INFO +1 -1
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/lamindb_setup/__init__.py +1 -1
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/lamindb_setup/_init_instance.py +4 -4
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/lamindb_setup/core/_hub_client.py +1 -1
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/lamindb_setup/core/_hub_core.py +10 -8
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/lamindb_setup/core/_settings.py +103 -7
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/lamindb_setup/core/_settings_instance.py +7 -7
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/lamindb_setup/core/_settings_user.py +2 -2
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/tests/hub-prod/test_global_settings.py +25 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/.github/workflows/build.yml +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/.github/workflows/doc-changes.yml +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/.gitignore +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/.pre-commit-config.yaml +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/LICENSE +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/README.md +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/docs/changelog.md +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/docs/hub-cloud/01-init-local-instance.ipynb +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/docs/hub-cloud/02-connect-local-instance.ipynb +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/docs/hub-cloud/03-add-managed-storage.ipynb +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/docs/hub-cloud/04-test-bionty.ipynb +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/docs/hub-cloud/05-init-hosted-instance.ipynb +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/docs/hub-cloud/06-connect-hosted-instance.ipynb +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/docs/hub-cloud/07-keep-artifacts-local.ipynb +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/docs/hub-cloud/08-test-multi-session.ipynb +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/docs/hub-cloud/test_notebooks.py +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/docs/hub-prod/test-cache-management.ipynb +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/docs/hub-prod/test-cloud-sync.ipynb +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/docs/hub-prod/test-connect-anonymously.ipynb +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/docs/hub-prod/test-empty-init.ipynb +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/docs/hub-prod/test-import-schema.ipynb +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/docs/hub-prod/test-init-load-local-anonymously.ipynb +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/docs/hub-prod/test-insufficient-user-info.ipynb +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/docs/hub-prod/test-invalid-schema.ipynb +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/docs/hub-prod/test-sqlite-lock.ipynb +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/docs/hub-prod/test_notebooks2.py +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/docs/index.md +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/docs/notebooks.md +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/docs/reference.md +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/lamindb_setup/_cache.py +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/lamindb_setup/_check.py +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/lamindb_setup/_check_setup.py +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/lamindb_setup/_connect_instance.py +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/lamindb_setup/_delete.py +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/lamindb_setup/_disconnect.py +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/lamindb_setup/_django.py +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/lamindb_setup/_entry_points.py +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/lamindb_setup/_exportdb.py +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/lamindb_setup/_importdb.py +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/lamindb_setup/_migrate.py +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/lamindb_setup/_register_instance.py +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/lamindb_setup/_schema.py +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/lamindb_setup/_schema_metadata.py +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/lamindb_setup/_set_managed_storage.py +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/lamindb_setup/_setup_user.py +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/lamindb_setup/_silence_loggers.py +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/lamindb_setup/core/__init__.py +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/lamindb_setup/core/_aws_options.py +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/lamindb_setup/core/_aws_storage.py +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/lamindb_setup/core/_deprecated.py +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/lamindb_setup/core/_docs.py +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/lamindb_setup/core/_hub_crud.py +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/lamindb_setup/core/_hub_utils.py +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/lamindb_setup/core/_private_django_api.py +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/lamindb_setup/core/_settings_load.py +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/lamindb_setup/core/_settings_save.py +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/lamindb_setup/core/_settings_storage.py +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/lamindb_setup/core/_settings_store.py +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/lamindb_setup/core/_setup_bionty_sources.py +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/lamindb_setup/core/cloud_sqlite_locker.py +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/lamindb_setup/core/django.py +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/lamindb_setup/core/exceptions.py +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/lamindb_setup/core/hashing.py +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/lamindb_setup/core/types.py +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/lamindb_setup/core/upath.py +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/lamindb_setup/errors.py +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/lamindb_setup/py.typed +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/lamindb_setup/types.py +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/noxfile.py +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/pyproject.toml +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/tests/hub-cloud/scripts/script-init-pass-user-no-writes.py +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/tests/hub-cloud/scripts/script-to-fail-managed-storage.py +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/tests/hub-cloud/test_connect_instance.py +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/tests/hub-cloud/test_delete_instance.py +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/tests/hub-cloud/test_edge_request.py +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/tests/hub-cloud/test_fail_managed_storage.py +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/tests/hub-cloud/test_init_instance.py +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/tests/hub-cloud/test_init_pass_user_no_writes.py +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/tests/hub-cloud/test_login.py +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/tests/hub-cloud/test_migrate.py +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/tests/hub-cloud/test_set_storage.py +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/tests/hub-local/conftest.py +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/tests/hub-local/scripts/script-connect-fine-grained-access.py +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/tests/hub-local/test_all.py +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/tests/hub-local/test_update_schema_in_hub.py +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/tests/hub-prod/conftest.py +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/tests/hub-prod/test_aws_options_manager.py +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/tests/hub-prod/test_django.py +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/tests/hub-prod/test_switch_and_fallback_env.py +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/tests/hub-prod/test_upath.py +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/tests/storage/test_entry_point.py +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/tests/storage/test_hashing.py +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/tests/storage/test_storage_access.py +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/tests/storage/test_storage_basis.py +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/tests/storage/test_storage_settings.py +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/tests/storage/test_storage_stats.py +0 -0
- {lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/tests/storage/test_to_url.py +0 -0
|
@@ -98,24 +98,24 @@ def register_initial_records(isettings: InstanceSettings, usettings: UserSetting
|
|
|
98
98
|
|
|
99
99
|
try:
|
|
100
100
|
Space.objects.get_or_create(
|
|
101
|
-
uid="a",
|
|
101
|
+
uid=12 * "a",
|
|
102
102
|
name="all",
|
|
103
103
|
description="Every team & user with access to the instance has access.",
|
|
104
104
|
)
|
|
105
105
|
Branch.objects.get_or_create(
|
|
106
106
|
id=-1,
|
|
107
|
-
uid="t",
|
|
107
|
+
uid=12 * "t",
|
|
108
108
|
name="trash",
|
|
109
109
|
description="The trash.",
|
|
110
110
|
)
|
|
111
111
|
Branch.objects.get_or_create(
|
|
112
112
|
id=0,
|
|
113
|
-
uid="a",
|
|
113
|
+
uid=12 * "a",
|
|
114
114
|
name="archive",
|
|
115
115
|
description="The archive.",
|
|
116
116
|
)
|
|
117
117
|
Branch.objects.get_or_create(
|
|
118
|
-
uid="m",
|
|
118
|
+
uid=12 * "m",
|
|
119
119
|
name="main",
|
|
120
120
|
description="The main & default branch of the instance.",
|
|
121
121
|
)
|
|
@@ -70,7 +70,7 @@ def connect_hub(
|
|
|
70
70
|
# increase to avoid rare timeouts for edge functions
|
|
71
71
|
client_options = ClientOptions(
|
|
72
72
|
auto_refresh_token=False,
|
|
73
|
-
function_client_timeout=
|
|
73
|
+
function_client_timeout=30,
|
|
74
74
|
postgrest_client_timeout=20,
|
|
75
75
|
)
|
|
76
76
|
return create_client(env.supabase_api_url, env.supabase_anon_key, client_options)
|
|
@@ -380,14 +380,16 @@ def _connect_instance_hub(
|
|
|
380
380
|
.data
|
|
381
381
|
)
|
|
382
382
|
if len(data) != 0 and (instance_data := data[0]["instance"]) is not None:
|
|
383
|
-
new_name = instance_data["name"]
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
383
|
+
new_name = instance_data["name"]
|
|
384
|
+
# the instance was renamed
|
|
385
|
+
if new_name != name:
|
|
386
|
+
logger.warning(
|
|
387
|
+
f"'{owner}/{name}' was renamed, please use '{owner}/{new_name}'"
|
|
388
|
+
)
|
|
389
|
+
response = client.functions.invoke(
|
|
390
|
+
"get-instance-settings-v1",
|
|
391
|
+
invoke_options={"body": {"owner": owner, "name": new_name}},
|
|
392
|
+
)
|
|
391
393
|
# no instance found, check why is that
|
|
392
394
|
if response == b"{}":
|
|
393
395
|
# try the via single requests, will take more time
|
|
@@ -22,6 +22,8 @@ from .upath import LocalPathClasses, UPath
|
|
|
22
22
|
if TYPE_CHECKING:
|
|
23
23
|
from pathlib import Path
|
|
24
24
|
|
|
25
|
+
from lamindb.models import Branch, Space
|
|
26
|
+
|
|
25
27
|
from lamindb_setup.core import InstanceSettings, StorageSettings, UserSettings
|
|
26
28
|
from lamindb_setup.types import UPathStr
|
|
27
29
|
|
|
@@ -91,6 +93,94 @@ class SetupSettings:
|
|
|
91
93
|
else:
|
|
92
94
|
self._auto_connect_path.unlink(missing_ok=True)
|
|
93
95
|
|
|
96
|
+
@property
|
|
97
|
+
def _branch_path(self) -> Path:
|
|
98
|
+
return (
|
|
99
|
+
settings_dir
|
|
100
|
+
/ f"current-branch--{self.instance.owner}--{self.instance.name}.txt"
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
def _read_branch_idlike_name(self) -> tuple[int | str, str]:
|
|
104
|
+
idlike: str | int = 1
|
|
105
|
+
name: str = "main"
|
|
106
|
+
try:
|
|
107
|
+
branch_path = self._branch_path
|
|
108
|
+
except SystemExit: # in case no instance setup
|
|
109
|
+
return idlike, name
|
|
110
|
+
if branch_path.exists():
|
|
111
|
+
idlike, name = branch_path.read_text().split("\n")
|
|
112
|
+
return idlike, name
|
|
113
|
+
|
|
114
|
+
@property
|
|
115
|
+
def branch(self) -> Branch:
|
|
116
|
+
"""Default branch."""
|
|
117
|
+
from lamindb import Branch
|
|
118
|
+
|
|
119
|
+
idlike, _ = self._read_branch_idlike_name()
|
|
120
|
+
return Branch.get(idlike)
|
|
121
|
+
|
|
122
|
+
@branch.setter
|
|
123
|
+
def branch(self, value: str | Branch) -> None:
|
|
124
|
+
from lamindb import Branch, Q
|
|
125
|
+
from lamindb.errors import DoesNotExist
|
|
126
|
+
|
|
127
|
+
if isinstance(value, Branch):
|
|
128
|
+
assert value._state.adding is False, "Branch must be saved"
|
|
129
|
+
branch_record = value
|
|
130
|
+
else:
|
|
131
|
+
branch_record = Branch.filter(Q(name=value) | Q(uid=value)).one_or_none()
|
|
132
|
+
if branch_record is None:
|
|
133
|
+
raise DoesNotExist(
|
|
134
|
+
f"Branch '{value}', please check on the hub UI whether you have the correct `uid` or `name`."
|
|
135
|
+
)
|
|
136
|
+
# we are sure that the current instance is setup because
|
|
137
|
+
# it will error on lamindb import otherwise
|
|
138
|
+
self._branch_path.write_text(f"{branch_record.uid}\n{branch_record.name}")
|
|
139
|
+
|
|
140
|
+
@property
|
|
141
|
+
def _space_path(self) -> Path:
|
|
142
|
+
return (
|
|
143
|
+
settings_dir
|
|
144
|
+
/ f"current-space--{self.instance.owner}--{self.instance.name}.txt"
|
|
145
|
+
)
|
|
146
|
+
|
|
147
|
+
def _read_space_idlike_name(self) -> tuple[int | str, str]:
|
|
148
|
+
idlike: str | int = 1
|
|
149
|
+
name: str = "all"
|
|
150
|
+
try:
|
|
151
|
+
space_path = self._space_path
|
|
152
|
+
except SystemExit: # in case no instance setup
|
|
153
|
+
return idlike, name
|
|
154
|
+
if space_path.exists():
|
|
155
|
+
idlike, name = space_path.read_text().split("\n")
|
|
156
|
+
return idlike, name
|
|
157
|
+
|
|
158
|
+
@property
|
|
159
|
+
def space(self) -> Space:
|
|
160
|
+
"""Default space."""
|
|
161
|
+
from lamindb import Space
|
|
162
|
+
|
|
163
|
+
idlike, _ = self._read_space_idlike_name()
|
|
164
|
+
return Space.get(idlike)
|
|
165
|
+
|
|
166
|
+
@space.setter
|
|
167
|
+
def space(self, value: str | Space) -> None:
|
|
168
|
+
from lamindb import Q, Space
|
|
169
|
+
from lamindb.errors import DoesNotExist
|
|
170
|
+
|
|
171
|
+
if isinstance(value, Space):
|
|
172
|
+
assert value._state.adding is False, "Space must be saved"
|
|
173
|
+
space_record = value
|
|
174
|
+
else:
|
|
175
|
+
space_record = Space.filter(Q(name=value) | Q(uid=value)).one_or_none()
|
|
176
|
+
if space_record is None:
|
|
177
|
+
raise DoesNotExist(
|
|
178
|
+
f"Space '{value}', please check on the hub UI whether you have the correct `uid` or `name`."
|
|
179
|
+
)
|
|
180
|
+
# we are sure that the current instance is setup because
|
|
181
|
+
# it will error on lamindb import otherwise
|
|
182
|
+
self._space_path.write_text(f"{space_record.uid}\n{space_record.name}")
|
|
183
|
+
|
|
94
184
|
@property
|
|
95
185
|
def is_connected(self) -> bool:
|
|
96
186
|
"""Determine whether the current instance is fully connected and ready to use.
|
|
@@ -205,16 +295,22 @@ class SetupSettings:
|
|
|
205
295
|
# do not show current setting representation when building docs
|
|
206
296
|
if "sphinx" in sys.modules:
|
|
207
297
|
return object.__repr__(self)
|
|
208
|
-
repr =
|
|
209
|
-
repr += f"Private Django API: {self.private_django_api}\n"
|
|
210
|
-
repr += f"Cache directory: {self.cache_dir.as_posix()}\n"
|
|
211
|
-
repr += f"User settings directory: {settings_dir.as_posix()}\n"
|
|
212
|
-
repr += f"System settings directory: {system_settings_dir.as_posix()}\n"
|
|
213
|
-
repr += self.user.__repr__() + "\n"
|
|
298
|
+
repr = ""
|
|
214
299
|
if self._instance_exists:
|
|
300
|
+
repr += "Current branch & space:\n"
|
|
301
|
+
repr += f" - branch: {self._read_branch_idlike_name()[1]}\n"
|
|
302
|
+
repr += f" - space: {self._read_space_idlike_name()[1]}\n"
|
|
215
303
|
repr += self.instance.__repr__()
|
|
216
304
|
else:
|
|
217
|
-
repr += "
|
|
305
|
+
repr += "Current instance: None"
|
|
306
|
+
repr += "\nConfig:\n"
|
|
307
|
+
repr += f" - auto-connect in Python: {self.auto_connect}\n"
|
|
308
|
+
repr += f" - private Django API: {self.private_django_api}\n"
|
|
309
|
+
repr += "Local directories:\n"
|
|
310
|
+
repr += f" - cache: {self.cache_dir.as_posix()}\n"
|
|
311
|
+
repr += f" - user settings: {settings_dir.as_posix()}\n"
|
|
312
|
+
repr += f" - system settings: {system_settings_dir.as_posix()}\n"
|
|
313
|
+
repr += self.user.__repr__()
|
|
218
314
|
return repr
|
|
219
315
|
|
|
220
316
|
|
|
@@ -97,13 +97,13 @@ class InstanceSettings:
|
|
|
97
97
|
|
|
98
98
|
def __repr__(self):
|
|
99
99
|
"""Rich string representation."""
|
|
100
|
-
representation =
|
|
101
|
-
attrs = ["
|
|
100
|
+
representation = "Current instance:"
|
|
101
|
+
attrs = ["slug", "storage", "db", "modules", "git_repo"]
|
|
102
102
|
for attr in attrs:
|
|
103
103
|
value = getattr(self, attr)
|
|
104
104
|
if attr == "storage":
|
|
105
|
-
representation += f"\n- storage root: {value.root_as_str}"
|
|
106
|
-
representation += f"\n- storage region: {value.region}"
|
|
105
|
+
representation += f"\n - storage root: {value.root_as_str}"
|
|
106
|
+
representation += f"\n - storage region: {value.region}"
|
|
107
107
|
elif attr == "db":
|
|
108
108
|
if self.dialect != "sqlite":
|
|
109
109
|
model = LaminDsnModel(db=value)
|
|
@@ -117,11 +117,11 @@ class InstanceSettings:
|
|
|
117
117
|
)
|
|
118
118
|
else:
|
|
119
119
|
db_print = value
|
|
120
|
-
representation += f"\n- {attr}: {db_print}"
|
|
120
|
+
representation += f"\n - {attr}: {db_print}"
|
|
121
121
|
elif attr == "modules":
|
|
122
|
-
representation += f"\n- {attr}: {value if value else '{}'}"
|
|
122
|
+
representation += f"\n - {attr}: {value if value else '{}'}"
|
|
123
123
|
else:
|
|
124
|
-
representation += f"\n- {attr}: {value}"
|
|
124
|
+
representation += f"\n - {attr}: {value}"
|
|
125
125
|
return representation
|
|
126
126
|
|
|
127
127
|
@property
|
|
@@ -38,11 +38,11 @@ class UserSettings:
|
|
|
38
38
|
|
|
39
39
|
def __repr__(self) -> str:
|
|
40
40
|
"""Rich string representation."""
|
|
41
|
-
representation =
|
|
41
|
+
representation = "Current user:"
|
|
42
42
|
attrs = ["handle", "email", "uid"]
|
|
43
43
|
for attr in attrs:
|
|
44
44
|
value = getattr(self, attr)
|
|
45
|
-
representation += f"\n- {attr}: {value}"
|
|
45
|
+
representation += f"\n - {attr}: {value}"
|
|
46
46
|
return representation
|
|
47
47
|
|
|
48
48
|
@property
|
|
@@ -4,6 +4,7 @@ import subprocess
|
|
|
4
4
|
from pathlib import Path
|
|
5
5
|
|
|
6
6
|
import lamindb_setup as ln_setup
|
|
7
|
+
import pytest
|
|
7
8
|
from lamindb_setup.core.hashing import hash_dir
|
|
8
9
|
|
|
9
10
|
|
|
@@ -16,6 +17,30 @@ def test_auto_connect():
|
|
|
16
17
|
ln_setup.settings.auto_connect = current_state
|
|
17
18
|
|
|
18
19
|
|
|
20
|
+
def test_branch():
|
|
21
|
+
import lamindb as ln
|
|
22
|
+
|
|
23
|
+
ln_setup.settings._branch_path.unlink(missing_ok=True)
|
|
24
|
+
assert ln_setup.settings.branch.uid == 12 * "m"
|
|
25
|
+
ln_setup.settings.branch = "archive"
|
|
26
|
+
assert ln_setup.settings._branch_path.read_text() == f"{12 * 'a'}\narchive"
|
|
27
|
+
ln_setup.settings.branch = "main"
|
|
28
|
+
assert ln_setup.settings._branch_path.read_text() == f"{12 * 'm'}\nmain"
|
|
29
|
+
with pytest.raises(ln.errors.DoesNotExist):
|
|
30
|
+
ln_setup.settings.branch = "not_exists"
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
def test_space():
|
|
34
|
+
import lamindb as ln
|
|
35
|
+
|
|
36
|
+
ln_setup.settings._space_path.unlink(missing_ok=True)
|
|
37
|
+
assert ln_setup.settings.space.uid == 12 * "a"
|
|
38
|
+
ln_setup.settings.space = "all"
|
|
39
|
+
assert ln_setup.settings._space_path.read_text() == f"{12 * 'a'}\nall"
|
|
40
|
+
with pytest.raises(ln.errors.DoesNotExist):
|
|
41
|
+
ln_setup.settings.space = "not_exists"
|
|
42
|
+
|
|
43
|
+
|
|
19
44
|
def test_private_django_api():
|
|
20
45
|
from django import db
|
|
21
46
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/docs/hub-prod/test-init-load-local-anonymously.ipynb
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{lamindb_setup-1.7.1 → lamindb_setup-1.7.3}/tests/hub-cloud/test_init_pass_user_no_writes.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|