lamindb 1.1.0__py3-none-any.whl → 1.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- lamindb/__init__.py +33 -26
- lamindb/_finish.py +9 -1
- lamindb/_tracked.py +26 -3
- lamindb/_view.py +2 -3
- lamindb/base/__init__.py +1 -1
- lamindb/base/ids.py +1 -10
- lamindb/base/users.py +1 -4
- lamindb/core/__init__.py +7 -65
- lamindb/core/_compat.py +60 -0
- lamindb/core/_context.py +50 -22
- lamindb/core/_mapped_collection.py +4 -2
- lamindb/core/_settings.py +6 -6
- lamindb/core/_sync_git.py +1 -1
- lamindb/core/_track_environment.py +2 -1
- lamindb/core/datasets/_small.py +3 -3
- lamindb/core/loaders.py +43 -20
- lamindb/core/storage/_anndata_accessor.py +8 -3
- lamindb/core/storage/_backed_access.py +14 -7
- lamindb/core/storage/_pyarrow_dataset.py +24 -9
- lamindb/core/storage/_tiledbsoma.py +8 -6
- lamindb/core/storage/_zarr.py +104 -25
- lamindb/core/storage/objects.py +63 -28
- lamindb/core/storage/paths.py +16 -13
- lamindb/core/types.py +10 -0
- lamindb/curators/__init__.py +176 -149
- lamindb/errors.py +1 -1
- lamindb/integrations/_vitessce.py +4 -4
- lamindb/migrations/0089_subsequent_runs.py +159 -0
- lamindb/migrations/0090_runproject_project_runs.py +73 -0
- lamindb/migrations/{0088_squashed.py → 0090_squashed.py} +245 -177
- lamindb/models/__init__.py +79 -0
- lamindb/{core → models}/_describe.py +3 -3
- lamindb/{core → models}/_django.py +8 -5
- lamindb/{core → models}/_feature_manager.py +103 -87
- lamindb/{_from_values.py → models/_from_values.py} +5 -2
- lamindb/{core/versioning.py → models/_is_versioned.py} +94 -6
- lamindb/{core → models}/_label_manager.py +10 -17
- lamindb/{core/relations.py → models/_relations.py} +8 -1
- lamindb/models/artifact.py +2602 -0
- lamindb/{_can_curate.py → models/can_curate.py} +349 -180
- lamindb/models/collection.py +683 -0
- lamindb/models/core.py +135 -0
- lamindb/models/feature.py +643 -0
- lamindb/models/flextable.py +163 -0
- lamindb/{_parents.py → models/has_parents.py} +55 -49
- lamindb/models/project.py +384 -0
- lamindb/{_query_manager.py → models/query_manager.py} +10 -8
- lamindb/{_query_set.py → models/query_set.py} +64 -32
- lamindb/models/record.py +1762 -0
- lamindb/models/run.py +563 -0
- lamindb/{_save.py → models/save.py} +18 -8
- lamindb/models/schema.py +732 -0
- lamindb/models/transform.py +360 -0
- lamindb/models/ulabel.py +249 -0
- {lamindb-1.1.0.dist-info → lamindb-1.2.0.dist-info}/METADATA +6 -6
- lamindb-1.2.0.dist-info/RECORD +95 -0
- lamindb/_artifact.py +0 -1361
- lamindb/_collection.py +0 -440
- lamindb/_feature.py +0 -316
- lamindb/_is_versioned.py +0 -40
- lamindb/_record.py +0 -1065
- lamindb/_run.py +0 -60
- lamindb/_schema.py +0 -347
- lamindb/_storage.py +0 -15
- lamindb/_transform.py +0 -170
- lamindb/_ulabel.py +0 -56
- lamindb/_utils.py +0 -9
- lamindb/base/validation.py +0 -63
- lamindb/core/_data.py +0 -491
- lamindb/core/fields.py +0 -12
- lamindb/models.py +0 -4435
- lamindb-1.1.0.dist-info/RECORD +0 -95
- {lamindb-1.1.0.dist-info → lamindb-1.2.0.dist-info}/LICENSE +0 -0
- {lamindb-1.1.0.dist-info → lamindb-1.2.0.dist-info}/WHEEL +0 -0
lamindb/core/storage/paths.py
CHANGED
@@ -11,13 +11,14 @@ from lamindb_setup.core.upath import (
|
|
11
11
|
)
|
12
12
|
|
13
13
|
from lamindb.core._settings import settings
|
14
|
-
from lamindb.models import Artifact, Storage
|
15
14
|
|
16
15
|
if TYPE_CHECKING:
|
17
16
|
from pathlib import Path
|
18
17
|
|
19
18
|
from lamindb_setup.core.types import UPathStr
|
20
19
|
|
20
|
+
from lamindb.models.artifact import Artifact
|
21
|
+
|
21
22
|
|
22
23
|
AUTO_KEY_PREFIX = ".lamindb/"
|
23
24
|
|
@@ -41,24 +42,21 @@ def auto_storage_key_from_artifact_uid(uid: str, suffix: str, is_dir: bool) -> s
|
|
41
42
|
return storage_key
|
42
43
|
|
43
44
|
|
44
|
-
def _safely_resolve(upath: UPath) -> UPath:
|
45
|
-
if upath.protocol in {"http", "https"}:
|
46
|
-
resolve_kwargs = {"follow_redirects": False}
|
47
|
-
else:
|
48
|
-
resolve_kwargs = {}
|
49
|
-
return upath.resolve(**resolve_kwargs)
|
50
|
-
|
51
|
-
|
52
45
|
def check_path_is_child_of_root(path: UPathStr, root: UPathStr) -> bool:
|
53
46
|
if fsspec.utils.get_protocol(str(path)) != fsspec.utils.get_protocol(str(root)):
|
54
47
|
return False
|
55
|
-
path_upath =
|
56
|
-
root_upath =
|
48
|
+
path_upath = UPath(path)
|
49
|
+
root_upath = UPath(root)
|
57
50
|
if path_upath.protocol == "s3":
|
58
51
|
endpoint_path = path_upath.storage_options.get("endpoint_url", "")
|
59
52
|
endpoint_root = root_upath.storage_options.get("endpoint_url", "")
|
60
53
|
if endpoint_path != endpoint_root:
|
61
54
|
return False
|
55
|
+
# we don't resolve http links because they can resolve into a different domain
|
56
|
+
# for example into a temporary url
|
57
|
+
if path_upath.protocol not in {"http", "https"}:
|
58
|
+
path_upath = path_upath.resolve()
|
59
|
+
root_upath = root_upath.resolve()
|
62
60
|
# str is needed to eliminate UPath storage_options
|
63
61
|
# which affect equality checks
|
64
62
|
return UPath(str(root_upath)) in UPath(str(path_upath)).parents
|
@@ -73,6 +71,8 @@ def attempt_accessing_path(
|
|
73
71
|
) -> tuple[UPath, StorageSettings]:
|
74
72
|
# check whether the file is in the default db and whether storage
|
75
73
|
# matches default storage
|
74
|
+
from lamindb.models import Storage
|
75
|
+
|
76
76
|
if (
|
77
77
|
artifact._state.db in ("default", None)
|
78
78
|
and artifact.storage_id == settings._storage_settings.id
|
@@ -134,7 +134,7 @@ def filepath_cache_key_from_artifact(
|
|
134
134
|
|
135
135
|
|
136
136
|
def store_file_or_folder(
|
137
|
-
local_path: UPathStr, storage_path: UPath, print_progress: bool = True
|
137
|
+
local_path: UPathStr, storage_path: UPath, print_progress: bool = True, **kwargs
|
138
138
|
) -> None:
|
139
139
|
"""Store file or folder (localpath) at storagepath."""
|
140
140
|
local_path = UPath(local_path)
|
@@ -155,7 +155,10 @@ def store_file_or_folder(
|
|
155
155
|
else:
|
156
156
|
create_folder = None
|
157
157
|
storage_path.upload_from(
|
158
|
-
local_path,
|
158
|
+
local_path,
|
159
|
+
create_folder=create_folder,
|
160
|
+
print_progress=print_progress,
|
161
|
+
**kwargs,
|
159
162
|
)
|
160
163
|
else: # storage path is local
|
161
164
|
if local_path.resolve().as_posix() == storage_path.resolve().as_posix():
|
lamindb/core/types.py
CHANGED
@@ -1,3 +1,8 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
from typing import TYPE_CHECKING, TypeVar
|
4
|
+
|
5
|
+
from anndata import AnnData
|
1
6
|
from lamindb_setup.core.types import UPathStr
|
2
7
|
|
3
8
|
from lamindb.base.types import (
|
@@ -7,3 +12,8 @@ from lamindb.base.types import (
|
|
7
12
|
StrField,
|
8
13
|
TransformType,
|
9
14
|
)
|
15
|
+
|
16
|
+
MuData = TypeVar("MuData")
|
17
|
+
SpatialData = TypeVar("SpatialData")
|
18
|
+
|
19
|
+
ScverseDataStructures = AnnData | MuData | SpatialData
|