lamindb_setup 0.71.1__py2.py3-none-any.whl → 0.71.3__py2.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
@@ -34,7 +34,7 @@ Modules & settings:
34
34
 
35
35
  """
36
36
 
37
- __version__ = "0.71.1" # denote a release candidate for 0.1.0 with 0.1rc1
37
+ __version__ = "0.71.3" # denote a release candidate for 0.1.0 with 0.1rc1
38
38
 
39
39
  import sys
40
40
  from os import name as _os_name
@@ -107,7 +107,7 @@ def connect(
107
107
  *,
108
108
  db: str | None = None,
109
109
  storage: UPathStr | None = None,
110
- _raise_not_reachable_error: bool = True,
110
+ _raise_not_found_error: bool = True,
111
111
  _test: bool = False,
112
112
  ) -> str | tuple | None:
113
113
  """Connect to instance.
@@ -181,12 +181,12 @@ def connect(
181
181
  if settings_file.exists():
182
182
  isettings = load_instance_settings(settings_file)
183
183
  if isettings.is_remote:
184
- if _raise_not_reachable_error:
184
+ if _raise_not_found_error:
185
185
  raise InstanceNotFoundError(message)
186
186
  return "instance-not-found"
187
187
 
188
188
  else:
189
- if _raise_not_reachable_error:
189
+ if _raise_not_found_error:
190
190
  raise InstanceNotFoundError(message)
191
191
  return "instance-not-found"
192
192
 
@@ -209,7 +209,7 @@ def connect(
209
209
  f" {isettings._sqlite_file_local}\nTo push the file to the cloud,"
210
210
  " call: lamin close"
211
211
  )
212
- elif _raise_not_reachable_error:
212
+ elif _raise_not_found_error:
213
213
  raise SystemExit(msg)
214
214
  else:
215
215
  logger.warning(
@@ -184,7 +184,7 @@ def validate_init_args(
184
184
  name_str = infer_instance_name(storage=storage, name=name, db=db)
185
185
  # test whether instance exists by trying to load it
186
186
  instance_slug = f"{settings.user.handle}/{name_str}"
187
- response = connect(instance_slug, _raise_not_reachable_error=False, _test=_test)
187
+ response = connect(instance_slug, db=db, _raise_not_found_error=False, _test=_test)
188
188
  instance_state: Literal[
189
189
  "connected",
190
190
  "instance-corrupted-or-deleted",
@@ -290,7 +290,7 @@ def _init_instance(isettings: InstanceSettings, client: Client) -> None:
290
290
  client.table("storage").update(
291
291
  {"instance_id": isettings._id.hex, "is_default": True}
292
292
  ).eq("id", isettings.storage._uuid.hex).execute() # type: ignore
293
- logger.save(f"browse to: https://lamin.ai/{isettings.owner}/{isettings.name}")
293
+ logger.important(f"go to: https://lamin.ai/{isettings.owner}/{isettings.name}")
294
294
 
295
295
 
296
296
  def connect_instance(
@@ -4,7 +4,6 @@ from __future__ import annotations
4
4
  import builtins
5
5
  import os
6
6
  from pathlib import Path
7
- import shutil
8
7
  import time
9
8
  from lamin_utils import logger
10
9
  from ._settings_store import current_instance_settings_file
@@ -12,6 +11,7 @@ from ._settings_instance import InstanceSettings
12
11
 
13
12
  IS_RUN_FROM_IPYTHON = getattr(builtins, "__IPYTHON__", False)
14
13
  IS_SETUP = False
14
+ IS_MIGRATING = False
15
15
  CONN_MAX_AGE = 299
16
16
 
17
17
 
@@ -101,7 +101,10 @@ def setup_django(
101
101
  call_command("migrate", verbosity=2)
102
102
  isettings._update_cloud_sqlite_file(unlock_cloud_sqlite=False)
103
103
  elif init:
104
+ global IS_MIGRATING
105
+ IS_MIGRATING = True
104
106
  call_command("migrate", verbosity=0)
107
+ IS_MIGRATING = False
105
108
 
106
109
  global IS_SETUP
107
110
  IS_SETUP = True
@@ -471,7 +471,8 @@ def compute_file_tree(
471
471
  contents = [d for d in contents if d.is_dir()]
472
472
  pointers = [tee] * (len(contents) - 1) + [last]
473
473
  n_files_per_dir_and_type = defaultdict(lambda: 0) # type: ignore
474
- for pointer, child_path in zip(pointers, contents, strict=False): # type: ignore
474
+ # TODO: pass strict=False to zip with python > 3.9
475
+ for pointer, child_path in zip(pointers, contents): # type: ignore
475
476
  if child_path.is_dir():
476
477
  if include_dirs and child_path not in include_dirs:
477
478
  continue
@@ -504,8 +505,8 @@ def compute_file_tree(
504
505
  display_suffixes = ", ".join([f"{suffix!r}" for suffix in suffixes])
505
506
  suffix_message = f" with suffixes {display_suffixes}" if n_objects > 0 else ""
506
507
  message = (
507
- f"{path.name} ({n_directories} sub-{directory_info} &"
508
- f" {n_objects} files{suffix_message}): {folder_tree}"
508
+ f"{n_directories} sub-{directory_info} &"
509
+ f" {n_objects} files{suffix_message}\n{path.resolve()}{folder_tree}"
509
510
  )
510
511
  return message, n_objects
511
512
 
@@ -810,12 +811,12 @@ def check_storage_is_empty(
810
811
  if raise_error
811
812
  else "consider deleting them"
812
813
  )
813
- hint = "'./lamindb/_is_initialized' "
814
+ hint = "'_is_initialized'"
814
815
  if n_offset_objects == 2:
815
- hint += "& SQLite file"
816
+ hint += " & SQLite file"
816
817
  hint += " ignored"
817
818
  message = (
818
- f"Storage {directory_string} contains {n_objects} objects "
819
+ f"Storage {directory_string} contains {n_objects - n_offset_objects} objects "
819
820
  f"({hint}) - {ask_for_deletion}\n{objects}"
820
821
  )
821
822
  if n_diff > 0:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lamindb_setup
3
- Version: 0.71.1
3
+ Version: 0.71.3
4
4
  Summary: Setup & configure LaminDB.
5
5
  Author-email: Lamin Labs <laminlabs@gmail.com>
6
6
  Description-Content-Type: text/markdown
@@ -1,14 +1,14 @@
1
- lamindb_setup/__init__.py,sha256=EIyvRHHlYOX7WsAFGdKp63ho-ceFW05z_n_GV1oJkaU,1542
1
+ lamindb_setup/__init__.py,sha256=4OkxL3f7ZblC9iBXMfusjWga8XsOaieSAMix4ZDG8LE,1542
2
2
  lamindb_setup/_cache.py,sha256=wA7mbysANwe8hPNbjDo9bOmXJ0xIyaS5iyxIpxSWji4,846
3
3
  lamindb_setup/_check.py,sha256=28PcG8Kp6OpjSLSi1r2boL2Ryeh6xkaCL87HFbjs6GA,129
4
4
  lamindb_setup/_check_setup.py,sha256=cNEL9Q4yPpmEkGKHH8JgullWl1VUZwALJ4RHn9wZypY,2613
5
5
  lamindb_setup/_close.py,sha256=1QS9p2SCacgovYn6xqWU4zFvwHN1RgIccvzwJgFvKgU,1186
6
- lamindb_setup/_connect_instance.py,sha256=c0qO0dn4hnEc-toRh6pxFaAxkhzM9LVN-72XK11JtAU,12616
6
+ lamindb_setup/_connect_instance.py,sha256=6DiKFpw0k_gcWlZxI8ZJoqHungW-el3JbaWcmV9wGIg,12600
7
7
  lamindb_setup/_delete.py,sha256=hf8zfVJfW74QR7eK4xJNQ6HbkkZBsl5eTqj-Ni5jPo0,7232
8
8
  lamindb_setup/_django.py,sha256=EoyWvFzH0i9wxjy4JZhcoXCTckztP_Mrl6FbYQnMmLE,1534
9
9
  lamindb_setup/_exportdb.py,sha256=uTIZjKKTB7arzEr1j0O6lONiT2pRBKeOFdLvOV8ZwzE,2120
10
10
  lamindb_setup/_importdb.py,sha256=yYYShzUajTsR-cTW4CZ-UNDWZY2uE5PAgNbp-wn8Ogc,1874
11
- lamindb_setup/_init_instance.py,sha256=Hy4PsPpXCdl5ik3Q0ODltVbbvYjAqnLnfFza2ai8nX8,11921
11
+ lamindb_setup/_init_instance.py,sha256=2NT4ERk0RFrcgpnH5O-sAwkd7E1QLIOaFavyFzdAZbc,11924
12
12
  lamindb_setup/_migrate.py,sha256=4nBTFg5-BK4A2gH-D3_tcFf8EtvMnIo5Mq0e_C6_9-U,8815
13
13
  lamindb_setup/_register_instance.py,sha256=Jeu0wyvJVSVQ_n-A_7yn7xOZIP0ncJD92DRABqzPIjA,940
14
14
  lamindb_setup/_schema.py,sha256=b3uzhhWpV5mQtDwhMINc2MabGCnGLESy51ito3yl6Wc,679
@@ -20,7 +20,7 @@ lamindb_setup/core/_aws_storage.py,sha256=nEjeUv4xUVpoV0Lx-zjjmyb9w804bDyaeiM-Oq
20
20
  lamindb_setup/core/_deprecated.py,sha256=3qxUI1dnDlSeR0BYrv7ucjqRBEojbqotPgpShXs4KF8,2520
21
21
  lamindb_setup/core/_docs.py,sha256=3k-YY-oVaJd_9UIY-LfBg_u8raKOCNfkZQPA73KsUhs,276
22
22
  lamindb_setup/core/_hub_client.py,sha256=V0qKDsCdRn-tQy2YIk4VgXcpJFmuum6N3gcavAC7gBQ,5504
23
- lamindb_setup/core/_hub_core.py,sha256=FpEXPqSHXAgYegyQmsma54S3bv_mtceXrrpHXa7UeKE,15970
23
+ lamindb_setup/core/_hub_core.py,sha256=Cp8w0QY3DNOGWOhzzWmElj-pUm6tAkrQCLikbq_ksq8,15971
24
24
  lamindb_setup/core/_hub_crud.py,sha256=b1XF7AJpM9Q-ttm9nPG-r3OTRWHQaGzAGIyvmb83NTo,4859
25
25
  lamindb_setup/core/_hub_utils.py,sha256=b_M1LkdCjiMWm1EOlSb9GuPdLijwVgQDtATTpeZuXI0,1875
26
26
  lamindb_setup/core/_settings.py,sha256=jjZ_AxRXB3Y3UP6m04BAw_dhFbJbdg2-nZWmEv2LNZ8,3141
@@ -32,12 +32,12 @@ lamindb_setup/core/_settings_store.py,sha256=dagS5c7wAMRnuZTRfCU4sKaIOyF_HwAP5Fn
32
32
  lamindb_setup/core/_settings_user.py,sha256=P2lC4WDRAFfT-Xq3MlXJ-wMKIHCoGNhMTQfRGIAyUNQ,1344
33
33
  lamindb_setup/core/_setup_bionty_sources.py,sha256=OgPpZxN2_Wffy-ogEBz_97c_k8d2bD-DDVt89-u9GLY,3002
34
34
  lamindb_setup/core/cloud_sqlite_locker.py,sha256=NIBNAGq7TTRrip9OzMdiQKj8QOuwhL9esyM0aehUqBA,6893
35
- lamindb_setup/core/django.py,sha256=m0AKg2lJ1EYCtEtZ8frFFJbAR9qX0gnFcgqp7aeC2k0,3450
35
+ lamindb_setup/core/django.py,sha256=QUQm3zt5QIiD8uv6o9vbSm_bshqiSWzKSkgD3z2eJCg,3542
36
36
  lamindb_setup/core/exceptions.py,sha256=eoI7AXgATgDVzgArtN7CUvpaMUC067vsBg5LHCsWzDM,305
37
37
  lamindb_setup/core/hashing.py,sha256=mv9UCvAsSrdHYQAv3Kz7UOvjd5tIjvDTIYv_ettBuVY,2218
38
38
  lamindb_setup/core/types.py,sha256=bcYnZ0uM_2NXKJCl94Mmc-uYrQlRUUVKG3sK2N-F-N4,532
39
- lamindb_setup/core/upath.py,sha256=XBiHm-gxtfDIHnQmH5WjjmZzmAg5S421fjAfRrEg710,28286
40
- lamindb_setup-0.71.1.dist-info/LICENSE,sha256=UOZ1F5fFDe3XXvG4oNnkL1-Ecun7zpHzRxjp-XsMeAo,11324
41
- lamindb_setup-0.71.1.dist-info/WHEEL,sha256=Sgu64hAMa6g5FdzHxXv9Xdse9yxpGGMeagVtPMWpJQY,99
42
- lamindb_setup-0.71.1.dist-info/METADATA,sha256=fijK20hR12pIxHzmECdbyguUSsHvVjIYTmfumfuLReQ,1620
43
- lamindb_setup-0.71.1.dist-info/RECORD,,
39
+ lamindb_setup/core/upath.py,sha256=mou3NdF-tRTLW3E4eNDRFdCZrFZUyt-NPOVyC-DLe24,28342
40
+ lamindb_setup-0.71.3.dist-info/LICENSE,sha256=UOZ1F5fFDe3XXvG4oNnkL1-Ecun7zpHzRxjp-XsMeAo,11324
41
+ lamindb_setup-0.71.3.dist-info/WHEEL,sha256=Sgu64hAMa6g5FdzHxXv9Xdse9yxpGGMeagVtPMWpJQY,99
42
+ lamindb_setup-0.71.3.dist-info/METADATA,sha256=fAgts1w5BrUmsVUYnGoAmYdT7oljBvhdLmg_1fMicoo,1620
43
+ lamindb_setup-0.71.3.dist-info/RECORD,,