lamindb_setup 1.3.1__tar.gz → 1.4.0__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 (104) hide show
  1. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/.gitignore +2 -2
  2. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/PKG-INFO +2 -2
  3. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/docs/hub-cloud/01-init-local-instance.ipynb +1 -1
  4. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/docs/hub-cloud/02-connect-local-instance.ipynb +1 -1
  5. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/docs/hub-cloud/03-add-managed-storage.ipynb +9 -9
  6. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/docs/hub-cloud/04-test-bionty.ipynb +2 -10
  7. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/docs/hub-cloud/07-keep-artifacts-local.ipynb +3 -4
  8. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/docs/hub-prod/test-empty-init.ipynb +1 -4
  9. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/lamindb_setup/__init__.py +1 -1
  10. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/lamindb_setup/_close.py +0 -3
  11. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/lamindb_setup/_connect_instance.py +1 -0
  12. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/lamindb_setup/_delete.py +1 -1
  13. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/lamindb_setup/_init_instance.py +26 -10
  14. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/lamindb_setup/_migrate.py +10 -6
  15. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/lamindb_setup/_set_managed_storage.py +1 -1
  16. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/lamindb_setup/core/_hub_client.py +3 -1
  17. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/lamindb_setup/core/_hub_core.py +6 -5
  18. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/lamindb_setup/core/_settings_instance.py +35 -37
  19. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/lamindb_setup/core/_settings_load.py +1 -0
  20. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/lamindb_setup/core/_settings_save.py +1 -0
  21. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/lamindb_setup/core/_settings_storage.py +55 -35
  22. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/lamindb_setup/core/_settings_store.py +1 -0
  23. lamindb_setup-1.4.0/lamindb_setup/core/_setup_bionty_sources.py +44 -0
  24. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/lamindb_setup/core/django.py +1 -1
  25. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/lamindb_setup/core/upath.py +23 -18
  26. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/pyproject.toml +1 -1
  27. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/tests/hub-cloud/test_connect_instance.py +1 -1
  28. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/tests/hub-cloud/test_init_instance.py +2 -4
  29. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/tests/hub-local/scripts/script-connect-fine-grained-access.py +1 -0
  30. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/tests/hub-local/test_all.py +2 -2
  31. lamindb_setup-1.3.1/lamindb_setup/core/_setup_bionty_sources.py +0 -116
  32. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/.github/workflows/build.yml +0 -0
  33. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/.github/workflows/doc-changes.yml +0 -0
  34. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/.pre-commit-config.yaml +0 -0
  35. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/LICENSE +0 -0
  36. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/README.md +0 -0
  37. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/docs/changelog.md +0 -0
  38. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/docs/hub-cloud/05-init-hosted-instance.ipynb +0 -0
  39. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/docs/hub-cloud/06-connect-hosted-instance.ipynb +0 -0
  40. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/docs/hub-cloud/08-test-multi-session.ipynb +0 -0
  41. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/docs/hub-cloud/test_notebooks.py +0 -0
  42. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/docs/hub-prod/test-cache-management.ipynb +0 -0
  43. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/docs/hub-prod/test-cloud-sync.ipynb +0 -0
  44. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/docs/hub-prod/test-connect-anonymously-set-token.ipynb +0 -0
  45. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/docs/hub-prod/test-import-schema.ipynb +0 -0
  46. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/docs/hub-prod/test-init-load-local-anonymously.ipynb +0 -0
  47. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/docs/hub-prod/test-insufficient-user-info.ipynb +0 -0
  48. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/docs/hub-prod/test-invalid-schema.ipynb +0 -0
  49. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/docs/hub-prod/test-sqlite-lock.ipynb +0 -0
  50. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/docs/hub-prod/test_notebooks2.py +0 -0
  51. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/docs/index.md +0 -0
  52. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/docs/notebooks.md +0 -0
  53. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/docs/reference.md +0 -0
  54. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/lamindb_setup/_cache.py +0 -0
  55. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/lamindb_setup/_check.py +0 -0
  56. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/lamindb_setup/_check_setup.py +0 -0
  57. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/lamindb_setup/_django.py +0 -0
  58. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/lamindb_setup/_entry_points.py +0 -0
  59. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/lamindb_setup/_exportdb.py +0 -0
  60. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/lamindb_setup/_importdb.py +0 -0
  61. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/lamindb_setup/_register_instance.py +0 -0
  62. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/lamindb_setup/_schema.py +0 -0
  63. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/lamindb_setup/_schema_metadata.py +0 -0
  64. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/lamindb_setup/_setup_user.py +0 -0
  65. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/lamindb_setup/_silence_loggers.py +0 -0
  66. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/lamindb_setup/core/__init__.py +0 -0
  67. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/lamindb_setup/core/_aws_options.py +0 -0
  68. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/lamindb_setup/core/_aws_storage.py +0 -0
  69. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/lamindb_setup/core/_deprecated.py +0 -0
  70. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/lamindb_setup/core/_docs.py +0 -0
  71. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/lamindb_setup/core/_hub_crud.py +0 -0
  72. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/lamindb_setup/core/_hub_utils.py +0 -0
  73. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/lamindb_setup/core/_private_django_api.py +0 -0
  74. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/lamindb_setup/core/_settings.py +0 -0
  75. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/lamindb_setup/core/_settings_user.py +0 -0
  76. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/lamindb_setup/core/cloud_sqlite_locker.py +0 -0
  77. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/lamindb_setup/core/exceptions.py +0 -0
  78. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/lamindb_setup/core/hashing.py +0 -0
  79. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/lamindb_setup/core/types.py +0 -0
  80. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/noxfile.py +0 -0
  81. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/tests/hub-cloud/scripts/script-init-pass-user-no-writes.py +0 -0
  82. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/tests/hub-cloud/scripts/script-to-fail-managed-storage.py +0 -0
  83. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/tests/hub-cloud/test_delete_instance.py +0 -0
  84. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/tests/hub-cloud/test_edge_request.py +0 -0
  85. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/tests/hub-cloud/test_fail_managed_storage.py +0 -0
  86. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/tests/hub-cloud/test_init_pass_user_no_writes.py +0 -0
  87. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/tests/hub-cloud/test_login.py +0 -0
  88. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/tests/hub-cloud/test_migrate.py +0 -0
  89. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/tests/hub-cloud/test_set_storage.py +0 -0
  90. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/tests/hub-local/conftest.py +0 -0
  91. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/tests/hub-local/test_update_schema_in_hub.py +0 -0
  92. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/tests/hub-prod/conftest.py +0 -0
  93. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/tests/hub-prod/test_aws_options_manager.py +0 -0
  94. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/tests/hub-prod/test_django.py +0 -0
  95. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/tests/hub-prod/test_global_settings.py +0 -0
  96. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/tests/hub-prod/test_switch_and_fallback_env.py +0 -0
  97. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/tests/hub-prod/test_upath.py +0 -0
  98. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/tests/storage/test_entry_point.py +0 -0
  99. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/tests/storage/test_hashing.py +0 -0
  100. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/tests/storage/test_storage_access.py +0 -0
  101. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/tests/storage/test_storage_basis.py +0 -0
  102. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/tests/storage/test_storage_settings.py +0 -0
  103. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/tests/storage/test_storage_stats.py +0 -0
  104. {lamindb_setup-1.3.1 → lamindb_setup-1.4.0}/tests/storage/test_to_url.py +0 -0
