lamindb_setup 1.6.0__tar.gz → 1.7.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.
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/.github/workflows/build.yml +7 -7
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/PKG-INFO +2 -2
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/docs/hub-cloud/01-init-local-instance.ipynb +18 -5
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/docs/hub-cloud/02-connect-local-instance.ipynb +1 -3
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/docs/hub-cloud/03-add-managed-storage.ipynb +55 -13
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/docs/hub-cloud/05-init-hosted-instance.ipynb +4 -4
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/docs/hub-cloud/06-connect-hosted-instance.ipynb +2 -2
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/docs/hub-cloud/07-keep-artifacts-local.ipynb +31 -5
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/docs/hub-cloud/08-test-multi-session.ipynb +10 -37
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/docs/hub-prod/test-cache-management.ipynb +140 -16
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/docs/hub-prod/test-init-load-local-anonymously.ipynb +1 -1
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/lamindb_setup/__init__.py +5 -3
- lamindb_setup-1.7.0/lamindb_setup/_cache.py +87 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/lamindb_setup/_check_setup.py +9 -22
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/lamindb_setup/_connect_instance.py +11 -159
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/lamindb_setup/_init_instance.py +39 -53
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/lamindb_setup/_register_instance.py +1 -1
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/lamindb_setup/_schema_metadata.py +4 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/lamindb_setup/_set_managed_storage.py +6 -4
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/lamindb_setup/core/__init__.py +1 -1
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/lamindb_setup/core/_aws_options.py +3 -3
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/lamindb_setup/core/_hub_client.py +17 -7
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/lamindb_setup/core/_hub_core.py +70 -37
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/lamindb_setup/core/_hub_crud.py +17 -3
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/lamindb_setup/core/_settings.py +28 -10
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/lamindb_setup/core/_settings_instance.py +8 -5
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/lamindb_setup/core/_settings_load.py +23 -14
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/lamindb_setup/core/_settings_save.py +5 -4
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/lamindb_setup/core/_settings_storage.py +106 -49
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/lamindb_setup/core/_settings_store.py +11 -2
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/lamindb_setup/core/cloud_sqlite_locker.py +10 -7
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/lamindb_setup/core/django.py +7 -2
- lamindb_setup-1.7.0/lamindb_setup/core/exceptions.py +1 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/lamindb_setup/core/hashing.py +1 -1
- lamindb_setup-1.7.0/lamindb_setup/core/types.py +1 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/lamindb_setup/core/upath.py +17 -11
- lamindb_setup-1.7.0/lamindb_setup/errors.py +70 -0
- lamindb_setup-1.7.0/lamindb_setup/py.typed +0 -0
- {lamindb_setup-1.6.0/lamindb_setup/core → lamindb_setup-1.7.0/lamindb_setup}/types.py +6 -3
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/noxfile.py +1 -1
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/pyproject.toml +1 -1
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/tests/hub-cloud/test_connect_instance.py +26 -1
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/tests/hub-cloud/test_init_instance.py +7 -27
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/tests/hub-cloud/test_init_pass_user_no_writes.py +19 -3
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/tests/hub-local/scripts/script-connect-fine-grained-access.py +5 -4
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/tests/hub-local/test_all.py +37 -12
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/tests/hub-prod/conftest.py +1 -1
- lamindb_setup-1.6.0/lamindb_setup/_cache.py +0 -52
- lamindb_setup-1.6.0/lamindb_setup/core/exceptions.py +0 -10
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/.github/workflows/doc-changes.yml +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/.gitignore +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/.pre-commit-config.yaml +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/LICENSE +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/README.md +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/docs/changelog.md +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/docs/hub-cloud/04-test-bionty.ipynb +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/docs/hub-cloud/test_notebooks.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/docs/hub-prod/test-cloud-sync.ipynb +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/docs/hub-prod/test-connect-anonymously.ipynb +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/docs/hub-prod/test-empty-init.ipynb +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/docs/hub-prod/test-import-schema.ipynb +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/docs/hub-prod/test-insufficient-user-info.ipynb +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/docs/hub-prod/test-invalid-schema.ipynb +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/docs/hub-prod/test-sqlite-lock.ipynb +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/docs/hub-prod/test_notebooks2.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/docs/index.md +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/docs/notebooks.md +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/docs/reference.md +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/lamindb_setup/_check.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/lamindb_setup/_delete.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/lamindb_setup/_disconnect.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/lamindb_setup/_django.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/lamindb_setup/_entry_points.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/lamindb_setup/_exportdb.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/lamindb_setup/_importdb.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/lamindb_setup/_migrate.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/lamindb_setup/_schema.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/lamindb_setup/_setup_user.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/lamindb_setup/_silence_loggers.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/lamindb_setup/core/_aws_storage.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/lamindb_setup/core/_deprecated.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/lamindb_setup/core/_docs.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/lamindb_setup/core/_hub_utils.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/lamindb_setup/core/_private_django_api.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/lamindb_setup/core/_settings_user.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/lamindb_setup/core/_setup_bionty_sources.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/tests/hub-cloud/scripts/script-init-pass-user-no-writes.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/tests/hub-cloud/scripts/script-to-fail-managed-storage.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/tests/hub-cloud/test_delete_instance.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/tests/hub-cloud/test_edge_request.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/tests/hub-cloud/test_fail_managed_storage.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/tests/hub-cloud/test_login.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/tests/hub-cloud/test_migrate.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/tests/hub-cloud/test_set_storage.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/tests/hub-local/conftest.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/tests/hub-local/test_update_schema_in_hub.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/tests/hub-prod/test_aws_options_manager.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/tests/hub-prod/test_django.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/tests/hub-prod/test_global_settings.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/tests/hub-prod/test_switch_and_fallback_env.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/tests/hub-prod/test_upath.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/tests/storage/test_entry_point.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/tests/storage/test_hashing.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/tests/storage/test_storage_access.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/tests/storage/test_storage_basis.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/tests/storage/test_storage_settings.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/tests/storage/test_storage_stats.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.7.0}/tests/storage/test_to_url.py +0 -0
|
@@ -14,10 +14,10 @@ jobs:
|
|
|
14
14
|
runs-on: ubuntu-latest
|
|
15
15
|
timeout-minutes: 12
|
|
16
16
|
steps:
|
|
17
|
-
- uses: actions/checkout@
|
|
18
|
-
- uses: actions/setup-python@
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
- uses: actions/setup-python@v5
|
|
19
19
|
with:
|
|
20
|
-
python-version: "3.10"
|
|
20
|
+
python-version: "3.10"
|
|
21
21
|
cache: "pip"
|
|
22
22
|
- uses: aws-actions/configure-aws-credentials@v4
|
|
23
23
|
with:
|
|
@@ -35,7 +35,7 @@ jobs:
|
|
|
35
35
|
|
|
36
36
|
# tests both on production and staging hub
|
|
37
37
|
hub-cloud:
|
|
38
|
-
runs-on: ubuntu-
|
|
38
|
+
runs-on: ubuntu-latest
|
|
39
39
|
strategy:
|
|
40
40
|
fail-fast: false
|
|
41
41
|
matrix:
|
|
@@ -43,7 +43,7 @@ jobs:
|
|
|
43
43
|
- lamin_env: "prod"
|
|
44
44
|
python-version: "3.11"
|
|
45
45
|
- lamin_env: "staging"
|
|
46
|
-
python-version: "3.10"
|
|
46
|
+
python-version: "3.10"
|
|
47
47
|
timeout-minutes: 12
|
|
48
48
|
steps:
|
|
49
49
|
- uses: aws-actions/configure-aws-credentials@v4
|
|
@@ -97,7 +97,7 @@ jobs:
|
|
|
97
97
|
timeout-minutes: 12
|
|
98
98
|
steps:
|
|
99
99
|
- uses: actions/checkout@v4
|
|
100
|
-
- uses: actions/setup-python@
|
|
100
|
+
- uses: actions/setup-python@v5
|
|
101
101
|
with:
|
|
102
102
|
python-version: "3.10"
|
|
103
103
|
cache: "pip"
|
|
@@ -205,7 +205,7 @@ jobs:
|
|
|
205
205
|
ssh-key: ${{ secrets.READ_LNDOCS }}
|
|
206
206
|
path: lndocs
|
|
207
207
|
ref: main
|
|
208
|
-
- uses: actions/setup-python@
|
|
208
|
+
- uses: actions/setup-python@v5
|
|
209
209
|
with:
|
|
210
210
|
python-version: "3.10"
|
|
211
211
|
cache: "pip"
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: lamindb_setup
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.7.0
|
|
4
4
|
Summary: Setup & configure LaminDB.
|
|
5
5
|
Author-email: Lamin Labs <open-source@lamin.ai>
|
|
6
6
|
Requires-Python: >=3.10
|
|
@@ -9,7 +9,7 @@ Requires-Dist: lamin_utils>=0.3.3
|
|
|
9
9
|
Requires-Dist: django>=5.1,<5.2
|
|
10
10
|
Requires-Dist: dj_database_url>=1.3.0,<3.0.0
|
|
11
11
|
Requires-Dist: pydantic-settings
|
|
12
|
-
Requires-Dist:
|
|
12
|
+
Requires-Dist: platformdirs<5.0.0
|
|
13
13
|
Requires-Dist: requests
|
|
14
14
|
Requires-Dist: universal_pathlib==0.2.6
|
|
15
15
|
Requires-Dist: botocore<2.0.0
|
|
@@ -27,6 +27,15 @@
|
|
|
27
27
|
"import lamindb_setup as ln_setup"
|
|
28
28
|
]
|
|
29
29
|
},
|
|
30
|
+
{
|
|
31
|
+
"cell_type": "code",
|
|
32
|
+
"execution_count": null,
|
|
33
|
+
"metadata": {},
|
|
34
|
+
"outputs": [],
|
|
35
|
+
"source": [
|
|
36
|
+
"assert not ln_setup.settings.is_connected"
|
|
37
|
+
]
|
|
38
|
+
},
|
|
30
39
|
{
|
|
31
40
|
"cell_type": "code",
|
|
32
41
|
"execution_count": null,
|
|
@@ -36,6 +45,15 @@
|
|
|
36
45
|
"ln_setup.init(storage=\"./mydata\")"
|
|
37
46
|
]
|
|
38
47
|
},
|
|
48
|
+
{
|
|
49
|
+
"cell_type": "code",
|
|
50
|
+
"execution_count": null,
|
|
51
|
+
"metadata": {},
|
|
52
|
+
"outputs": [],
|
|
53
|
+
"source": [
|
|
54
|
+
"assert ln_setup.settings.is_connected"
|
|
55
|
+
]
|
|
56
|
+
},
|
|
39
57
|
{
|
|
40
58
|
"cell_type": "code",
|
|
41
59
|
"execution_count": null,
|
|
@@ -107,11 +125,6 @@
|
|
|
107
125
|
"nbconvert_exporter": "python",
|
|
108
126
|
"pygments_lexer": "ipython3",
|
|
109
127
|
"version": "3.10.16"
|
|
110
|
-
},
|
|
111
|
-
"vscode": {
|
|
112
|
-
"interpreter": {
|
|
113
|
-
"hash": "40d3a090f54c6569ab1632332b64b2c03c39dcf918b08424e98f38b5ae0af88f"
|
|
114
|
-
}
|
|
115
128
|
}
|
|
116
129
|
},
|
|
117
130
|
"nbformat": 4,
|
|
@@ -147,9 +147,7 @@
|
|
|
147
147
|
"metadata": {},
|
|
148
148
|
"outputs": [],
|
|
149
149
|
"source": [
|
|
150
|
-
"
|
|
151
|
-
"ln_setup.delete(\"mydata\", force=True)\n",
|
|
152
|
-
"assert not ln_setup.settings._instance_settings_path.exists()"
|
|
150
|
+
"ln_setup.delete(\"mydata\", force=True)"
|
|
153
151
|
]
|
|
154
152
|
}
|
|
155
153
|
],
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
"tags": []
|
|
8
8
|
},
|
|
9
9
|
"source": [
|
|
10
|
-
"# Add managed storage"
|
|
10
|
+
"# Add managed and referenced storage locations"
|
|
11
11
|
]
|
|
12
12
|
},
|
|
13
13
|
{
|
|
@@ -27,6 +27,24 @@
|
|
|
27
27
|
"!docker stop pgtest && docker rm pgtest"
|
|
28
28
|
]
|
|
29
29
|
},
|
|
30
|
+
{
|
|
31
|
+
"cell_type": "markdown",
|
|
32
|
+
"id": "6dcaa297",
|
|
33
|
+
"metadata": {},
|
|
34
|
+
"source": [
|
|
35
|
+
"Create a local instance that's not registered on the hub, so that we can test interplay."
|
|
36
|
+
]
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"cell_type": "code",
|
|
40
|
+
"execution_count": null,
|
|
41
|
+
"id": "599eae6a",
|
|
42
|
+
"metadata": {},
|
|
43
|
+
"outputs": [],
|
|
44
|
+
"source": [
|
|
45
|
+
"!lamin init --storage \"./storage-of-another-instance\""
|
|
46
|
+
]
|
|
47
|
+
},
|
|
30
48
|
{
|
|
31
49
|
"cell_type": "code",
|
|
32
50
|
"execution_count": null,
|
|
@@ -65,6 +83,35 @@
|
|
|
65
83
|
"ln_setup.init(storage=\"./storage1\", name=\"test-add-managed-storage\", db=pgurl)"
|
|
66
84
|
]
|
|
67
85
|
},
|
|
86
|
+
{
|
|
87
|
+
"cell_type": "markdown",
|
|
88
|
+
"id": "b62e84cb",
|
|
89
|
+
"metadata": {},
|
|
90
|
+
"source": [
|
|
91
|
+
"Test adding referenced storage location."
|
|
92
|
+
]
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
"cell_type": "code",
|
|
96
|
+
"execution_count": null,
|
|
97
|
+
"id": "dbf195e3",
|
|
98
|
+
"metadata": {},
|
|
99
|
+
"outputs": [],
|
|
100
|
+
"source": [
|
|
101
|
+
"import lamindb as ln\n",
|
|
102
|
+
"\n",
|
|
103
|
+
"storage = ln.Storage(root=\"./storage-of-another-instance\").save()\n",
|
|
104
|
+
"assert storage.instance_uid == \"__unknown__\""
|
|
105
|
+
]
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"cell_type": "markdown",
|
|
109
|
+
"id": "93234f70",
|
|
110
|
+
"metadata": {},
|
|
111
|
+
"source": [
|
|
112
|
+
"Now continue with managed storage locations."
|
|
113
|
+
]
|
|
114
|
+
},
|
|
68
115
|
{
|
|
69
116
|
"cell_type": "code",
|
|
70
117
|
"execution_count": null,
|
|
@@ -134,7 +181,7 @@
|
|
|
134
181
|
"assert ln_setup.settings.storage.root_as_str == f\"{Path.cwd()}/storage2\"\n",
|
|
135
182
|
"assert (\n",
|
|
136
183
|
" ln_setup.settings.storage.root / \".lamindb/storage_uid.txt\"\n",
|
|
137
|
-
").read_text() == ln_setup.settings.storage.uid\n",
|
|
184
|
+
").read_text().splitlines()[0] == ln_setup.settings.storage.uid\n",
|
|
138
185
|
"assert ln_setup.settings.storage.is_on_hub"
|
|
139
186
|
]
|
|
140
187
|
},
|
|
@@ -166,7 +213,7 @@
|
|
|
166
213
|
"assert ln_setup.settings.storage.root_as_str == f\"{Path.cwd()}/storage1\"\n",
|
|
167
214
|
"assert (\n",
|
|
168
215
|
" ln_setup.settings.storage.root / \".lamindb/storage_uid.txt\"\n",
|
|
169
|
-
").read_text() == ln_setup.settings.storage.uid\n",
|
|
216
|
+
").read_text().splitlines()[0] == ln_setup.settings.storage.uid\n",
|
|
170
217
|
"assert ln_setup.settings.storage.is_on_hub\n",
|
|
171
218
|
"assert ln_setup.settings.storage.uid == storage1_uid"
|
|
172
219
|
]
|
|
@@ -199,7 +246,7 @@
|
|
|
199
246
|
"assert ln_setup.settings.storage.root_as_str == f\"{Path.cwd()}/storage1\"\n",
|
|
200
247
|
"assert (\n",
|
|
201
248
|
" ln_setup.settings.storage.root / \".lamindb/storage_uid.txt\"\n",
|
|
202
|
-
").read_text() == ln_setup.settings.storage.uid\n",
|
|
249
|
+
").read_text().splitlines()[0] == ln_setup.settings.storage.uid\n",
|
|
203
250
|
"assert ln_setup.settings.storage.is_on_hub\n",
|
|
204
251
|
"assert ln_setup.settings.storage.uid == storage1_uid"
|
|
205
252
|
]
|
|
@@ -225,7 +272,7 @@
|
|
|
225
272
|
"assert ln_setup.settings.storage.root_as_str == f\"{Path.cwd()}/storage2\"\n",
|
|
226
273
|
"assert (\n",
|
|
227
274
|
" ln_setup.settings.storage.root / \".lamindb/storage_uid.txt\"\n",
|
|
228
|
-
").read_text() == ln_setup.settings.storage.uid\n",
|
|
275
|
+
").read_text().splitlines()[0] == ln_setup.settings.storage.uid\n",
|
|
229
276
|
"assert ln_setup.settings.storage.is_on_hub\n",
|
|
230
277
|
"assert ln_setup.settings.storage.uid == storage2_uid"
|
|
231
278
|
]
|
|
@@ -264,7 +311,7 @@
|
|
|
264
311
|
"assert ln_setup.settings.storage.region == \"us-west-1\"\n",
|
|
265
312
|
"assert (\n",
|
|
266
313
|
" ln_setup.settings.storage.root / \".lamindb/storage_uid.txt\"\n",
|
|
267
|
-
").read_text() == ln_setup.settings.storage.uid\n",
|
|
314
|
+
").read_text().splitlines()[0] == ln_setup.settings.storage.uid\n",
|
|
268
315
|
"# root.fs contains the underlying fsspec filesystem\n",
|
|
269
316
|
"assert (\n",
|
|
270
317
|
" ln_setup.settings.storage.root.fs.cache_regions # set by lamindb to True for s3 by default\n",
|
|
@@ -443,7 +490,7 @@
|
|
|
443
490
|
],
|
|
444
491
|
"metadata": {
|
|
445
492
|
"kernelspec": {
|
|
446
|
-
"display_name": "
|
|
493
|
+
"display_name": "py312",
|
|
447
494
|
"language": "python",
|
|
448
495
|
"name": "python3"
|
|
449
496
|
},
|
|
@@ -457,12 +504,7 @@
|
|
|
457
504
|
"name": "python",
|
|
458
505
|
"nbconvert_exporter": "python",
|
|
459
506
|
"pygments_lexer": "ipython3",
|
|
460
|
-
"version": "3.
|
|
461
|
-
},
|
|
462
|
-
"vscode": {
|
|
463
|
-
"interpreter": {
|
|
464
|
-
"hash": "61b4062b24dfb1010f420dad5aa3bd73a4d2af47d0ec44eafec465a35a9d7239"
|
|
465
|
-
}
|
|
507
|
+
"version": "3.12.8"
|
|
466
508
|
}
|
|
467
509
|
},
|
|
468
510
|
"nbformat": 4,
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"outputs": [],
|
|
24
24
|
"source": [
|
|
25
25
|
"import lamindb_setup as ln_setup\n",
|
|
26
|
-
"from lamindb_setup.core.upath import create_path, UPath,
|
|
26
|
+
"from lamindb_setup.core.upath import create_path, UPath, StorageNotEmpty\n",
|
|
27
27
|
"from lamindb_setup.core._hub_core import (\n",
|
|
28
28
|
" delete_instance,\n",
|
|
29
29
|
" call_with_fallback_auth,\n",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"source": [
|
|
45
45
|
"try:\n",
|
|
46
46
|
" delete_instance(f\"testuser1/{instance_name}\")\n",
|
|
47
|
-
"except
|
|
47
|
+
"except StorageNotEmpty:\n",
|
|
48
48
|
" instance_with_storage = call_with_fallback_auth(\n",
|
|
49
49
|
" select_instance_by_owner_name,\n",
|
|
50
50
|
" owner=\"testuser1\",\n",
|
|
@@ -137,7 +137,7 @@
|
|
|
137
137
|
],
|
|
138
138
|
"metadata": {
|
|
139
139
|
"kernelspec": {
|
|
140
|
-
"display_name": "
|
|
140
|
+
"display_name": "py312",
|
|
141
141
|
"language": "python",
|
|
142
142
|
"name": "python3"
|
|
143
143
|
},
|
|
@@ -151,7 +151,7 @@
|
|
|
151
151
|
"name": "python",
|
|
152
152
|
"nbconvert_exporter": "python",
|
|
153
153
|
"pygments_lexer": "ipython3",
|
|
154
|
-
"version": "3.
|
|
154
|
+
"version": "3.12.8"
|
|
155
155
|
}
|
|
156
156
|
},
|
|
157
157
|
"nbformat": 4,
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
"from lamindb_setup.core.upath import UPath\n",
|
|
20
20
|
"from lamindb_setup.core._hub_core import delete_instance\n",
|
|
21
21
|
"from lamindb_setup.core._hub_client import connect_hub_with_auth\n",
|
|
22
|
-
"from lamindb_setup.core.upath import
|
|
22
|
+
"from lamindb_setup.core.upath import StorageNotEmpty\n",
|
|
23
23
|
"\n",
|
|
24
24
|
"instance_name = \"my-hosted\"\n",
|
|
25
25
|
"assert ln_setup.settings.user.handle == \"testuser1\""
|
|
@@ -123,7 +123,7 @@
|
|
|
123
123
|
"metadata": {},
|
|
124
124
|
"outputs": [],
|
|
125
125
|
"source": [
|
|
126
|
-
"with pytest.raises(
|
|
126
|
+
"with pytest.raises(StorageNotEmpty):\n",
|
|
127
127
|
" delete_instance(f\"testuser1/{instance_name}\")"
|
|
128
128
|
]
|
|
129
129
|
},
|
|
@@ -20,9 +20,10 @@
|
|
|
20
20
|
"import pytest\n",
|
|
21
21
|
"import lamindb_setup as ln_setup\n",
|
|
22
22
|
"from upath import UPath\n",
|
|
23
|
+
"from pathlib import Path\n",
|
|
23
24
|
"\n",
|
|
24
25
|
"name = f\"keep-artifacts-local-setup-{os.environ['LAMIN_ENV']}\"\n",
|
|
25
|
-
"storage =
|
|
26
|
+
"storage = UPath(f\"s3://lamindb-ci/{name}\").as_posix()\n",
|
|
26
27
|
"\n",
|
|
27
28
|
"ln_setup.login(\"testuser1\")\n",
|
|
28
29
|
"ln_setup.init(storage=storage)\n",
|
|
@@ -75,7 +76,7 @@
|
|
|
75
76
|
")\n",
|
|
76
77
|
"assert (\n",
|
|
77
78
|
" ln_setup.settings.instance.storage_local.root / \".lamindb/storage_uid.txt\"\n",
|
|
78
|
-
").read_text() == ln_setup.settings.instance.storage_local.uid\n",
|
|
79
|
+
").read_text().splitlines()[0] == ln_setup.settings.instance.storage_local.uid\n",
|
|
79
80
|
"assert ln_setup.settings.instance.storage_local is not None\n",
|
|
80
81
|
"# the remote storage location is still in the regular slot\n",
|
|
81
82
|
"assert ln_setup.settings.instance.storage.root.as_posix() == storage"
|
|
@@ -109,7 +110,7 @@
|
|
|
109
110
|
")\n",
|
|
110
111
|
"assert (\n",
|
|
111
112
|
" ln_setup.settings.instance.storage_local.root / \".lamindb/storage_uid.txt\"\n",
|
|
112
|
-
").read_text() == ln_setup.settings.instance.storage_local.uid"
|
|
113
|
+
").read_text().splitlines()[0] == ln_setup.settings.instance.storage_local.uid"
|
|
113
114
|
]
|
|
114
115
|
},
|
|
115
116
|
{
|
|
@@ -176,7 +177,7 @@
|
|
|
176
177
|
"metadata": {},
|
|
177
178
|
"outputs": [],
|
|
178
179
|
"source": [
|
|
179
|
-
"with pytest.raises(ln_setup.
|
|
180
|
+
"with pytest.raises(ln_setup.errors.StorageNotEmpty):\n",
|
|
180
181
|
" ln_setup.delete(name, force=True)"
|
|
181
182
|
]
|
|
182
183
|
},
|
|
@@ -189,6 +190,31 @@
|
|
|
189
190
|
"test_file.unlink()"
|
|
190
191
|
]
|
|
191
192
|
},
|
|
193
|
+
{
|
|
194
|
+
"cell_type": "markdown",
|
|
195
|
+
"metadata": {},
|
|
196
|
+
"source": [
|
|
197
|
+
"Expand user directory:"
|
|
198
|
+
]
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
"cell_type": "code",
|
|
202
|
+
"execution_count": null,
|
|
203
|
+
"metadata": {},
|
|
204
|
+
"outputs": [],
|
|
205
|
+
"source": [
|
|
206
|
+
"# Test expanduser works\n",
|
|
207
|
+
"test_path = \"~/test/file.txt\"\n",
|
|
208
|
+
"result = ln_setup.core.upath.create_path(test_path)\n",
|
|
209
|
+
"expected = UPath(Path(test_path).expanduser())\n",
|
|
210
|
+
"assert result.as_posix() == expected.as_posix()\n",
|
|
211
|
+
"\n",
|
|
212
|
+
"# Test it doesn't affect absolute paths\n",
|
|
213
|
+
"test_path = \"/absolute/path/file.txt\"\n",
|
|
214
|
+
"result = ln_setup.core.upath.create_path(test_path)\n",
|
|
215
|
+
"assert str(result) == test_path"
|
|
216
|
+
]
|
|
217
|
+
},
|
|
192
218
|
{
|
|
193
219
|
"cell_type": "code",
|
|
194
220
|
"execution_count": null,
|
|
@@ -215,7 +241,7 @@
|
|
|
215
241
|
"name": "python",
|
|
216
242
|
"nbconvert_exporter": "python",
|
|
217
243
|
"pygments_lexer": "ipython3",
|
|
218
|
-
"version": "3.
|
|
244
|
+
"version": "3.10.16"
|
|
219
245
|
}
|
|
220
246
|
},
|
|
221
247
|
"nbformat": 4,
|
|
@@ -54,6 +54,15 @@
|
|
|
54
54
|
"ln_setup.init(storage=\"./testsetup\")"
|
|
55
55
|
]
|
|
56
56
|
},
|
|
57
|
+
{
|
|
58
|
+
"cell_type": "code",
|
|
59
|
+
"execution_count": null,
|
|
60
|
+
"metadata": {},
|
|
61
|
+
"outputs": [],
|
|
62
|
+
"source": [
|
|
63
|
+
"assert ln_setup.settings.instance.slug == \"testuser1/testsetup\""
|
|
64
|
+
]
|
|
65
|
+
},
|
|
57
66
|
{
|
|
58
67
|
"cell_type": "code",
|
|
59
68
|
"execution_count": null,
|
|
@@ -111,43 +120,7 @@
|
|
|
111
120
|
"cell_type": "markdown",
|
|
112
121
|
"metadata": {},
|
|
113
122
|
"source": [
|
|
114
|
-
"
|
|
115
|
-
]
|
|
116
|
-
},
|
|
117
|
-
{
|
|
118
|
-
"cell_type": "code",
|
|
119
|
-
"execution_count": null,
|
|
120
|
-
"metadata": {},
|
|
121
|
-
"outputs": [],
|
|
122
|
-
"source": [
|
|
123
|
-
"from lamindb_setup._init_instance import CannotSwitchDefaultInstance\n",
|
|
124
|
-
"\n",
|
|
125
|
-
"with pytest.raises(CannotSwitchDefaultInstance):\n",
|
|
126
|
-
" ln_setup.init(storage=\"./testsetup2\")\n",
|
|
127
|
-
"with pytest.raises(CannotSwitchDefaultInstance):\n",
|
|
128
|
-
" ln_setup.connect(\"testsetup\")\n",
|
|
129
|
-
"with pytest.raises(RuntimeError):\n",
|
|
130
|
-
" ln_setup.migrate.create()\n",
|
|
131
|
-
"with pytest.raises(RuntimeError):\n",
|
|
132
|
-
" ln_setup.migrate.deploy()\n",
|
|
133
|
-
"\n",
|
|
134
|
-
"assert ln_setup.settings.instance.slug == \"testuser1/testsetup\""
|
|
135
|
-
]
|
|
136
|
-
},
|
|
137
|
-
{
|
|
138
|
-
"cell_type": "markdown",
|
|
139
|
-
"metadata": {},
|
|
140
|
-
"source": [
|
|
141
|
-
"Reset `django` and connect to another instance:"
|
|
142
|
-
]
|
|
143
|
-
},
|
|
144
|
-
{
|
|
145
|
-
"cell_type": "code",
|
|
146
|
-
"execution_count": null,
|
|
147
|
-
"metadata": {},
|
|
148
|
-
"outputs": [],
|
|
149
|
-
"source": [
|
|
150
|
-
"ln_setup.core.django.reset_django()"
|
|
123
|
+
"Connect to another instance in the same process:"
|
|
151
124
|
]
|
|
152
125
|
},
|
|
153
126
|
{
|