lamindb_setup 0.73.2__py2.py3-none-any.whl → 0.73.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.73.2" # denote a release candidate for 0.1.0 with 0.1rc1
37
+ __version__ = "0.73.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
@@ -33,8 +33,7 @@ def get_schema_module_name(schema_name) -> str:
33
33
  if module_spec is not None:
34
34
  return name
35
35
  raise ImportError(
36
- f"Python package for '{schema_name}' is not installed, tried two package names:"
37
- f" {name_attempts}\nHave you installed the schema package using `pip install`?"
36
+ f"Python package for '{schema_name}' is not installed.\nIf your package is on PyPI, run `pip install {schema_name}`"
38
37
  )
39
38
 
40
39
 
@@ -256,7 +255,10 @@ def init(
256
255
  schema=schema,
257
256
  uid=ssettings.uid,
258
257
  )
259
- if isettings.is_remote and instance_state != "instance-corrupted-or-deleted":
258
+ register_on_hub = (
259
+ isettings.is_remote and instance_state != "instance-corrupted-or-deleted"
260
+ )
261
+ if register_on_hub:
260
262
  init_instance_hub(isettings)
261
263
  validate_sqlite_state(isettings)
262
264
  isettings._persist()
@@ -270,8 +272,10 @@ def init(
270
272
  "locked instance (to unlock and push changes to the cloud SQLite file,"
271
273
  " call: lamin close)"
272
274
  )
273
- # we can debate whether this is the right setting, but this is how
274
- # things have been and we'd like to not easily break backward compat
275
+ if register_on_hub and isettings.dialect != "sqlite":
276
+ from ._schema_metadata import update_schema_in_hub
277
+
278
+ update_schema_in_hub()
275
279
  settings.auto_connect = True
276
280
  except Exception as e:
277
281
  from ._delete import delete_by_isettings
lamindb_setup/_migrate.py CHANGED
@@ -75,21 +75,15 @@ class migrate:
75
75
  from lamindb_setup.core._hub_client import call_with_fallback_auth
76
76
  from lamindb_setup.core._hub_crud import (
77
77
  select_collaborator,
78
- select_instance_by_id,
79
78
  update_instance,
80
79
  )
81
80
 
82
- instance_id_str = settings.instance._id.hex
83
- instance = call_with_fallback_auth(
84
- select_instance_by_id, instance_id=instance_id_str
85
- )
86
- instance_is_on_hub = instance is not None
87
- if instance_is_on_hub:
81
+ if settings.instance.is_on_hub:
88
82
  # double check that user is an admin, otherwise will fail below
89
- # without idempotence
83
+ # due to insufficient SQL permissions with cryptic error
90
84
  collaborator = call_with_fallback_auth(
91
85
  select_collaborator,
92
- instance_id=instance_id_str,
86
+ instance_id=settings.instance._id,
93
87
  account_id=settings.user._uuid,
94
88
  )
95
89
  if collaborator is None or collaborator["role"] != "admin":
@@ -104,7 +98,7 @@ class migrate:
104
98
  # this sets up django and deploys the migrations
105
99
  setup_django(settings.instance, deploy_migrations=True)
106
100
  # this populates the hub
107
- if instance_is_on_hub:
101
+ if settings.instance.is_on_hub:
108
102
  logger.important(f"updating lamindb version in hub: {lamindb.__version__}")
109
103
  # TODO: integrate update of instance table within update_schema_in_hub & below
110
104
  if settings.instance.dialect != "sqlite":
@@ -27,3 +27,7 @@ def register(_test: bool = False):
27
27
  init_instance_hub(isettings)
28
28
  isettings._is_on_hub = True
29
29
  isettings._persist()
30
+ if isettings.dialect != "sqlite" and not _test:
31
+ from ._schema_metadata import update_schema_in_hub
32
+
33
+ update_schema_in_hub()
@@ -51,7 +51,11 @@ class SetupSettings:
51
51
  @property
52
52
  def user(self) -> UserSettings:
53
53
  """:class:`~lamindb.setup.core.UserSettings`."""