@@ -107,6 +107,6 @@ _build
107
107
  lamin_sphinx
108
108
  docs/conf.py
109
109
  _docs_tmp*
110
- *.lndb
111
- _is_initialized
110
+ *.db
111
+ storage_uid.txt
112
112
  test.ipynb
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: lamindb_setup
3
- Version: 1.3.1
3
+ Version: 1.4.0
4
4
  Summary: Setup & configure LaminDB.
5
5
  Author-email: Lamin Labs <open-source@lamin.ai>
6
6
  Requires-Python: >=3.10
@@ -15,13 +15,13 @@ Requires-Dist: universal_pathlib==0.2.6
15
15
  Requires-Dist: botocore<2.0.0
16
16
  Requires-Dist: supabase>=2.8.1,<=2.11.0
17
17
  Requires-Dist: storage3!=0.11.2; python_version < '3.11'
18
+ Requires-Dist: pyjwt<3.0.0
18
19
  Requires-Dist: psutil
19
20
  Requires-Dist: packaging
20
21
  Requires-Dist: urllib3<2 ; extra == "aws"
21
22
  Requires-Dist: aiobotocore[boto3]>=2.5.4,<3.0.0 ; extra == "aws"
22
23
  Requires-Dist: s3fs>=2023.12.2,<=2025.2.0,!=2024.10.0 ; extra == "aws"
23
24
  Requires-Dist: line_profiler ; extra == "dev"
