lamindb_setup 1.7.1__tar.gz → 1.7.2__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.
Files changed (106) hide show
  1. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/PKG-INFO +1 -1
  2. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/lamindb_setup/__init__.py +1 -1
  3. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/lamindb_setup/_init_instance.py +4 -4
  4. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/lamindb_setup/core/_hub_client.py +1 -1
  5. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/lamindb_setup/core/_hub_core.py +10 -8
  6. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/lamindb_setup/core/_settings.py +69 -7
  7. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/lamindb_setup/core/_settings_instance.py +7 -7
  8. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/lamindb_setup/core/_settings_user.py +2 -2
  9. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/tests/hub-prod/test_global_settings.py +25 -0
  10. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/.github/workflows/build.yml +0 -0
  11. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/.github/workflows/doc-changes.yml +0 -0
  12. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/.gitignore +0 -0
  13. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/.pre-commit-config.yaml +0 -0
  14. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/LICENSE +0 -0
  15. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/README.md +0 -0
  16. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/docs/changelog.md +0 -0
  17. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/docs/hub-cloud/01-init-local-instance.ipynb +0 -0
  18. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/docs/hub-cloud/02-connect-local-instance.ipynb +0 -0
  19. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/docs/hub-cloud/03-add-managed-storage.ipynb +0 -0
  20. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/docs/hub-cloud/04-test-bionty.ipynb +0 -0
  21. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/docs/hub-cloud/05-init-hosted-instance.ipynb +0 -0
  22. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/docs/hub-cloud/06-connect-hosted-instance.ipynb +0 -0
  23. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/docs/hub-cloud/07-keep-artifacts-local.ipynb +0 -0
  24. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/docs/hub-cloud/08-test-multi-session.ipynb +0 -0
  25. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/docs/hub-cloud/test_notebooks.py +0 -0
  26. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/docs/hub-prod/test-cache-management.ipynb +0 -0
  27. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/docs/hub-prod/test-cloud-sync.ipynb +0 -0
  28. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/docs/hub-prod/test-connect-anonymously.ipynb +0 -0
  29. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/docs/hub-prod/test-empty-init.ipynb +0 -0
  30. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/docs/hub-prod/test-import-schema.ipynb +0 -0
  31. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/docs/hub-prod/test-init-load-local-anonymously.ipynb +0 -0
  32. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/docs/hub-prod/test-insufficient-user-info.ipynb +0 -0
  33. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/docs/hub-prod/test-invalid-schema.ipynb +0 -0
  34. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/docs/hub-prod/test-sqlite-lock.ipynb +0 -0
  35. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/docs/hub-prod/test_notebooks2.py +0 -0
  36. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/docs/index.md +0 -0
  37. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/docs/notebooks.md +0 -0
  38. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/docs/reference.md +0 -0
  39. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/lamindb_setup/_cache.py +0 -0
  40. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/lamindb_setup/_check.py +0 -0
  41. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/lamindb_setup/_check_setup.py +0 -0
  42. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/lamindb_setup/_connect_instance.py +0 -0
  43. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/lamindb_setup/_delete.py +0 -0
  44. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/lamindb_setup/_disconnect.py +0 -0
  45. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/lamindb_setup/_django.py +0 -0
  46. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/lamindb_setup/_entry_points.py +0 -0
  47. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/lamindb_setup/_exportdb.py +0 -0
  48. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/lamindb_setup/_importdb.py +0 -0
  49. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/lamindb_setup/_migrate.py +0 -0
  50. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/lamindb_setup/_register_instance.py +0 -0
  51. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/lamindb_setup/_schema.py +0 -0
  52. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/lamindb_setup/_schema_metadata.py +0 -0
  53. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/lamindb_setup/_set_managed_storage.py +0 -0
  54. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/lamindb_setup/_setup_user.py +0 -0
  55. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/lamindb_setup/_silence_loggers.py +0 -0
  56. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/lamindb_setup/core/__init__.py +0 -0
  57. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/lamindb_setup/core/_aws_options.py +0 -0
  58. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/lamindb_setup/core/_aws_storage.py +0 -0
  59. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/lamindb_setup/core/_deprecated.py +0 -0
  60. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/lamindb_setup/core/_docs.py +0 -0
  61. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/lamindb_setup/core/_hub_crud.py +0 -0
  62. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/lamindb_setup/core/_hub_utils.py +0 -0
  63. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/lamindb_setup/core/_private_django_api.py +0 -0
  64. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/lamindb_setup/core/_settings_load.py +0 -0
  65. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/lamindb_setup/core/_settings_save.py +0 -0
  66. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/lamindb_setup/core/_settings_storage.py +0 -0
  67. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/lamindb_setup/core/_settings_store.py +0 -0
  68. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/lamindb_setup/core/_setup_bionty_sources.py +0 -0
  69. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/lamindb_setup/core/cloud_sqlite_locker.py +0 -0
  70. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/lamindb_setup/core/django.py +0 -0
  71. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/lamindb_setup/core/exceptions.py +0 -0
  72. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/lamindb_setup/core/hashing.py +0 -0
  73. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/lamindb_setup/core/types.py +0 -0
  74. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/lamindb_setup/core/upath.py +0 -0
  75. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/lamindb_setup/errors.py +0 -0
  76. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/lamindb_setup/py.typed +0 -0
  77. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/lamindb_setup/types.py +0 -0
  78. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/noxfile.py +0 -0
  79. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/pyproject.toml +0 -0
  80. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/tests/hub-cloud/scripts/script-init-pass-user-no-writes.py +0 -0
  81. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/tests/hub-cloud/scripts/script-to-fail-managed-storage.py +0 -0
  82. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/tests/hub-cloud/test_connect_instance.py +0 -0
  83. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/tests/hub-cloud/test_delete_instance.py +0 -0
  84. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/tests/hub-cloud/test_edge_request.py +0 -0
  85. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/tests/hub-cloud/test_fail_managed_storage.py +0 -0
  86. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/tests/hub-cloud/test_init_instance.py +0 -0
  87. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/tests/hub-cloud/test_init_pass_user_no_writes.py +0 -0
  88. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/tests/hub-cloud/test_login.py +0 -0
  89. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/tests/hub-cloud/test_migrate.py +0 -0
  90. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/tests/hub-cloud/test_set_storage.py +0 -0
  91. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/tests/hub-local/conftest.py +0 -0
  92. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/tests/hub-local/scripts/script-connect-fine-grained-access.py +0 -0
  93. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/tests/hub-local/test_all.py +0 -0
  94. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/tests/hub-local/test_update_schema_in_hub.py +0 -0
  95. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/tests/hub-prod/conftest.py +0 -0
  96. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/tests/hub-prod/test_aws_options_manager.py +0 -0
  97. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/tests/hub-prod/test_django.py +0 -0
  98. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/tests/hub-prod/test_switch_and_fallback_env.py +0 -0
  99. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/tests/hub-prod/test_upath.py +0 -0
  100. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/tests/storage/test_entry_point.py +0 -0
  101. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/tests/storage/test_hashing.py +0 -0
  102. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/tests/storage/test_storage_access.py +0 -0
  103. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/tests/storage/test_storage_basis.py +0 -0
  104. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/tests/storage/test_storage_settings.py +0 -0
  105. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/tests/storage/test_storage_stats.py +0 -0
  106. {lamindb_setup-1.7.1 → lamindb_setup-1.7.2}/tests/storage/test_to_url.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: lamindb_setup
