lamindb_setup 1.6.0__tar.gz → 1.6.1__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.6.1}/.github/workflows/build.yml +7 -7
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/PKG-INFO +1 -1
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/docs/hub-cloud/01-init-local-instance.ipynb +2 -7
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/docs/hub-cloud/07-keep-artifacts-local.ipynb +28 -2
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/docs/hub-cloud/08-test-multi-session.ipynb +2 -2
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/lamindb_setup/__init__.py +1 -1
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/lamindb_setup/_connect_instance.py +2 -2
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/lamindb_setup/core/_hub_client.py +17 -6
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/lamindb_setup/core/_hub_core.py +2 -2
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/lamindb_setup/core/_settings_storage.py +1 -3
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/lamindb_setup/core/cloud_sqlite_locker.py +8 -1
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/lamindb_setup/core/upath.py +1 -1
- lamindb_setup-1.6.1/lamindb_setup/py.typed +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/tests/hub-cloud/test_init_instance.py +7 -1
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/.github/workflows/doc-changes.yml +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/.gitignore +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/.pre-commit-config.yaml +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/LICENSE +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/README.md +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/docs/changelog.md +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/docs/hub-cloud/02-connect-local-instance.ipynb +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/docs/hub-cloud/03-add-managed-storage.ipynb +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/docs/hub-cloud/04-test-bionty.ipynb +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/docs/hub-cloud/05-init-hosted-instance.ipynb +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/docs/hub-cloud/06-connect-hosted-instance.ipynb +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/docs/hub-cloud/test_notebooks.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/docs/hub-prod/test-cache-management.ipynb +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/docs/hub-prod/test-cloud-sync.ipynb +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/docs/hub-prod/test-connect-anonymously.ipynb +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/docs/hub-prod/test-empty-init.ipynb +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/docs/hub-prod/test-import-schema.ipynb +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/docs/hub-prod/test-init-load-local-anonymously.ipynb +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/docs/hub-prod/test-insufficient-user-info.ipynb +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/docs/hub-prod/test-invalid-schema.ipynb +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/docs/hub-prod/test-sqlite-lock.ipynb +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/docs/hub-prod/test_notebooks2.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/docs/index.md +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/docs/notebooks.md +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/docs/reference.md +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/lamindb_setup/_cache.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/lamindb_setup/_check.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/lamindb_setup/_check_setup.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/lamindb_setup/_delete.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/lamindb_setup/_disconnect.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/lamindb_setup/_django.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/lamindb_setup/_entry_points.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/lamindb_setup/_exportdb.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/lamindb_setup/_importdb.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/lamindb_setup/_init_instance.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/lamindb_setup/_migrate.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/lamindb_setup/_register_instance.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/lamindb_setup/_schema.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/lamindb_setup/_schema_metadata.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/lamindb_setup/_set_managed_storage.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/lamindb_setup/_setup_user.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/lamindb_setup/_silence_loggers.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/lamindb_setup/core/__init__.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/lamindb_setup/core/_aws_options.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/lamindb_setup/core/_aws_storage.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/lamindb_setup/core/_deprecated.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/lamindb_setup/core/_docs.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/lamindb_setup/core/_hub_crud.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/lamindb_setup/core/_hub_utils.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/lamindb_setup/core/_private_django_api.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/lamindb_setup/core/_settings.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/lamindb_setup/core/_settings_instance.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/lamindb_setup/core/_settings_load.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/lamindb_setup/core/_settings_save.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/lamindb_setup/core/_settings_store.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/lamindb_setup/core/_settings_user.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/lamindb_setup/core/_setup_bionty_sources.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/lamindb_setup/core/django.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/lamindb_setup/core/exceptions.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/lamindb_setup/core/hashing.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/lamindb_setup/core/types.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/noxfile.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/pyproject.toml +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/tests/hub-cloud/scripts/script-init-pass-user-no-writes.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/tests/hub-cloud/scripts/script-to-fail-managed-storage.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/tests/hub-cloud/test_connect_instance.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/tests/hub-cloud/test_delete_instance.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/tests/hub-cloud/test_edge_request.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/tests/hub-cloud/test_fail_managed_storage.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/tests/hub-cloud/test_init_pass_user_no_writes.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/tests/hub-cloud/test_login.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/tests/hub-cloud/test_migrate.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/tests/hub-cloud/test_set_storage.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/tests/hub-local/conftest.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/tests/hub-local/scripts/script-connect-fine-grained-access.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/tests/hub-local/test_all.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/tests/hub-local/test_update_schema_in_hub.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/tests/hub-prod/conftest.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/tests/hub-prod/test_aws_options_manager.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/tests/hub-prod/test_django.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/tests/hub-prod/test_global_settings.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/tests/hub-prod/test_switch_and_fallback_env.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/tests/hub-prod/test_upath.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/tests/storage/test_entry_point.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/tests/storage/test_hashing.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/tests/storage/test_storage_access.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/tests/storage/test_storage_basis.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/tests/storage/test_storage_settings.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/tests/storage/test_storage_stats.py +0 -0
- {lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/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"
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
],
|
|
93
93
|
"metadata": {
|
|
94
94
|
"kernelspec": {
|
|
95
|
-
"display_name": "
|
|
95
|
+
"display_name": "lamindb",
|
|
96
96
|
"language": "python",
|
|
97
97
|
"name": "python3"
|
|
98
98
|
},
|
|
@@ -106,12 +106,7 @@
|
|
|
106
106
|
"name": "python",
|
|
107
107
|
"nbconvert_exporter": "python",
|
|
108
108
|
"pygments_lexer": "ipython3",
|
|
109
|
-
"version": "3.
|
|
110
|
-
},
|
|
111
|
-
"vscode": {
|
|
112
|
-
"interpreter": {
|
|
113
|
-
"hash": "40d3a090f54c6569ab1632332b64b2c03c39dcf918b08424e98f38b5ae0af88f"
|
|
114
|
-
}
|
|
109
|
+
"version": "3.12.8"
|
|
115
110
|
}
|
|
116
111
|
},
|
|
117
112
|
"nbformat": 4,
|
|
@@ -20,6 +20,7 @@
|
|
|
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
26
|
"storage = (UPath(\"s3://lamindb-ci\") / name).as_posix()\n",
|
|
@@ -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,
|
|
@@ -201,7 +227,7 @@
|
|
|
201
227
|
],
|
|
202
228
|
"metadata": {
|
|
203
229
|
"kernelspec": {
|
|
204
|
-
"display_name": "
|
|
230
|
+
"display_name": "lamindb",
|
|
205
231
|
"language": "python",
|
|
206
232
|
"name": "python3"
|
|
207
233
|
},
|
|
@@ -215,7 +241,7 @@
|
|
|
215
241
|
"name": "python",
|
|
216
242
|
"nbconvert_exporter": "python",
|
|
217
243
|
"pygments_lexer": "ipython3",
|
|
218
|
-
"version": "3.
|
|
244
|
+
"version": "3.12.8"
|
|
219
245
|
}
|
|
220
246
|
},
|
|
221
247
|
"nbformat": 4,
|
|
@@ -182,7 +182,7 @@
|
|
|
182
182
|
],
|
|
183
183
|
"metadata": {
|
|
184
184
|
"kernelspec": {
|
|
185
|
-
"display_name": "
|
|
185
|
+
"display_name": "lamindb",
|
|
186
186
|
"language": "python",
|
|
187
187
|
"name": "python3"
|
|
188
188
|
},
|
|
@@ -196,7 +196,7 @@
|
|
|
196
196
|
"name": "python",
|
|
197
197
|
"nbconvert_exporter": "python",
|
|
198
198
|
"pygments_lexer": "ipython3",
|
|
199
|
-
"version": "3.
|
|
199
|
+
"version": "3.12.8"
|
|
200
200
|
}
|
|
201
201
|
},
|
|
202
202
|
"nbformat": 4,
|
|
@@ -2,7 +2,7 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
import importlib
|
|
4
4
|
import os
|
|
5
|
-
from typing import TYPE_CHECKING
|
|
5
|
+
from typing import TYPE_CHECKING, Any
|
|
6
6
|
from uuid import UUID
|
|
7
7
|
|
|
8
8
|
from lamin_utils import logger
|
|
@@ -189,7 +189,7 @@ def _connect_instance(
|
|
|
189
189
|
|
|
190
190
|
|
|
191
191
|
@unlock_cloud_sqlite_upon_exception(ignore_prev_locker=True)
|
|
192
|
-
def connect(instance: str | None = None, **kwargs) -> str | tuple | None:
|
|
192
|
+
def connect(instance: str | None = None, **kwargs: Any) -> str | tuple | None:
|
|
193
193
|
"""Connect to an instance.
|
|
194
194
|
|
|
195
195
|
Args:
|
|
@@ -2,6 +2,7 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
import json
|
|
4
4
|
import os
|
|
5
|
+
from typing import Literal
|
|
5
6
|
from urllib.request import urlretrieve
|
|
6
7
|
|
|
7
8
|
from gotrue.errors import AuthUnknownError
|
|
@@ -25,7 +26,7 @@ def load_fallback_connector() -> Connector:
|
|
|
25
26
|
return connector
|
|
26
27
|
|
|
27
28
|
|
|
28
|
-
PROD_URL = "https://
|
|
29
|
+
PROD_URL = "https://laesaummdydllppgfchu.supabase.co"
|
|
29
30
|
PROD_ANON_KEY = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImxhZXNhdW1tZHlkbGxwcGdmY2h1Iiwicm9sZSI6ImFub24iLCJpYXQiOjE2NTY4NDA1NTEsImV4cCI6MTk3MjQxNjU1MX0.WUeCRiun0ExUxKIv5-CtjF6878H8u26t0JmCWx3_2-c"
|
|
30
31
|
|
|
31
32
|
|
|
@@ -197,10 +198,20 @@ def requests_client():
|
|
|
197
198
|
return requests
|
|
198
199
|
|
|
199
200
|
|
|
200
|
-
def
|
|
201
|
+
def request_with_auth(
|
|
202
|
+
url: str,
|
|
203
|
+
method: Literal["get", "post", "put", "delete", "head", "options"],
|
|
204
|
+
access_token: str,
|
|
205
|
+
renew_token: bool = True,
|
|
206
|
+
**kwargs,
|
|
207
|
+
):
|
|
201
208
|
requests = requests_client()
|
|
202
209
|
|
|
203
|
-
|
|
210
|
+
headers = kwargs.pop("headers", {})
|
|
211
|
+
headers["Authorization"] = f"Bearer {access_token}"
|
|
212
|
+
|
|
213
|
+
make_request = getattr(requests, method)
|
|
214
|
+
response = make_request(url, headers=headers, **kwargs)
|
|
204
215
|
# upate access_token and try again if failed
|
|
205
216
|
if response.status_code != 200 and renew_token:
|
|
206
217
|
from lamindb_setup import settings
|
|
@@ -212,7 +223,7 @@ def request_get_auth(url: str, access_token: str, renew_token: bool = True):
|
|
|
212
223
|
settings.user.access_token = access_token
|
|
213
224
|
save_user_settings(settings.user)
|
|
214
225
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
)
|
|
226
|
+
headers["Authorization"] = f"Bearer {access_token}"
|
|
227
|
+
|
|
228
|
+
response = make_request(url, headers=headers, **kwargs)
|
|
218
229
|
return response
|
|
@@ -17,7 +17,7 @@ from ._hub_client import (
|
|
|
17
17
|
call_with_fallback,
|
|
18
18
|
call_with_fallback_auth,
|
|
19
19
|
connect_hub,
|
|
20
|
-
|
|
20
|
+
request_with_auth,
|
|
21
21
|
)
|
|
22
22
|
from ._hub_crud import (
|
|
23
23
|
_delete_instance_record,
|
|
@@ -495,7 +495,7 @@ def access_db(
|
|
|
495
495
|
)
|
|
496
496
|
url = instance_api_url + url
|
|
497
497
|
|
|
498
|
-
response =
|
|
498
|
+
response = request_with_auth(url, "get", access_token, renew_token) # type: ignore
|
|
499
499
|
response_json = response.json()
|
|
500
500
|
if response.status_code != 200:
|
|
501
501
|
raise PermissionError(
|
|
@@ -2,9 +2,7 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
import os
|
|
4
4
|
import secrets
|
|
5
|
-
import shutil
|
|
6
5
|
import string
|
|
7
|
-
from pathlib import Path
|
|
8
6
|
from typing import TYPE_CHECKING, Any, Literal
|
|
9
7
|
|
|
10
8
|
import fsspec
|
|
@@ -208,7 +206,7 @@ class StorageSettings:
|
|
|
208
206
|
):
|
|
209
207
|
self._uid = uid
|
|
210
208
|
self._uuid_ = uuid
|
|
211
|
-
self._root_init = UPath(root)
|
|
209
|
+
self._root_init = UPath(root).expanduser()
|
|
212
210
|
if isinstance(self._root_init, LocalPathClasses): # local paths
|
|
213
211
|
try:
|
|
214
212
|
(self._root_init / ".lamindb").mkdir(parents=True, exist_ok=True)
|
|
@@ -9,12 +9,17 @@ from lamin_utils import logger
|
|
|
9
9
|
from .upath import UPath, create_mapper, infer_filesystem
|
|
10
10
|
|
|
11
11
|
if TYPE_CHECKING:
|
|
12
|
+
from collections.abc import Callable
|
|
12
13
|
from pathlib import Path
|
|
14
|
+
from typing import ParamSpec, TypeVar
|
|
13
15
|
from uuid import UUID
|
|
14
16
|
|
|
15
17
|
from ._settings_instance import InstanceSettings
|
|
16
18
|
from ._settings_user import UserSettings
|
|
17
19
|
|
|
20
|
+
P = ParamSpec("P")
|
|
21
|
+
R = TypeVar("R")
|
|
22
|
+
|
|
18
23
|
EXPIRATION_TIME = 24 * 60 * 60 * 7 # 7 days
|
|
19
24
|
|
|
20
25
|
MAX_MSG_COUNTER = 100 # print the msg after this number of iterations
|
|
@@ -207,7 +212,9 @@ def clear_locker():
|
|
|
207
212
|
|
|
208
213
|
|
|
209
214
|
# decorator
|
|
210
|
-
def unlock_cloud_sqlite_upon_exception(
|
|
215
|
+
def unlock_cloud_sqlite_upon_exception(
|
|
216
|
+
ignore_prev_locker: bool = False,
|
|
217
|
+
) -> Callable[[Callable[P, R]], Callable[P, R]]:
|
|
211
218
|
"""Decorator to unlock a cloud sqlite instance upon an exception.
|
|
212
219
|
|
|
213
220
|
Ignores `InstanceLockedException`.
|
|
@@ -821,7 +821,7 @@ register_implementation("s3", S3QueryPath, clobber=True)
|
|
|
821
821
|
|
|
822
822
|
|
|
823
823
|
def create_path(path: UPathStr, access_token: str | None = None) -> UPath:
|
|
824
|
-
upath = UPath(path)
|
|
824
|
+
upath = UPath(path).expanduser()
|
|
825
825
|
|
|
826
826
|
if upath.protocol == "s3":
|
|
827
827
|
# add managed credentials and other options for AWS s3 paths
|
|
File without changes
|
|
@@ -11,7 +11,6 @@ from lamindb_setup._init_instance import infer_instance_name
|
|
|
11
11
|
from lamindb_setup.core._hub_client import connect_hub_with_auth
|
|
12
12
|
from lamindb_setup.core._hub_core import _connect_instance_hub
|
|
13
13
|
from lamindb_setup.core._hub_crud import (
|
|
14
|
-
Client,
|
|
15
14
|
select_account_by_handle,
|
|
16
15
|
select_default_storage_by_instance_id,
|
|
17
16
|
select_instance_by_name,
|
|
@@ -123,6 +122,13 @@ def test_init_instance_cwd():
|
|
|
123
122
|
ln_setup.delete("mystorage_cwd", force=True)
|
|
124
123
|
|
|
125
124
|
|
|
125
|
+
def test_init_instance_user():
|
|
126
|
+
ln_setup.init(storage="~/mydata", _test=True)
|
|
127
|
+
assert not ln_setup.settings.instance.storage.type_is_cloud
|
|
128
|
+
assert ln_setup.settings.storage.root.is_relative_to(Path.home())
|
|
129
|
+
ln_setup.delete("mydata", force=True)
|
|
130
|
+
|
|
131
|
+
|
|
126
132
|
def test_init_instance_cloud_aws_us():
|
|
127
133
|
storage = (
|
|
128
134
|
f"s3://lamindb-ci/{os.environ['LAMIN_ENV']}_test/init_instance_cloud_aws_us"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/docs/hub-prod/test-init-load-local-anonymously.ipynb
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{lamindb_setup-1.6.0 → lamindb_setup-1.6.1}/tests/hub-cloud/test_init_pass_user_no_writes.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|