24
- Requires-Dist: pyjwt<3.0.0 ; extra == "dev"
25
25
  Requires-Dist: psycopg2-binary ; extra == "dev"
26
26
  Requires-Dist: python-dotenv ; extra == "dev"
27
27
  Requires-Dist: nox ; extra == "dev"
@@ -58,7 +58,7 @@
58
58
  "assert ln_setup.settings.storage.id is not None\n",
59
59
  "assert (\n",
60
60
  " ln_setup.settings.instance.db\n",
61
- " == f\"sqlite:///{Path('./mydata').resolve().as_posix()}/{ln_setup.settings.instance._id.hex}.lndb\"\n",
61
+ " == f\"sqlite:///{Path('./mydata').resolve().as_posix()}/.lamindb/lamin.db\"\n",
62
62
  ")\n",
63
63
  "assert ln_setup.settings.storage._instance_id == ln_setup.settings.instance._id\n",
64
64
  "assert (\n",
@@ -128,7 +128,7 @@
128
128
  "assert ln_setup.settings.instance.storage.root == root_path\n",
129
129
  "assert (\n",
130
130
  " ln_setup.settings.instance.db\n",
131
- " == f\"sqlite:///{root_path.as_posix()}/{ln_setup.settings.instance._id.hex}.lndb\"\n",
131
+ " == f\"sqlite:///{root_path.as_posix()}/.lamindb/lamin.db\"\n",
132
132
  ")"
133
133
  ]
134
134
  },
@@ -133,7 +133,7 @@
133
133
  "storage2_uid = ln_setup.settings.storage.uid\n",
134
134
  "assert ln_setup.settings.storage.root_as_str == f\"{Path.cwd()}/storage2\"\n",
135
135
  "assert (\n",
136
- " ln_setup.settings.storage.root / \".lamindb/_is_initialized\"\n",
136
+ " ln_setup.settings.storage.root / \".lamindb/storage_uid.txt\"\n",
137
137
  ").read_text() == ln_setup.settings.storage.uid\n",
138
138
  "assert ln_setup.settings.storage.is_on_hub"
139
139
  ]
