lamindb_setup 1.8.2__py3-none-any.whl → 1.8.3__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 CHANGED
@@ -35,7 +35,7 @@ Modules & settings:
35
35
 
36
36
  """
37
37
 
38
- __version__ = "1.8.2" # denote a release candidate for 0.1.0 with 0.1rc1
38
+ __version__ = "1.8.3" # denote a release candidate for 0.1.0 with 0.1rc1
39
39
 
40
40
  import os
41
41
 
@@ -147,6 +147,9 @@ def _check_instance_setup(from_module: str | None = None) -> bool:
147
147
  else:
148
148
  django_lamin.setup_django(isettings)
149
149
  logger.important(f"connected lamindb: {isettings.slug}")
150
+ settings._instance_settings = (
151
+ isettings # update of local storage location
152
+ )
150
153
  return django_lamin.IS_SETUP
151
154
  else:
152
155
  if from_module is not None and settings.auto_connect:
@@ -172,11 +172,7 @@ class AWSOptionsManager:
172
172
  from ._hub_core import access_aws
173
173
  from ._settings import settings
174
174
 
175
- if settings.user.handle != "anonymous" or access_token is not None:
176
- storage_root_info = access_aws(path_str, access_token=access_token)
177
- else:
178
- storage_root_info = {"credentials": {}, "accessibility": {}}
179
-
175
+ storage_root_info = access_aws(path_str, access_token=access_token)
180
176
  accessibility = storage_root_info["accessibility"]
181
177
  is_managed = accessibility.get("is_managed", False)
182
178
  if is_managed:
@@ -460,9 +460,9 @@ def access_aws(storage_root: str, access_token: str | None = None) -> dict[str,
460
460
  storage_root_info = call_with_fallback_auth(
461
461
  _access_aws, storage_root=storage_root, access_token=access_token
462
462
  )
463
- return storage_root_info
464
463
  else:
465
- raise RuntimeError("Can only get access to AWS if authenticated.")
464
+ storage_root_info = call_with_fallback(_access_aws, storage_root=storage_root)
465
+ return storage_root_info
466
466
 
467
467
 
468
468
  def _access_aws(*, storage_root: str, client: Client) -> dict[str, dict]:
@@ -497,8 +497,8 @@ def access_db(
497
497
  instance_slug: str
498
498
  instance_api_url: str | None
499
499
  if (
500
- "LAMIN_TEST_DB_TOKEN" in os.environ
501
- and (env_db_token := os.environ["LAMIN_TEST_DB_TOKEN"]) != ""
500
+ "LAMIN_DB_TOKEN" in os.environ
501
+ and (env_db_token := os.environ["LAMIN_DB_TOKEN"]) != ""
502
502
  ):
503
503
  return env_db_token
504
504
 
@@ -104,8 +104,20 @@ class InstanceSettings:
104
104
  for attr in attrs:
105
105
  value = getattr(self, attr)
106
106
  if attr == "storage":
107
- representation += f"\n - storage root: {value.root_as_str}"
108
- representation += f"\n - storage region: {value.region}"
107
+ if self.keep_artifacts_local:
108
+ import lamindb as ln
109
+
110
+ self._local_storage = ln.setup.settings.instance._local_storage
111
+ if self._local_storage is not None:
112
+ value_local = self.local_storage
113
+ representation += f"\n - local storage: {value_local.root_as_str} ({value_local.region})"
114
+ representation += (
115
+ f"\n - cloud storage: {value.root_as_str} ({value.region})"
116
+ )
117
+ else:
118
+ representation += (
119
+ f"\n - storage: {value.root_as_str} ({value.region})"
120
+ )
109
121
  elif attr == "db":
110
122
  if self.dialect != "sqlite":
111
123
  model = LaminDsnModel(db=value)
@@ -190,8 +202,9 @@ class InstanceSettings:
190
202
  if len(found) > 1:
191
203
  found_display = "\n - ".join([f"{record.root}" for record in found])
192
204
  logger.important(f"found locations:\n - {found_display}")
205
+ record = found[0]
193
206
  logger.important(f"defaulting to local storage: {record.root}")
194
- return StorageSettings(record.root)
207
+ return StorageSettings(record.root, region=record.region)
195
208
  elif not mute_warning:
196
209
  start = LOCAL_STORAGE_MESSAGE[0].lower()
197
210
  logger.warning(f"{start}{LOCAL_STORAGE_MESSAGE[1:]}")
@@ -229,7 +242,9 @@ class InstanceSettings:
229
242
  Guide: :doc:`faq/keep-artifacts-local`
230
243
  """
231
244
  if not self.keep_artifacts_local:
232
- raise ValueError("`keep_artifacts_local` is not enabled for this instance.")
245
+ raise ValueError(
246
+ "`keep_artifacts_local` is False, switch via: ln.setup.settings.instance.keep_artifacts_local = True"
247
+ )
233
248
  if self._local_storage is None:
234
249
  self._local_storage = self._search_local_root()
235
250
  if self._local_storage is None:
@@ -39,7 +39,7 @@ class UserSettings:
39
39
  def __repr__(self) -> str:
40
40
  """Rich string representation."""
41
41
  representation = "Current user:"
42
- attrs = ["handle", "email", "uid"]
42
+ attrs = ["handle", "uid"]
43
43
  for attr in attrs:
44
44
  value = getattr(self, attr)
45
45
  representation += f"\n - {attr}: {value}"
@@ -247,7 +247,7 @@ def setup_django(
247
247
  IS_SETUP = True
248
248
 
249
249
  if isettings.keep_artifacts_local:
250
- isettings._search_local_root()
250
+ isettings._local_storage = isettings._search_local_root()
251
251
 
252
252
 
253
253
  # THIS IS NOT SAFE
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: lamindb_setup
3
- Version: 1.8.2
3
+ Version: 1.8.3
4
4
  Summary: Setup & configure LaminDB.
5
5
  Author-email: Lamin Labs <open-source@lamin.ai>
6
6
  Requires-Python: >=3.10
@@ -1,7 +1,7 @@
1
- lamindb_setup/__init__.py,sha256=aROFrdb7k6cJGTETwMKBeRNp8LD5BurDRAfAp5lbAnM,2782
1
+ lamindb_setup/__init__.py,sha256=Pdh2-wDgY4x06M23rDIrY4XP4QrMck8SOSU00SAoSsw,2782
2
2
  lamindb_setup/_cache.py,sha256=5o749NuW6zi6uP4rmBtwxg7ifWpAHXVngzC0tEgXLgo,2776
3
3
  lamindb_setup/_check.py,sha256=28PcG8Kp6OpjSLSi1r2boL2Ryeh6xkaCL87HFbjs6GA,129
4
- lamindb_setup/_check_setup.py,sha256=bXuqx2HEc178RM7gbKZQ65PEVJFu6uSOKiHAs_xz6GI,5575
4
+ lamindb_setup/_check_setup.py,sha256=eeg7Vr7tUaTDObxq1X7J3TDPQZeitb_Uy6dxqa9xfzs,5707
5
5
  lamindb_setup/_connect_instance.py,sha256=PDvtAEHYJQVy-aMPNupN1u6PG9Rb_85JNKcjrOeHNy0,13478
6
6
  lamindb_setup/_delete.py,sha256=2KnZOqd5Kgr45XzjiDE9der35LODDUajZD6_hcurGtQ,5676
7
7
  lamindb_setup/_disconnect.py,sha256=p6tRLhixU4CuSxMKqzGTr-ovKmTRlZ8aID5dWQxOsg8,1092
@@ -21,30 +21,30 @@ lamindb_setup/errors.py,sha256=H1UM-bii0U2vPyjprOBgZK4ijZJgzgCViyGWPd8v5yU,1493
21
21
  lamindb_setup/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
22
22
  lamindb_setup/types.py,sha256=XlXLb4nmbc68uBj5Hp3xpDRezYGJIBZv6jAAqqN0p10,614
23
23
  lamindb_setup/core/__init__.py,sha256=5M4A6CVHBO_T5Rr9MeLaPW3WTk4-y00cgRYEgUJVU5U,410
24
- lamindb_setup/core/_aws_options.py,sha256=JN6fJNcotdIuT-WkBRKDPdyDri9XmorEX2unbuC0KuQ,7738
24
+ lamindb_setup/core/_aws_options.py,sha256=b8gAk9B1kjxhf73kTJpnM-uMre1koL0MPTCq9uwpEaE,7558
25
25
  lamindb_setup/core/_aws_storage.py,sha256=nEjeUv4xUVpoV0Lx-zjjmyb9w804bDyaeiM-OqbfwM0,1799
26
26
  lamindb_setup/core/_deprecated.py,sha256=HN7iUBdEgahw5e4NHCd1VJooUfieNb6GRzS5x8jU-q8,2549
27
27
  lamindb_setup/core/_docs.py,sha256=3k-YY-oVaJd_9UIY-LfBg_u8raKOCNfkZQPA73KsUhs,276
28
28
  lamindb_setup/core/_hub_client.py,sha256=jICkfWW1eZoxh3ycviztBGqCJH53uVve5Xawbj8RZR4,8433
29
- lamindb_setup/core/_hub_core.py,sha256=Jf7Wfu59XF3Q6S-GgF6osDToBinQsUa33n55P7Cq-TQ,23919
29
+ lamindb_setup/core/_hub_core.py,sha256=S3XjVA-bBchvyzTr-jNae4oLuN2Ho8A30me0MMswln0,23917
30
30
  lamindb_setup/core/_hub_crud.py,sha256=Jz0d8wFKM1Pv9B9byyUJPlCIMkIzk56Jd-c3Awpm9Xw,5730
31
31
  lamindb_setup/core/_hub_utils.py,sha256=6dyDGyzYFgVfR_lE3VN3CP1jGp98gxPtr-T91PAP05U,2687
32
32
  lamindb_setup/core/_private_django_api.py,sha256=By63l3vIEtK1pq246FhHq3tslxsaTJGKm5VakYluWp4,2656
33
33
  lamindb_setup/core/_settings.py,sha256=EtlxhtAdclS6rDRh5mrwh_q3gA7SJ1eF2rO1QtOYnnE,12949
34
- lamindb_setup/core/_settings_instance.py,sha256=40ty37SbCCc6pufi2455s4LcMtCbYRLLLz6P4rYwmiU,21198
34
+ lamindb_setup/core/_settings_instance.py,sha256=coGnDwQaqhviVV7wJnCWpL4uMz8IvY5sFALpYdh6wTc,21869
35
35
  lamindb_setup/core/_settings_load.py,sha256=JWd0_hBy04xjKo-tH4y8C9RkaywjrmoT0PsKzVme0n4,5176
36
36
  lamindb_setup/core/_settings_save.py,sha256=XZx-vow7BT6y3JpRBB2UOJp2vwc7jOGea4wSgOPqjPU,3262
37
37
  lamindb_setup/core/_settings_storage.py,sha256=S9AvKLzJX0M_RsYcBKZB_P84CYtTY0hyeffYE3UqrQA,15478
38
38
  lamindb_setup/core/_settings_store.py,sha256=QmeWIGdIyq7UmjfHiEB_0xRD8hY-8-ZR2WntIKfwTKI,2714
39
- lamindb_setup/core/_settings_user.py,sha256=K2a6nQ0fhEiSb9mCY_p6ItNrHZ3J_j7EfO7CjZap9aA,1462
39
+ lamindb_setup/core/_settings_user.py,sha256=gFfyMf-738onbh1Mf4wsmLlenQJPtjQfpUgKnOlqc2o,1453
40
40
  lamindb_setup/core/_setup_bionty_sources.py,sha256=ox3X-SHiHa2lNPSWjwZhINypbLacX6kGwH6hVVrSFZc,1505
41
41
  lamindb_setup/core/cloud_sqlite_locker.py,sha256=H_CTUCjURFXwD1cCtV_Jn0_60iztZTkaesLLXIBgIxc,7204
42
- lamindb_setup/core/django.py,sha256=dOt1OkUnZeYOo-LTjatQWQFh_MnjRf9IwwvRZhCwdZQ,9637
42
+ lamindb_setup/core/django.py,sha256=MPBcapHL6mH_ebin32aales0JL3AMYqHXUut8ggVFtY,9664
43
43
  lamindb_setup/core/exceptions.py,sha256=qjMzqy_uzPA7mCOdnoWnS_fdA6OWbdZGftz-YYplrY0,84
44
44
  lamindb_setup/core/hashing.py,sha256=Y8Uc5uSGTfU6L2R_gb5w8DdHhGRog7RnkK-e9FEMjPY,3680
45
45
  lamindb_setup/core/types.py,sha256=T7NwspfRHgIIpYsXDcApks8jkOlGeGRW-YbVLB7jNIo,67
46
46
  lamindb_setup/core/upath.py,sha256=W47O9-Y205j29iWJ3RKKdomA587hGvoiD6_krASGFcM,35315
47
- lamindb_setup-1.8.2.dist-info/LICENSE,sha256=UOZ1F5fFDe3XXvG4oNnkL1-Ecun7zpHzRxjp-XsMeAo,11324
48
- lamindb_setup-1.8.2.dist-info/WHEEL,sha256=CpUCUxeHQbRN5UGRQHYRJorO5Af-Qy_fHMctcQ8DSGI,82
49
- lamindb_setup-1.8.2.dist-info/METADATA,sha256=8JhQoVWB9z_rwHXtAaGzxZoeEvFy5EmSM_PyFPp2B5A,1797
50
- lamindb_setup-1.8.2.dist-info/RECORD,,
47
+ lamindb_setup-1.8.3.dist-info/LICENSE,sha256=UOZ1F5fFDe3XXvG4oNnkL1-Ecun7zpHzRxjp-XsMeAo,11324
48
+ lamindb_setup-1.8.3.dist-info/WHEEL,sha256=CpUCUxeHQbRN5UGRQHYRJorO5Af-Qy_fHMctcQ8DSGI,82
49
+ lamindb_setup-1.8.3.dist-info/METADATA,sha256=nua4OQ80w2e2G-gik39js5-KCXteq9hINyHknrw0NGI,1797
50
+ lamindb_setup-1.8.3.dist-info/RECORD,,