lamindb 0.76.12__py3-none-any.whl → 0.76.14__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 +1 -1
- lamindb/_artifact.py +8 -9
- lamindb/_collection.py +18 -5
- lamindb/_curate.py +242 -137
- lamindb/_feature_set.py +3 -1
- lamindb/_from_values.py +1 -5
- lamindb/_parents.py +18 -3
- lamindb/_query_manager.py +0 -15
- lamindb/_query_set.py +8 -4
- lamindb/_record.py +82 -6
- lamindb/core/__init__.py +2 -0
- lamindb/core/_context.py +1 -1
- lamindb/core/_data.py +19 -7
- lamindb/core/_django.py +19 -5
- lamindb/core/_feature_manager.py +80 -44
- lamindb/core/_label_manager.py +91 -93
- lamindb/core/exceptions.py +7 -0
- lamindb/core/schema.py +42 -3
- lamindb/core/types.py +1 -0
- {lamindb-0.76.12.dist-info → lamindb-0.76.14.dist-info}/METADATA +6 -6
- {lamindb-0.76.12.dist-info → lamindb-0.76.14.dist-info}/RECORD +23 -23
- {lamindb-0.76.12.dist-info → lamindb-0.76.14.dist-info}/LICENSE +0 -0
- {lamindb-0.76.12.dist-info → lamindb-0.76.14.dist-info}/WHEEL +0 -0
lamindb/__init__.py
CHANGED
lamindb/_artifact.py
CHANGED
@@ -331,9 +331,10 @@ def get_artifact_kwargs_from_data(
|
|
331
331
|
artifact = stat_or_artifact
|
332
332
|
# update the run of the existing artifact
|
333
333
|
if run is not None:
|
334
|
-
# save the information that this artifact was previously
|
335
|
-
#
|
336
|
-
|
334
|
+
# save the information that this artifact was previously produced by
|
335
|
+
# another run
|
336
|
+
# note: same logic exists for _output_collections_with_later_updates
|
337
|
+
if artifact.run is not None and artifact.run != run:
|
337
338
|
artifact.run._output_artifacts_with_later_updates.add(artifact)
|
338
339
|
# update the run of the artifact with the latest run
|
339
340
|
stat_or_artifact.run = run
|
@@ -924,7 +925,7 @@ def open(
|
|
924
925
|
filepath.name == "soma" or filepath.suffix == ".tiledbsoma"
|
925
926
|
) and mode == "w"
|
926
927
|
# consider the case where an object is already locally cached
|
927
|
-
localpath = setup_settings.
|
928
|
+
localpath = setup_settings.paths.cloud_to_local_no_update(
|
928
929
|
filepath, cache_key=cache_key
|
929
930
|
)
|
930
931
|
if not is_tiledbsoma_w and localpath.exists():
|
@@ -962,12 +963,12 @@ def _synchronize_cleanup_on_error(
|
|
962
963
|
filepath: UPath, cache_key: str | None = None
|
963
964
|
) -> UPath:
|
964
965
|
try:
|
965
|
-
cache_path = setup_settings.
|
966
|
+
cache_path = setup_settings.paths.cloud_to_local(
|
966
967
|
filepath, cache_key=cache_key, print_progress=True
|
967
968
|
)
|
968
969
|
except Exception as e:
|
969
970
|
if not isinstance(filepath, LocalPathClasses):
|
970
|
-
cache_path = setup_settings.
|
971
|
+
cache_path = setup_settings.paths.cloud_to_local_no_update(
|
971
972
|
filepath, cache_key=cache_key
|
972
973
|
)
|
973
974
|
if cache_path.is_file():
|
@@ -1155,9 +1156,7 @@ def _cache_path(self) -> UPath:
|
|
1155
1156
|
)
|
1156
1157
|
if isinstance(filepath, LocalPathClasses):
|
1157
1158
|
return filepath
|
1158
|
-
return setup_settings.
|
1159
|
-
filepath, cache_key=cache_key
|
1160
|
-
)
|
1159
|
+
return setup_settings.paths.cloud_to_local_no_update(filepath, cache_key=cache_key)
|
1161
1160
|
|
1162
1161
|
|
1163
1162
|
# docstring handled through attach_func_to_class_method
|
lamindb/_collection.py
CHANGED
@@ -145,15 +145,16 @@ def __init__(
|
|
145
145
|
logger.warning(
|
146
146
|
f"returning existing collection with same hash: {existing_collection}"
|
147
147
|
)
|
148
|
-
# update the run of the existing
|
148
|
+
# update the run of the existing collection
|
149
149
|
if run is not None:
|
150
|
-
# save the information that this
|
151
|
-
#
|
152
|
-
|
150
|
+
# save the information that this collection was previously produced
|
151
|
+
# by another run
|
152
|
+
# note: same logic exists for _output_artifacts_with_later_updates
|
153
|
+
if existing_collection.run is not None and existing_collection.run != run:
|
153
154
|
existing_collection.run._output_collections_with_later_updates.add(
|
154
155
|
existing_collection
|
155
156
|
)
|
156
|
-
# update the run of the
|
157
|
+
# update the run of the collection with the latest run
|
157
158
|
existing_collection.run = run
|
158
159
|
existing_collection.transform = run.transform
|
159
160
|
init_self_from_db(collection, existing_collection)
|
@@ -186,6 +187,16 @@ def __init__(
|
|
186
187
|
_track_run_input(artifacts, run=run)
|
187
188
|
|
188
189
|
|
190
|
+
# docstring handled through attach_func_to_class_method
|
191
|
+
def append(self, artifact: Artifact, run: Run | None = None) -> Collection:
|
192
|
+
return Collection(
|
193
|
+
self.artifacts.all().list() + [artifact],
|
194
|
+
description=self.description,
|
195
|
+
revises=self,
|
196
|
+
run=run,
|
197
|
+
)
|
198
|
+
|
199
|
+
|
189
200
|
# internal function, not exposed to user
|
190
201
|
def from_artifacts(artifacts: Iterable[Artifact]) -> tuple[str, dict[str, str]]:
|
191
202
|
# assert all artifacts are already saved
|
@@ -352,6 +363,7 @@ def restore(self) -> None:
|
|
352
363
|
@doc_args(Collection.ordered_artifacts.__doc__)
|
353
364
|
def ordered_artifacts(self) -> QuerySet:
|
354
365
|
"""{}""" # noqa: D415
|
366
|
+
# tracking is done via QueryManager (_query_manager.py)
|
355
367
|
return self.artifacts.order_by("links_collection__id")
|
356
368
|
|
357
369
|
|
@@ -364,6 +376,7 @@ def data_artifact(self) -> Artifact | None:
|
|
364
376
|
|
365
377
|
METHOD_NAMES = [
|
366
378
|
"__init__",
|
379
|
+
"append",
|
367
380
|
"mapped",
|
368
381
|
"cache",
|
369
382
|
"load",
|