lamindb_setup 0.72.1__py2.py3-none-any.whl → 0.72.2__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.72.1" # denote a release candidate for 0.1.0 with 0.1rc1
37
+ __version__ = "0.72.2" # 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
@@ -22,6 +22,10 @@ else:
22
22
  HOSTED_BUCKETS = ("s3://lamin-hosted-test",) # type: ignore
23
23
 
24
24
 
25
+ def _keep_trailing_slash(path_str: str):
26
+ return path_str if path_str[-1] == "/" else path_str + "/"
27
+
28
+
25
29
  AWS_CREDENTIALS_EXPIRATION = 11 * 60 * 60 # refresh credentials after 11 hours
26
30
 
27
31
 
@@ -81,7 +85,10 @@ class AWSCredentialsManager:
81
85
  return S3Path(path, cache_regions=cache_regions, **connection_options)
82
86
 
83
87
  def enrich_path(self, path: S3Path, access_token: str | None = None) -> S3Path:
84
- path_str = path.as_posix().rstrip("/")
88
+ # trailing slash is needed to avoid returning incorrect results
89
+ # with .startswith
90
+ # for example s3://lamindata-eu should not receive cache for s3://lamindata
91
+ path_str = _keep_trailing_slash(path.as_posix())
85
92
  root = self._find_root(path_str)
86
93
 
87
94
  if root is not None:
@@ -127,7 +134,7 @@ class AWSCredentialsManager:
127
134
  # write the bucket for everything else
128
135
  root = path._url.netloc
129
136
  root = "s3://" + root
130
- self._set_cached_credentials(root, credentials)
137
+ self._set_cached_credentials(_keep_trailing_slash(root), credentials)
131
138
 
132
139
  return self._path_inject_options(path, credentials)
133
140
 
@@ -5,6 +5,7 @@ import shutil
5
5
  from pathlib import Path
6
6
  from typing import TYPE_CHECKING, Literal
7
7
 
8
+ from django.db.utils import ProgrammingError
8
9
  from lamin_utils import logger
9
10
 
10
11
  from ._hub_client import call_with_fallback
@@ -106,8 +107,15 @@ class InstanceSettings:
106
107
  local_records = Storage.objects.filter(root=local_root)
107
108
  else:
108
109
  local_records = Storage.objects.filter(type="local")
110
+ all_local_records = local_records.all()
111
+ try:
112
+ # trigger an error in case of a migration issue
113
+ all_local_records.first()
114
+ except ProgrammingError:
115
+ logger.error("not able to load Storage registry: please migrate")
116
+ return None
109
117
  found = False
110
- for record in local_records.all():
118
+ for record in all_local_records:
111
119
  root_path = Path(record.root)
112
120
  if root_path.exists():
113
121
  marker_path = root_path / ".lamindb/_is_initialized"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lamindb_setup
3
- Version: 0.72.1
3
+ Version: 0.72.2
4
4
  Summary: Setup & configure LaminDB.
5
5
  Author-email: Lamin Labs <laminlabs@gmail.com>
6
6
  Description-Content-Type: text/markdown
@@ -1,4 +1,4 @@
1
- lamindb_setup/__init__.py,sha256=Uw5mXYU3C6xw4fCmayp05RMBoM0iSQgj2YtJmBbzvxc,1542
1
+ lamindb_setup/__init__.py,sha256=p_LDSrN8hygUj_CeoWH3ZILNhJi_GQVghFfu7pSmt5w,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
@@ -16,7 +16,7 @@ lamindb_setup/_set_managed_storage.py,sha256=mNZrANn-9rwZ0oGWxxg0wS0T0VOQCWyo4nS
16
16
  lamindb_setup/_setup_user.py,sha256=6Oc7Rke-yRQSZbuntdUAz8QbJ6UuPzYHI9FnYlf_q-A,3670
17
17
  lamindb_setup/_silence_loggers.py,sha256=AKF_YcHvX32eGXdsYK8MJlxEaZ-Uo2f6QDRzjKFCtws,1568
18
18
  lamindb_setup/core/__init__.py,sha256=dV9S-rQpNK9JcBn4hiEmiLnmNqfpPFJD9pqagMCaIew,416
