lamindb 1.0.5__py3-none-any.whl → 1.1.1__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 +17 -6
- lamindb/_artifact.py +202 -87
- lamindb/_can_curate.py +27 -8
- lamindb/_collection.py +86 -52
- lamindb/_feature.py +177 -41
- lamindb/_finish.py +21 -7
- lamindb/_from_values.py +83 -98
- lamindb/_parents.py +4 -4
- lamindb/_query_set.py +78 -18
- lamindb/_record.py +170 -53
- lamindb/_run.py +4 -4
- lamindb/_save.py +42 -11
- lamindb/_schema.py +135 -38
- lamindb/_storage.py +1 -1
- lamindb/_tracked.py +129 -0
- lamindb/_transform.py +21 -8
- lamindb/_ulabel.py +5 -14
- lamindb/base/users.py +1 -4
- lamindb/base/validation.py +2 -6
- lamindb/core/__init__.py +13 -14
- lamindb/core/_context.py +14 -9
- lamindb/core/_data.py +29 -25
- lamindb/core/_describe.py +1 -1
- lamindb/core/_django.py +1 -1
- lamindb/core/_feature_manager.py +53 -43
- lamindb/core/_label_manager.py +4 -4
- lamindb/core/_mapped_collection.py +24 -9
- lamindb/core/_track_environment.py +2 -1
- lamindb/core/datasets/__init__.py +6 -1
- lamindb/core/datasets/_core.py +12 -11
- lamindb/core/datasets/_small.py +67 -21
- lamindb/core/exceptions.py +1 -90
- lamindb/core/loaders.py +21 -15
- lamindb/core/relations.py +6 -4
- lamindb/core/storage/_anndata_accessor.py +49 -3
- lamindb/core/storage/_backed_access.py +12 -7
- lamindb/core/storage/_pyarrow_dataset.py +40 -15
- lamindb/core/storage/_tiledbsoma.py +56 -12
- lamindb/core/storage/paths.py +30 -24
- lamindb/core/subsettings/_creation_settings.py +4 -16
- lamindb/curators/__init__.py +2193 -846
- lamindb/curators/_cellxgene_schemas/__init__.py +26 -0
- lamindb/curators/_cellxgene_schemas/schema_versions.yml +104 -0
- lamindb/errors.py +96 -0
- lamindb/integrations/_vitessce.py +3 -3
- lamindb/migrations/0069_squashed.py +76 -75
- lamindb/migrations/0075_lamindbv1_part5.py +4 -5
- lamindb/migrations/0082_alter_feature_dtype.py +21 -0
- lamindb/migrations/0083_alter_feature_is_type_alter_flextable_is_type_and_more.py +94 -0
- lamindb/migrations/0084_alter_schemafeature_feature_and_more.py +35 -0
- lamindb/migrations/0085_alter_feature_is_type_alter_flextable_is_type_and_more.py +63 -0
- lamindb/migrations/0086_various.py +95 -0
- lamindb/migrations/0087_rename__schemas_m2m_artifact_feature_sets_and_more.py +41 -0
- lamindb/migrations/0088_schema_components.py +273 -0
- lamindb/migrations/0088_squashed.py +4372 -0
- lamindb/models.py +475 -168
- {lamindb-1.0.5.dist-info → lamindb-1.1.1.dist-info}/METADATA +9 -7
- lamindb-1.1.1.dist-info/RECORD +95 -0
- lamindb/curators/_spatial.py +0 -528
- lamindb/migrations/0052_squashed.py +0 -1261
- lamindb/migrations/0053_alter_featureset_hash_alter_paramvalue_created_by_and_more.py +0 -57
- lamindb/migrations/0054_alter_feature_previous_runs_and_more.py +0 -35
- lamindb/migrations/0055_artifact_type_artifactparamvalue_and_more.py +0 -61
- lamindb/migrations/0056_rename_ulabel_ref_is_name_artifactulabel_label_ref_is_name_and_more.py +0 -22
- lamindb/migrations/0057_link_models_latest_report_and_others.py +0 -356
- lamindb/migrations/0058_artifact__actions_collection__actions.py +0 -22
- lamindb/migrations/0059_alter_artifact__accessor_alter_artifact__hash_type_and_more.py +0 -31
- lamindb/migrations/0060_alter_artifact__actions.py +0 -22
- lamindb/migrations/0061_alter_collection_meta_artifact_alter_run_environment_and_more.py +0 -45
- lamindb/migrations/0062_add_is_latest_field.py +0 -32
- lamindb/migrations/0063_populate_latest_field.py +0 -45
- lamindb/migrations/0064_alter_artifact_version_alter_collection_version_and_more.py +0 -33
- lamindb/migrations/0065_remove_collection_feature_sets_and_more.py +0 -22
- lamindb/migrations/0066_alter_artifact__feature_values_and_more.py +0 -352
- lamindb/migrations/0067_alter_featurevalue_unique_together_and_more.py +0 -20
- lamindb/migrations/0068_alter_artifactulabel_unique_together_and_more.py +0 -20
- lamindb/migrations/0069_alter_artifact__accessor_alter_artifact__hash_type_and_more.py +0 -1294
- lamindb-1.0.5.dist-info/RECORD +0 -102
- {lamindb-1.0.5.dist-info → lamindb-1.1.1.dist-info}/LICENSE +0 -0
- {lamindb-1.0.5.dist-info → lamindb-1.1.1.dist-info}/WHEEL +0 -0
lamindb/core/storage/paths.py
CHANGED
@@ -4,7 +4,6 @@ import shutil
|
|
4
4
|
from typing import TYPE_CHECKING
|
5
5
|
|
6
6
|
import fsspec
|
7
|
-
from lamin_utils import logger
|
8
7
|
from lamindb_setup.core import StorageSettings
|
9
8
|
from lamindb_setup.core.upath import (
|
10
9
|
LocalPathClasses,
|
@@ -43,24 +42,23 @@ def auto_storage_key_from_artifact_uid(uid: str, suffix: str, is_dir: bool) -> s
|
|
43
42
|
|
44
43
|
|
45
44
|
def check_path_is_child_of_root(path: UPathStr, root: UPathStr) -> bool:
|
46
|
-
|
47
|
-
# from the equality checks below
|
48
|
-
# and for fsspec.utils.get_protocol
|
49
|
-
path_str = str(path)
|
50
|
-
root_str = str(root)
|
51
|
-
root_protocol = fsspec.utils.get_protocol(root_str)
|
52
|
-
# check that the protocols are the same first
|
53
|
-
if fsspec.utils.get_protocol(path_str) != root_protocol:
|
45
|
+
if fsspec.utils.get_protocol(str(path)) != fsspec.utils.get_protocol(str(root)):
|
54
46
|
return False
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
47
|
+
path_upath = UPath(path)
|
48
|
+
root_upath = UPath(root)
|
49
|
+
if path_upath.protocol == "s3":
|
50
|
+
endpoint_path = path_upath.storage_options.get("endpoint_url", "")
|
51
|
+
endpoint_root = root_upath.storage_options.get("endpoint_url", "")
|
52
|
+
if endpoint_path != endpoint_root:
|
53
|
+
return False
|
54
|
+
# we don't resolve http links because they can resolve into a different domain
|
55
|
+
# for example into a temporary url
|
56
|
+
if path_upath.protocol not in {"http", "https"}:
|
57
|
+
path_upath = path_upath.resolve()
|
58
|
+
root_upath = root_upath.resolve()
|
59
|
+
# str is needed to eliminate UPath storage_options
|
60
|
+
# which affect equality checks
|
61
|
+
return UPath(str(root_upath)) in UPath(str(path_upath)).parents
|
64
62
|
|
65
63
|
|
66
64
|
# returns filepath and root of the storage
|
@@ -133,7 +131,7 @@ def filepath_cache_key_from_artifact(
|
|
133
131
|
|
134
132
|
|
135
133
|
def store_file_or_folder(
|
136
|
-
local_path: UPathStr, storage_path: UPath, print_progress: bool = True
|
134
|
+
local_path: UPathStr, storage_path: UPath, print_progress: bool = True, **kwargs
|
137
135
|
) -> None:
|
138
136
|
"""Store file or folder (localpath) at storagepath."""
|
139
137
|
local_path = UPath(local_path)
|
@@ -154,7 +152,10 @@ def store_file_or_folder(
|
|
154
152
|
else:
|
155
153
|
create_folder = None
|
156
154
|
storage_path.upload_from(
|
157
|
-
local_path,
|
155
|
+
local_path,
|
156
|
+
create_folder=create_folder,
|
157
|
+
print_progress=print_progress,
|
158
|
+
**kwargs,
|
158
159
|
)
|
159
160
|
else: # storage path is local
|
160
161
|
if local_path.resolve().as_posix() == storage_path.resolve().as_posix():
|
@@ -169,10 +170,15 @@ def store_file_or_folder(
|
|
169
170
|
|
170
171
|
|
171
172
|
def delete_storage_using_key(
|
172
|
-
artifact: Artifact,
|
173
|
-
|
173
|
+
artifact: Artifact,
|
174
|
+
storage_key: str,
|
175
|
+
raise_file_not_found_error: bool = True,
|
176
|
+
using_key: str | None = None,
|
177
|
+
) -> None | str:
|
174
178
|
filepath, _ = attempt_accessing_path(artifact, storage_key, using_key=using_key)
|
175
|
-
delete_storage(
|
179
|
+
return delete_storage(
|
180
|
+
filepath, raise_file_not_found_error=raise_file_not_found_error
|
181
|
+
)
|
176
182
|
|
177
183
|
|
178
184
|
def delete_storage(
|
@@ -191,5 +197,5 @@ def delete_storage(
|
|
191
197
|
elif raise_file_not_found_error:
|
192
198
|
raise FileNotFoundError(f"{storagepath} is not an existing path!")
|
193
199
|
else:
|
194
|
-
|
200
|
+
return "did-not-delete"
|
195
201
|
return None
|
@@ -1,13 +1,8 @@
|
|
1
|
-
from typing import Literal
|
2
|
-
|
3
|
-
|
4
1
|
class CreationSettings:
|
5
|
-
|
6
|
-
|
7
|
-
] = "warn_return_existing"
|
8
|
-
"""Behavior if file hash exists (default `"warn_return_existing"`).
|
2
|
+
search_names: bool = True
|
3
|
+
"""Switch off to speed up creating records (default `True`).
|
9
4
|
|
10
|
-
|
5
|
+
If `True`, search for alternative names and avoids duplicates.
|
11
6
|
|
12
7
|
FAQ: :doc:`/faq/idempotency`
|
13
8
|
"""
|
@@ -18,15 +13,8 @@ class CreationSettings:
|
|
18
13
|
|
19
14
|
It speeds up file creation by about a factor 100.
|
20
15
|
"""
|
21
|
-
search_names: bool = True
|
22
|
-
"""To speed up creating records (default `True`).
|
23
|
-
|
24
|
-
If `True`, search for alternative names.
|
25
|
-
|
26
|
-
FAQ: :doc:`/faq/idempotency`
|
27
|
-
"""
|
28
16
|
artifact_silence_missing_run_warning: bool = False
|
29
|
-
"""Silence warning about missing run & transform during artifact creation."""
|
17
|
+
"""Silence warning about missing run & transform during artifact creation (default `False`)."""
|
30
18
|
_artifact_use_virtual_keys: bool = True
|
31
19
|
"""Treat `key` parameter in :class:`~lamindb.Artifact` as virtual.
|
32
20
|
|