@@ -165,7 +165,7 @@
165
165
  "source": [
166
166
  "assert ln_setup.settings.storage.root_as_str == f\"{Path.cwd()}/storage1\"\n",
167
167
  "assert (\n",
168
- " ln_setup.settings.storage.root / \".lamindb/_is_initialized\"\n",
168
+ " ln_setup.settings.storage.root / \".lamindb/storage_uid.txt\"\n",
169
169
  ").read_text() == ln_setup.settings.storage.uid\n",
170
170
  "assert ln_setup.settings.storage.is_on_hub\n",
171
171
  "assert ln_setup.settings.storage.uid == storage1_uid"
@@ -198,7 +198,7 @@
198
198
  "source": [
199
199
  "assert ln_setup.settings.storage.root_as_str == f\"{Path.cwd()}/storage1\"\n",
200
200
  "assert (\n",
201
- " ln_setup.settings.storage.root / \".lamindb/_is_initialized\"\n",
201
+ " ln_setup.settings.storage.root / \".lamindb/storage_uid.txt\"\n",
202
202
  ").read_text() == ln_setup.settings.storage.uid\n",
203
203
  "assert ln_setup.settings.storage.is_on_hub\n",
204
204
  "assert ln_setup.settings.storage.uid == storage1_uid"
@@ -224,7 +224,7 @@
224
224
  "storage2_uid = ln_setup.settings.storage.uid\n",
225
225
  "assert ln_setup.settings.storage.root_as_str == f\"{Path.cwd()}/storage2\"\n",
226
226
  "assert (\n",
227
- " ln_setup.settings.storage.root / \".lamindb/_is_initialized\"\n",
227
+ " ln_setup.settings.storage.root / \".lamindb/storage_uid.txt\"\n",
228
228
  ").read_text() == ln_setup.settings.storage.uid\n",
229
229
  "assert ln_setup.settings.storage.is_on_hub\n",
230
230
  "assert ln_setup.settings.storage.uid == storage2_uid"
@@ -263,7 +263,7 @@
263
263
  "assert ln_setup.settings.storage.root_as_str == \"s3://lamindb-ci/storage3\"\n",
264
264
  "assert ln_setup.settings.storage.region == \"us-west-1\"\n",
265
265
  "assert (\n",
266
- " ln_setup.settings.storage.root / \".lamindb/_is_initialized\"\n",
266
+ " ln_setup.settings.storage.root / \".lamindb/storage_uid.txt\"\n",
267
267
  ").read_text() == ln_setup.settings.storage.uid\n",
268
268
  "# root.fs contains the underlying fsspec filesystem\n",
269
269
  "assert (\n",
@@ -338,13 +338,13 @@
338
338
  "metadata": {},
339
339
  "outputs": [],
340
340
  "source": [
341
- "from laminhub_rest.core.instance.collaborator import InstanceCollaboratorHandler\n",
342
- "from laminhub_rest.core.account.user import UserAccountHandler\n",
341
+ "from laminhub_rest.core.legacy._instance_collaborator import InstanceCollaboratorHandler\n",
342
+ "from laminhub_rest.core.account import AccountHandler\n",
343
343
  "from lamindb_setup.core._hub_client import connect_hub_with_auth\n",
344
344
  "from lamindb.models import User\n",
345
345
  "\n",
346
346
  "admin_hub = connect_hub_with_auth()\n",
347
- "testuser2 = UserAccountHandler(admin_hub).get_by_handle(\"testuser2\")\n",
347
+ "testuser2 = AccountHandler(admin_hub).get_by_handle(\"testuser2\")\n",
348
348
  "InstanceCollaboratorHandler(admin_hub).add(\n",
349
349
  " instance_id=instance_id,\n",
350
350
  " account_id=testuser2.id,\n",
@@ -457,7 +457,7 @@
457
457
  "name": "python",
458
458
  "nbconvert_exporter": "python",
459
459
  "pygments_lexer": "ipython3",
460
- "version": "3.9.17"
460
+ "version": "3.10.16"
461
461
  },
462
462
  "vscode": {
463
463
  "interpreter": {
@@ -70,10 +70,7 @@
70
70
  },
71
71
  "outputs": [],
72
72
  "source": [
73
- "from bionty.base import settings as bionty_base_settings\n",
74
- "\n",
75
- "assert sources_df.shape[0] > 0\n",
76
- "assert bionty_base_settings.lamindb_sources.exists()"
73
+ "assert sources_df.shape[0] > 0"
77
74
  ]
78
75
  },
79
76
  {
@@ -140,7 +137,7 @@
140
137
  ],
141
138
  "metadata": {
142
139
  "kernelspec": {
143
- "display_name": "Python 3 (ipykernel)",
140
+ "display_name": "py310",
144
141
  "language": "python",
145
142
  "name": "python3"
146
143
  },
@@ -155,11 +152,6 @@
155
152
  "nbconvert_exporter": "python",
156
153
  "pygments_lexer": "ipython3",
157
154
  "version": "3.10.13"
158
- },
159
- "vscode": {
160
- "interpreter": {
161
- "hash": "61b4062b24dfb1010f420dad5aa3bd73a4d2af47d0ec44eafec465a35a9d7239"
162
- }
163
155
  }
164
156
  },
165
157
  "nbformat": 4,
@@ -31,8 +31,7 @@
31
31
  "assert ln_setup.settings.instance.storage.type_is_cloud\n",
32
32
  "assert ln_setup.settings.instance.storage.root_as_str == storage\n",
33
33
  "assert (\n",
34
- " ln_setup.settings.instance._sqlite_file.as_posix()\n",
35
- " == f\"{storage}/{ln_setup.settings.instance._id.hex}.lndb\"\n",
34
+ " ln_setup.settings.instance._sqlite_file.as_posix() == f\"{storage}/.lamindb/lamin.db\"\n",
36
35
  ")"
37
36
  ]
38
37
  },
@@ -75,7 +74,7 @@
75
74
  " == UPath(\"./my_storage_local\").resolve().as_posix()\n",
76
75
  ")\n",
77
76
  "assert (\n",
78
- " ln_setup.settings.instance.storage_local.root / \".lamindb/_is_initialized\"\n",
77
+ " ln_setup.settings.instance.storage_local.root / \".lamindb/storage_uid.txt\"\n",
79
78
  ").read_text() == ln_setup.settings.instance.storage_local.uid\n",
80
79
  "assert ln_setup.settings.instance.storage_local is not None\n",
81
80
  "# the remote storage location is still in the regular slot\n",
@@ -109,7 +108,7 @@
109
108
  " == UPath(\"./my_storage_local2\").resolve().as_posix()\n",
110
109
  ")\n",
111
110
  "assert (\n",