54
- if self._user_settings is None or self._user_settings_env != get_env_name():
54
+ env_changed = (
55
+ self._user_settings_env is not None
56
+ and self._user_settings_env != get_env_name()
57
+ )
58
+ if self._user_settings is None or env_changed:
55
59
  self._user_settings = load_or_create_user_settings()
56
60
  self._user_settings_env = get_env_name()
57
61
  if self._user_settings and self._user_settings.uid is None:
@@ -61,10 +65,11 @@ class SetupSettings:
61
65
  @property
62
66
  def instance(self) -> InstanceSettings:
63
67
  """:class:`~lamindb.setup.core.InstanceSettings`."""
64
- if (
65
- self._instance_settings is None
66
- or self._instance_settings_env != get_env_name()
67
- ):
68
+ env_changed = (
69
+ self._instance_settings_env is not None
70
+ and self._instance_settings_env != get_env_name()
71
+ )
72
+ if self._instance_settings is None or env_changed:
68
73
  self._instance_settings = load_instance_settings()
69
74
  self._instance_settings_env = get_env_name()
70
75
  return self._instance_settings # type: ignore
@@ -121,6 +121,8 @@ def init_storage(
121
121
  init_storage_hub(ssettings)
122
122
  # below comes last only if everything else was successful
123
123
  try:
124
+ # (federated) credentials for AWS access are provisioned under-the-hood
125
+ # discussion: https://laminlabs.slack.com/archives/C04FPE8V01W/p1719260587167489
124
126
  mark_storage_root(ssettings.root, ssettings.uid) # type: ignore
125
127
  except Exception:
126
128
  logger.important(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lamindb_setup
3
- Version: 0.73.2
3
+ Version: 0.73.3
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=HyUA-3vUuT5XnO6MHe78x0OQaPP0s4-jb6QuFXEuY3s,1542
1
+ lamindb_setup/__init__.py,sha256=EgjGlGIzJvx55KkCHlThXLwwsvvPyTL04cF0BOmGo24,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
@@ -8,9 +8,9 @@ lamindb_setup/_delete.py,sha256=Y8KSFYgY0UHAvjd7cCL6hZ_XiLeJwx50BguVATcj_Xo,5524
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=Cji3h2kCj8Meukkm8Btl8Lu4Jio4NiWLlzAAKukEzYY,11896
12
- lamindb_setup/_migrate.py,sha256=49xPkwU-QQjpq0xSUepiVfvRsMhmjfbRlhd72YIq8o8,9059
13
- lamindb_setup/_register_instance.py,sha256=Jeu0wyvJVSVQ_n-A_7yn7xOZIP0ncJD92DRABqzPIjA,940
11
+ lamindb_setup/_init_instance.py,sha256=e6OJSpN2eJZd22kAfUVEUbqXF48FzNfLc5xMTS8gZ84,11919
12
+ lamindb_setup/_migrate.py,sha256=P4n3x0SYzO9szjF2-JMa7z4mQadtWjHv5ow4HbCDZLI,8864
13
+ lamindb_setup/_register_instance.py,sha256=LlD2n44Gmh8OXrAkL9iL9NiML8QDKnk4d869MhXoOWI,1083
14
14
  lamindb_setup/_schema.py,sha256=b3uzhhWpV5mQtDwhMINc2MabGCnGLESy51ito3yl6Wc,679
15
15
  lamindb_setup/_schema_metadata.py,sha256=G3yXJ46OkVGqHxccCgjvQnnBNKg1uhwxXB1CddlkwYw,16882
16
16
  lamindb_setup/_set_managed_storage.py,sha256=mNZrANn-9rwZ0oGWxxg0wS0T0VOQCWyo4nSSyNAE15Q,1419
@@ -25,11 +25,11 @@ lamindb_setup/core/_hub_client.py,sha256=V0qKDsCdRn-tQy2YIk4VgXcpJFmuum6N3gcavAC
25
25
  lamindb_setup/core/_hub_core.py,sha256=RGjTqf1owuWmkXAYy0EPaoHAaJ-0T0hAidkqa3cIdiM,16352
26
26
  lamindb_setup/core/_hub_crud.py,sha256=b1XF7AJpM9Q-ttm9nPG-r3OTRWHQaGzAGIyvmb83NTo,4859
27
27
  lamindb_setup/core/_hub_utils.py,sha256=b_M1LkdCjiMWm1EOlSb9GuPdLijwVgQDtATTpeZuXI0,1875
28
- lamindb_setup/core/_settings.py,sha256=jjZ_AxRXB3Y3UP6m04BAw_dhFbJbdg2-nZWmEv2LNZ8,3141
28
+ lamindb_setup/core/_settings.py,sha256=xiSZ_-j3MQBvnLQe4WB6BeILmlRbM8oiFoN5o0uaCUo,3329
29
29
  lamindb_setup/core/_settings_instance.py,sha256=MJ1UArq49A168uGx9nOWDiXEKeSlDqtV-dqQf1kBcZw,17518
30
30
  lamindb_setup/core/_settings_load.py,sha256=NGgCDpN85j1EqoKlrYFIlZBMlBJm33gx2-wc96CP_ZQ,3922
31
31
  lamindb_setup/core/_settings_save.py,sha256=d1A-Ex-7H08mb8l7I0Oe0j0GilrfaDuprh_NMxhQAsQ,2704
32
- lamindb_setup/core/_settings_storage.py,sha256=k4XyJR6_KpUpQuBYZp4mEdABiT91gTTfbK7tAVwqZCA,13093
32
+ lamindb_setup/core/_settings_storage.py,sha256=65aobewYX6VfOeYZjZQOOI7ZD_3b4QA9TDmrduU0m4c,13262
33
33
  lamindb_setup/core/_settings_store.py,sha256=dagS5c7wAMRnuZTRfCU4sKaIOyF_HwAP5Fnnn8vphno,2084
34
34
  lamindb_setup/core/_settings_user.py,sha256=P2lC4WDRAFfT-Xq3MlXJ-wMKIHCoGNhMTQfRGIAyUNQ,1344
35
35
  lamindb_setup/core/_setup_bionty_sources.py,sha256=h_pBANsSGK6ujAFsG21mtADHVJoMLKDR4eGgRP4Fgls,3072
@@ -39,7 +39,7 @@ lamindb_setup/core/exceptions.py,sha256=eoI7AXgATgDVzgArtN7CUvpaMUC067vsBg5LHCsW
39
39
  lamindb_setup/core/hashing.py,sha256=7r96h5JBzuwfOR_gNNqTyWNPKMuiOUfBYwn6sCbZkf8,2269
40
40
  lamindb_setup/core/types.py,sha256=bcYnZ0uM_2NXKJCl94Mmc-uYrQlRUUVKG3sK2N-F-N4,532
41
41
  lamindb_setup/core/upath.py,sha256=dwudkTVsXuyjS-2xR16WomcWtXJAEfRZ0ZzFq8_EDhE,27157
42
- lamindb_setup-0.73.2.dist-info/LICENSE,sha256=UOZ1F5fFDe3XXvG4oNnkL1-Ecun7zpHzRxjp-XsMeAo,11324
43
- lamindb_setup-0.73.2.dist-info/WHEEL,sha256=Sgu64hAMa6g5FdzHxXv9Xdse9yxpGGMeagVtPMWpJQY,99
44
- lamindb_setup-0.73.2.dist-info/METADATA,sha256=t3AiEbJJFkA0l-DY3DIDoLQHjBW--ToZWYS8vYNxdDU,1620
45
- lamindb_setup-0.73.2.dist-info/RECORD,,
42
+ lamindb_setup-0.73.3.dist-info/LICENSE,sha256=UOZ1F5fFDe3XXvG4oNnkL1-Ecun7zpHzRxjp-XsMeAo,11324
43
+ lamindb_setup-0.73.3.dist-info/WHEEL,sha256=Sgu64hAMa6g5FdzHxXv9Xdse9yxpGGMeagVtPMWpJQY,99
44
+ lamindb_setup-0.73.3.dist-info/METADATA,sha256=CNX_cBqGOPiMedGZ0e1vRnwoZYOL_Ck6h9weijQ7Dec,1620
45
+ lamindb_setup-0.73.3.dist-info/RECORD,,