3
- Version: 1.7.1
3
+ Version: 1.7.2
4
4
  Summary: Setup & configure LaminDB.
5
5
  Author-email: Lamin Labs <open-source@lamin.ai>
6
6
  Requires-Python: >=3.10
@@ -35,7 +35,7 @@ Modules & settings:
35
35
 
36
36
  """
37
37
 
38
- __version__ = "1.7.1" # denote a release candidate for 0.1.0 with 0.1rc1
38
+ __version__ = "1.7.2" # denote a release candidate for 0.1.0 with 0.1rc1
39
39
 
40
40
  import os
41
41
 
@@ -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=20,
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"] # the instance was renamed
384
- logger.warning(
385
- f"'{owner}/{name}' was renamed, please use '{owner}/{new_name}'"
386
- )
387
- response = client.functions.invoke(
388
- "get-instance-settings-v1",
389
- invoke_options={"body": {"owner": owner, "name": new_name}},
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
 
@@ -54,6 +56,8 @@ class SetupSettings:
54
56
  _instance_settings_env: str | None = None
55
57
 
56
58
  _auto_connect_path: Path = settings_dir / "auto_connect"
59
+ _branch_path: Path = settings_dir / "branch_uid.txt"
60
+ _space_path: Path = settings_dir / "space_uid.txt"
57
61
  _private_django_api_path: Path = settings_dir / "private_django_api"
58
62
 
59
63
  _cache_dir: Path | None = None
@@ -91,6 +95,58 @@ class SetupSettings:
91
95
  else:
92
96
  self._auto_connect_path.unlink(missing_ok=True)
93
97
 
98
+ @property
99
+ def branch(self) -> Branch:
100
+ """Default branch."""
101
+ from lamindb import Branch
102
+
103
+ idlike: str | int = 1
104
+ if self._branch_path.exists():
105
+ idlike = self._branch_path.read_text()
106
+ return Branch.get(idlike)
107
+
108
+ @branch.setter
109
+ def branch(self, value: str | Branch) -> None:
110
+ from lamindb import Branch, Q
111
+ from lamindb.errors import DoesNotExist
112
+
113
+ if isinstance(value, Branch):
114
+ assert value._state.adding is False, "Branch must be saved"
115
+ branch_record = value
116
+ else:
117
+ branch_record = Branch.filter(Q(name=value) | Q(uid=value)).one_or_none()
118
+ if branch_record is None:
119
+ raise DoesNotExist(
120
+ f"Branch '{value}', please check on the hub UI whether you have the correct `uid` or `name`."
121
+ )
122
+ self._branch_path.write_text(branch_record.uid)
123
+
124
+ @property
125
+ def space(self) -> Space:
126
+ """Default space."""
127
+ from lamindb import Space
128
+
129
+ idlike: str | int = 1
130
+ if self._space_path.exists():
131
+ idlike = self._space_path.read_text()
132
+ return Space.get(idlike)
133
+
134
+ @space.setter
135
+ def space(self, value: str | Space) -> None:
136
+ from lamindb import Q, Space
137
+ from lamindb.errors import DoesNotExist
138
+
139
+ if isinstance(value, Space):
140
+ assert value._state.adding is False, "Space must be saved"
141
+ space_record = value
142
+ else:
143
+ space_record = Space.filter(Q(name=value) | Q(uid=value)).one_or_none()
144
+ if space_record is None:
145
+ raise DoesNotExist(
146
+ f"Space '{value}', please check on the hub UI whether you have the correct `uid` or `name`."
147
+ )
148
+ self._space_path.write_text(space_record.uid)
149
+
94
150
  @property
95
151
  def is_connected(self) -> bool:
96
152
  """Determine whether the current instance is fully connected and ready to use.
@@ -205,16 +261,22 @@ class SetupSettings:
205
261
  # do not show current setting representation when building docs
206
262
  if "sphinx" in sys.modules:
207
263
  return object.__repr__(self)
208
- repr = f"Auto-connect in Python: {self.auto_connect}\n"
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"
264
+ repr = ""
214
265
  if self._instance_exists:
266
+ repr += "Current branch & space:\n"
267
+ repr += f" - branch: {self.branch.name}\n"
268
+ repr += f" - space: {self.space.name}\n"
215
269
  repr += self.instance.__repr__()
216
270
  else:
217
- repr += "\nNo instance connected"
271
+ repr += "Current instance: None"
272
+ repr += "\nConfig:\n"
273
+ repr += f" - auto-connect in Python: {self.auto_connect}\n"
274
+ repr += f" - private Django API: {self.private_django_api}\n"
275
+ repr += "Local directories:\n"
276
+ repr += f" - cache: {self.cache_dir.as_posix()}\n"
277
+ repr += f" - user settings: {settings_dir.as_posix()}\n"
278
+ repr += f" - system settings: {system_settings_dir.as_posix()}\n"
279
+ repr += self.user.__repr__()
218
280
  return repr
219
281
 
220
282
 
@@ -97,13 +97,13 @@ class InstanceSettings:
97
97
 
98
98
  def __repr__(self):
99
99
  """Rich string representation."""
100
- representation = f"Current instance: {self.slug}"
101
- attrs = ["owner", "name", "storage", "db", "modules", "git_repo"]
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 = f"Current user: {self.handle}"
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() == 12 * "a"
27
+ ln_setup.settings.branch = "main"
28
+ assert ln_setup.settings._branch_path.read_text() == 12 * "m"
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() == 12 * "a"
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