19
- lamindb_setup/core/_aws_credentials.py,sha256=84kugTtELFACJ4SGeTqT-ul0FbOPTe07P0xptv2tOPo,4972
19
+ lamindb_setup/core/_aws_credentials.py,sha256=nK04-lNYz6MYDgD6Z56peoxCULZ82uFDRMzjwsPh25U,5293
20
20
  lamindb_setup/core/_aws_storage.py,sha256=nEjeUv4xUVpoV0Lx-zjjmyb9w804bDyaeiM-OqbfwM0,1799
21
21
  lamindb_setup/core/_deprecated.py,sha256=3qxUI1dnDlSeR0BYrv7ucjqRBEojbqotPgpShXs4KF8,2520
22
22
  lamindb_setup/core/_docs.py,sha256=3k-YY-oVaJd_9UIY-LfBg_u8raKOCNfkZQPA73KsUhs,276
@@ -25,7 +25,7 @@ lamindb_setup/core/_hub_core.py,sha256=RGjTqf1owuWmkXAYy0EPaoHAaJ-0T0hAidkqa3cId
25
25
  lamindb_setup/core/_hub_crud.py,sha256=b1XF7AJpM9Q-ttm9nPG-r3OTRWHQaGzAGIyvmb83NTo,4859
26
26
  lamindb_setup/core/_hub_utils.py,sha256=b_M1LkdCjiMWm1EOlSb9GuPdLijwVgQDtATTpeZuXI0,1875
27
27
  lamindb_setup/core/_settings.py,sha256=jjZ_AxRXB3Y3UP6m04BAw_dhFbJbdg2-nZWmEv2LNZ8,3141
28
- lamindb_setup/core/_settings_instance.py,sha256=w5SBrp6nIJMegzNJSnfQl8HvqEtwgmR7OrayffVedLc,16612
28
+ lamindb_setup/core/_settings_instance.py,sha256=kda3kqUtwh-XZMDmbdFIp8RGGFw0Az8T8g2SKEU65mo,16949
29
29
  lamindb_setup/core/_settings_load.py,sha256=NGgCDpN85j1EqoKlrYFIlZBMlBJm33gx2-wc96CP_ZQ,3922
30
30
  lamindb_setup/core/_settings_save.py,sha256=d1A-Ex-7H08mb8l7I0Oe0j0GilrfaDuprh_NMxhQAsQ,2704
31
31
  lamindb_setup/core/_settings_storage.py,sha256=7f0jt1zcSltpOYDPQ5CVvbBon_d7aneKTte935-2REY,13236
@@ -38,7 +38,7 @@ lamindb_setup/core/exceptions.py,sha256=eoI7AXgATgDVzgArtN7CUvpaMUC067vsBg5LHCsW
38
38
  lamindb_setup/core/hashing.py,sha256=7r96h5JBzuwfOR_gNNqTyWNPKMuiOUfBYwn6sCbZkf8,2269
39
39
  lamindb_setup/core/types.py,sha256=bcYnZ0uM_2NXKJCl94Mmc-uYrQlRUUVKG3sK2N-F-N4,532
40
40
  lamindb_setup/core/upath.py,sha256=QnAiaOZgT1TLUaX0PEs9dSJ0E4ZDD431hCfKrJIbmqQ,26339
41
- lamindb_setup-0.72.1.dist-info/LICENSE,sha256=UOZ1F5fFDe3XXvG4oNnkL1-Ecun7zpHzRxjp-XsMeAo,11324
42
- lamindb_setup-0.72.1.dist-info/WHEEL,sha256=Sgu64hAMa6g5FdzHxXv9Xdse9yxpGGMeagVtPMWpJQY,99
43
- lamindb_setup-0.72.1.dist-info/METADATA,sha256=JPuCGY8Fy7wJzFXSh6xaBJVNBOpz2XeDvSLDzwTEXB8,1620
44
- lamindb_setup-0.72.1.dist-info/RECORD,,
41
+ lamindb_setup-0.72.2.dist-info/LICENSE,sha256=UOZ1F5fFDe3XXvG4oNnkL1-Ecun7zpHzRxjp-XsMeAo,11324
42
+ lamindb_setup-0.72.2.dist-info/WHEEL,sha256=Sgu64hAMa6g5FdzHxXv9Xdse9yxpGGMeagVtPMWpJQY,99
43
+ lamindb_setup-0.72.2.dist-info/METADATA,sha256=oeLIvcLxoZcHsOT7yDplKrq89sW5elwq2TV9CpZWY6M,1620
44
+ lamindb_setup-0.72.2.dist-info/RECORD,,