112
- " ln_setup.settings.instance.storage_local.root / \".lamindb/_is_initialized\"\n",
111
+ " ln_setup.settings.instance.storage_local.root / \".lamindb/storage_uid.txt\"\n",
113
112
  ").read_text() == ln_setup.settings.instance.storage_local.uid"
114
113
  ]
115
114
  },
@@ -74,10 +74,7 @@
74
74
  "assert ln_setup.settings.storage.type_is_cloud\n",
75
75
  "assert ln_setup.settings.storage.root_as_str == root_str\n",
76
76
  "assert ln_setup.settings.storage.region == \"us-east-1\"\n",
77
- "assert (\n",
78
- " str(ln_setup.settings.instance._sqlite_file)\n",
79
- " == f\"{root_str}/{ln_setup.settings.instance._id.hex}.lndb\"\n",
80
- ")"
77
+ "assert str(ln_setup.settings.instance._sqlite_file) == f\"{root_str}/.lamindb/lamin.db\""
81
78
  ]
82
79
  },
83
80
  {
@@ -33,7 +33,7 @@ Modules & settings:
33
33
 
34
34
  """
35
35
 
36
- __version__ = "1.3.1" # denote a release candidate for 0.1.0 with 0.1rc1
36
+ __version__ = "1.4.0" # denote a release candidate for 0.1.0 with 0.1rc1
37
37
 
38
38
  import os
39
39
 
@@ -4,7 +4,6 @@ from lamin_utils import logger
4
4
 
5
5
  from .core._settings import settings
6
6
  from .core._settings_store import current_instance_settings_file
7
- from .core._setup_bionty_sources import delete_bionty_sources_yaml
8
7
  from .core.cloud_sqlite_locker import clear_locker
9
8
 
10
9
 
@@ -24,8 +23,6 @@ def close(mute: bool = False) -> None:
24
23
  logger.warning("did not upload cache file - not enough permissions")
25
24
  else:
26
25
  raise e
27
- if "bionty" in settings.instance.modules:
28
- delete_bionty_sources_yaml()
29
26
  current_instance_settings_file().unlink()
30
27
  clear_locker()
31
28
  if not mute:
@@ -169,6 +169,7 @@ def _connect_instance(
169
169
  if (schema_id := instance_result["schema_id"]) is None
170
170
  else UUID(schema_id),
171
171
  fine_grained_access=instance_result.get("fine_grained_access", False),
172
+ db_permissions=instance_result.get("db_permissions", None),
172
173
  )
173
174
  else:
174
175
  if hub_result != "anonymous-user":
@@ -131,7 +131,7 @@ def delete(slug: str, force: bool = False, require_empty: bool = True) -> int |
131
131
  # this will error if the user doesn't have permission
132
132
  delete_instance_on_hub(isettings._id, require_empty=False)
133
133
  delete_by_isettings(isettings)
134
- # if .lndb file was delete, then we might count -1
134
+ # if lamin.db file was delete, then we might count -1
135
135
  if n_files <= 0 and isettings.storage.type == "local":
136
136
  # dir is only empty after sqlite file was delete via delete_by_isettings
137
137
  if (isettings.storage.root / ".lamindb").exists():
@@ -14,6 +14,7 @@ from lamin_utils import logger
14
14
  from ._close import close as close_instance
15
15
  from ._silence_loggers import silence_loggers
16
16
  from .core import InstanceSettings
17
+ from .core._docs import doc_args
17
18
  from .core._settings import settings
18
19
  from .core._settings_instance import is_local_db_url
19
20
  from .core._settings_storage import StorageSettings, init_storage
@@ -95,11 +96,16 @@ def register_user(usettings):
95
96
  pass
96
97
 
97
98
 
98
- def register_user_and_storage_in_instance(isettings: InstanceSettings, usettings):
99
- """Register user & storage in DB."""
99
+ def register_initial_records(isettings: InstanceSettings, usettings):
100
+ """Register space, user & storage in DB."""
100
101
  from django.db.utils import OperationalError
102
+ from lamindb.models import Space
101
103
 
102
104
  try:
105
+ Space.objects.get_or_create(
106
+ name="All",
107
+ description="Every team & user with access to the instance has access.",
108
+ )
103
109
  register_user(usettings)
104
110
  register_storage_in_instance(isettings.storage)
105
111
  except OperationalError as error:
@@ -208,22 +214,32 @@ ln.Artifact.using("laminlabs/cellxgene").filter()
208
214
  Or do you want to switch off auto-connect via `lamin settings set auto-connect false`?
209
215
  """
210
216
 
217
+ DOC_STORAGE_ARG = "A local or remote folder (`'s3://...'` or `'gs://...'`). Defaults to current working directory."
218
+ DOC_INSTANCE_NAME = (
219
+ "Instance name. If not passed, it will equal the folder name passed to `storage`."
220
+ )
221
+ DOC_DB = "Database connection URL. Defaults to `None`, which implies an SQLite file in the storage location."
222
+ DOC_MODULES = "Comma-separated string of schema modules."
223
+ DOC_LOW_LEVEL_KWARGS = "Keyword arguments for low-level control."
224
+
211
225
 
226
+ @doc_args(DOC_STORAGE_ARG, DOC_INSTANCE_NAME, DOC_DB, DOC_MODULES, DOC_LOW_LEVEL_KWARGS)
212
227
  def init(
213
228
  *,
214
- storage: UPathStr,
229
+ storage: UPathStr = ".",
215
230
  name: str | None = None,
216
231
  db: PostgresDsn | None = None,
217
232
  modules: str | None = None,
218
233
  **kwargs,
219
234
  ) -> None:
220
- """Create and load a LaminDB instance.
235
+ """Init a LaminDB instance.
221
236
 
222
237
  Args:
223
- storage: Either local or remote folder (`"s3://..."` or `"gs://..."`).
224
- name: Instance name.
225
- db: Database connection url, do not pass for SQLite.
226
- modules: Comma-separated string of modules. None if the lamindb registries are enough.
238
+ storage: {}
239
+ name: {}
240
+ db: {}
241
+ modules: {}
242
+ **kwargs: {}
227
243
  """
228
244
  isettings = None
229
245
  ssettings = None
@@ -359,8 +375,8 @@ def load_from_isettings(
359
375
  user = settings.user if user is None else user
360
376
 
361
377
  if init:
362
- # during init both user and storage need to be registered
363
- register_user_and_storage_in_instance(isettings, user)
378
+ # during init space, user and storage need to be registered
379
+ register_initial_records(isettings, user)
364
380
  write_bionty_sources(isettings)
365
381
  isettings._update_cloud_sqlite_file(unlock_cloud_sqlite=False)
366
382
  else:
@@ -47,16 +47,20 @@ def check_whether_migrations_in_sync(db_version_str: str):
47
47
  f"the database ({db_version_str}) is far behind your installed lamindb package"
48
48
  f" ({installed_version_str})"
49
49
  )
50
- logger.important("migrate your database: lamin migrate deploy")
50
+ logger.important(
51
+ "if you are an admin, migrate your database: lamin migrate deploy"
52
+ )
51
53
  elif (
52
54
  installed_version.major == db_version.major
53
55
  and installed_version.minor > db_version.minor
54
56
  ):
55
- logger.important(
56
- f"the database ({db_version_str}) is behind your installed lamindb package"
57
- f" ({installed_version_str})"
58
- )
59
- logger.important("consider migrating your database: lamin migrate deploy")
57
+ pass
58
+ # if the database is behind by a minor version, we don't want to spam the user
59
+ # logger.important(
60
+ # f"the database ({db_version_str}) is behind your installed lamindb package"
61
+ # f" ({installed_version_str})"
62
+ # )
63
+ # logger.important("consider migrating your database: lamin migrate deploy")
60
64
 
61
65
 
62
66
  # for tests, see lamin-cli
@@ -31,7 +31,7 @@ def set_managed_storage(root: UPathStr, **fs_kwargs):
31
31
  )
32
32
  # here the storage is registered in the hub
33
33
  # hub_record_status="hub-record-created" if a new record is created
34
- # "hub-record-retireved" if the storage is in the hub already
34
+ # "hub-record-retrieved" if the storage is in the hub already
35
35
  ssettings, hub_record_status = init_storage(
36
36
  root=root, instance_id=settings.instance._id, register_hub=True
37
37
  )
@@ -69,7 +69,9 @@ def connect_hub(
69
69
  # function_client_timeout=5 by default
70
70
  # increase to avoid rare timeouts for edge functions
71
71
  client_options = ClientOptions(
72
- auto_refresh_token=False, function_client_timeout=10
72
+ auto_refresh_token=False,
73
+ function_client_timeout=20,
74
+ postgrest_client_timeout=20,
73
75
  )
74
76
  return create_client(env.supabase_api_url, env.supabase_anon_key, client_options)
75
77
 
@@ -7,6 +7,7 @@ from importlib import metadata
7
7
  from typing import TYPE_CHECKING, Literal
8
8
  from uuid import UUID
9
9
 
10
+ import jwt
10
11
  from lamin_utils import logger
11
12
  from postgrest.exceptions import APIError
12
13
 
@@ -121,7 +122,7 @@ def init_storage_hub(
121
122
  auto_populate_instance: bool = True,
122
123
  created_by: UUID | None = None,
123
124
  access_token: str | None = None,
124
- ) -> Literal["hub-record-retireved", "hub-record-created"]:
125
+ ) -> Literal["hub-record-retrieved", "hub-record-created"]:
125
126
  if settings.user.handle != "anonymous" or access_token is not None:
126
127
  return call_with_fallback_auth(
127
128
  _init_storage_hub,
@@ -135,7 +136,7 @@ def init_storage_hub(
135
136
  _select_storage, ssettings=ssettings, update_uid=True
136
137
  )
137
138
  if storage_exists:
138
- return "hub-record-retireved"
139
+ return "hub-record-retrieved"
139
140
  else:
140
141
  raise ValueError("Log in to create a storage location on the hub.")
141
142
 
@@ -145,7 +146,7 @@ def _init_storage_hub(
145
146
  ssettings: StorageSettings,
146
147
  auto_populate_instance: bool,
147
148
  created_by: UUID | None = None,
148
- ) -> Literal["hub-record-retireved", "hub-record-created"]:
149
+ ) -> Literal["hub-record-retrieved", "hub-record-created"]:
149
150
  from lamindb_setup import settings
150
151
 
151
152
  created_by = settings.user._uuid if created_by is None else created_by
@@ -153,7 +154,7 @@ def _init_storage_hub(
153
154
  # database
154
155
  root = ssettings.root_as_str
155
156
  if _select_storage(ssettings, update_uid=True, client=client):
156
- return "hub-record-retireved"
157
+ return "hub-record-retrieved"
157
158
  if ssettings.type_is_cloud:
158
159
  id = uuid.uuid5(uuid.NAMESPACE_URL, root)
159
160
  else:
@@ -548,7 +549,7 @@ def _sign_in_hub_api_key(api_key: str, client: Client):
548
549
  access_token = json.loads(response)["accessToken"]
549
550
  # probably need more info here to avoid additional queries
550
551
  # like handle, uid etc
551
- account_id = client.auth._decode_jwt(access_token)["sub"]
552
+ account_id = jwt.decode(access_token, options={"verify_signature": False})["sub"]
552
553
  client.postgrest.auth(access_token)
553
554
  # normally public.account.id is equal to auth.user.id
554
555
  data = client.table("account").select("*").eq("id", account_id).execute().data
@@ -13,7 +13,12 @@ from ._hub_client import call_with_fallback
13
13
  from ._hub_crud import select_account_handle_name_by_lnid
14
14
  from ._hub_utils import LaminDsn, LaminDsnModel
15
15
  from ._settings_save import save_instance_settings
16
- from ._settings_storage import StorageSettings, init_storage, mark_storage_root
16
+ from ._settings_storage import (
17
+ LEGACY_STORAGE_UID_FILE_KEY,
18
+ STORAGE_UID_FILE_KEY,
19
+ StorageSettings,
20
+ init_storage,
21
+ )
17
22
  from ._settings_store import current_instance_settings_file, instance_settings_file
18
23
  from .cloud_sqlite_locker import (
19
24
  EXPIRATION_TIME,
@@ -60,6 +65,7 @@ class InstanceSettings:
60
65
  api_url: str | None = None,
61
66
  schema_id: UUID | None = None,
62
67
  fine_grained_access: bool = False,
68
+ db_permissions: str | None = None,
63
69
  _locker_user: UserSettings | None = None, # user to lock for if cloud sqlite
64
70
  ):
65
71
  from ._hub_utils import validate_db_arg
@@ -83,6 +89,8 @@ class InstanceSettings:
83
89
  # private, whether fine grained access is used
84
90
  # needed to be set to request jwt etc
85
91
  self._fine_grained_access = fine_grained_access
92
+ # permissions for db such as jwt, read, write etc.
93
+ self._db_permissions = db_permissions
86
94
  # if None then settings.user is used
87
95
  self._locker_user = _locker_user
88
96
 
@@ -144,32 +152,27 @@ class InstanceSettings:
144
152
  for record in all_local_records:
145
153
  root_path = Path(record.root)
146
154
  if root_path.exists():
147
- marker_path = root_path / ".lamindb/_is_initialized"
148
- if marker_path.exists():
149
- try:
150
- uid = marker_path.read_text()
151
- except PermissionError:
155
+ marker_path = root_path / STORAGE_UID_FILE_KEY
156
+ if not marker_path.exists():
157
+ legacy_filepath = root_path / LEGACY_STORAGE_UID_FILE_KEY
158
+ if legacy_filepath.exists():
152
159
  logger.warning(
153
- f"ignoring the following location because no permission to read it: {marker_path}"
160
+ f"found legacy marker file, renaming it from {legacy_filepath} to {marker_path}"
154
161
  )
155
- continue
156
- if uid == record.uid:
157
- found = True
158
- break
159
- elif uid == "":
160
- try:
161
- # legacy instance that was not yet marked properly
162
- mark_storage_root(record.root, record.uid)
163
- except PermissionError:
164
- logger.warning(
165
- f"ignoring the following location because no permission to write to it: {marker_path}"
166
- )
167
- continue
162
+ legacy_filepath.rename(marker_path)
168
163
  else:
169
- continue
170
- else:
171
- # legacy instance that was not yet marked at all
172
- mark_storage_root(record.root, record.uid)
164
+ raise ValueError(
165
+ f"local storage location '{root_path}' is corrupted, cannot find marker file with storage uid"
166
+ )
167
+ try:
168
+ uid = marker_path.read_text()
169
+ except PermissionError:
170
+ logger.warning(
171
+ f"ignoring the following location because no permission to read it: {marker_path}"
172
+ )
173
+ continue
174
+ if uid == record.uid:
175
+ found = True
173
176
  break
174
177
  if found:
175
178
  return StorageSettings(record.root)
@@ -295,7 +298,8 @@ class InstanceSettings:
295
298
  @property
296
299
  def _sqlite_file(self) -> UPath:
297
300
  """SQLite file."""
298
- return self.storage.key_to_filepath(f"{self._id.hex}.lndb")
301
+ filepath = self.storage.root / ".lamindb/lamin.db"
302
+ return filepath
299
303
 
300
304
  @property
301
305
  def _sqlite_file_local(self) -> Path:
@@ -477,24 +481,18 @@ class InstanceSettings:
477
481
 
478
482
  disable_auto_connect(setup_django)(self, init=True)
479
483
 
480
- from lamindb.models import Space
481
-
482
- Space.objects.get_or_create(
483
- name="All",
484
- description="Every team & user with access to the instance has access.",
485
- )
486
-
487
484
  def _load_db(self) -> tuple[bool, str]:
488
485
  # Is the database available and initialized as LaminDB?
489
486
  # returns a tuple of status code and message
490
487
  if self.dialect == "sqlite" and not self._sqlite_file.exists():
491
- legacy_file = self.storage.key_to_filepath(f"{self.name}.lndb")
488
+ legacy_file = self.storage.key_to_filepath(f"{self._id.hex}.lndb")
492
489
  if legacy_file.exists():
493
- raise RuntimeError(
494
- "The SQLite file has been renamed!\nPlease rename your SQLite file"
495
- f" {legacy_file} to {self._sqlite_file}"
490
+ logger.warning(
491
+ f"The SQLite file is being renamed from {legacy_file} to {self._sqlite_file}"
496
492
  )
497
- return False, f"SQLite file {self._sqlite_file} does not exist"
493
+ legacy_file.rename(self._sqlite_file)
494
+ else:
495
+ return False, f"SQLite file {self._sqlite_file} does not exist"
498
496
  # we need the local sqlite to setup django
499
497
  self._update_local_sqlite_file()
500
498
  # setting up django also performs a check for migrations & prints them
@@ -104,6 +104,7 @@ def setup_instance_from_store(store: InstanceSettingsStore) -> InstanceSettings:
104
104
  api_url=_null_to_value(store.api_url),
105
105
  schema_id=None if store.schema_id == "null" else UUID(store.schema_id),
106
106
  fine_grained_access=store.fine_grained_access,
107
+ db_permissions=_null_to_value(store.db_permissions),
107
108
  )
108
109
 
109
110
 
@@ -61,6 +61,7 @@ def save_settings(
61
61
  "api_url",
62
62
  "schema_id",
63
63
  "fine_grained_access",
64
+ "db_permissions",
64
65
  }:
65
66
  settings_key = f"_{store_key.rstrip('_')}"
66
67
  else: