lamindb 1.1.1__py3-none-any.whl → 1.2a2__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 +28 -25
- lamindb/_tracked.py +1 -1
- lamindb/_view.py +2 -3
- lamindb/base/__init__.py +1 -1
- lamindb/base/ids.py +1 -10
- lamindb/core/__init__.py +7 -65
- lamindb/core/_context.py +34 -8
- lamindb/core/_settings.py +6 -6
- lamindb/core/_sync_git.py +1 -1
- lamindb/core/loaders.py +9 -8
- lamindb/core/storage/_backed_access.py +4 -2
- lamindb/core/storage/_tiledbsoma.py +6 -4
- lamindb/core/storage/_zarr.py +32 -11
- lamindb/core/storage/objects.py +59 -26
- lamindb/core/storage/paths.py +4 -1
- lamindb/curators/__init__.py +97 -81
- 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 +2601 -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} +28 -24
- lamindb/models/record.py +1757 -0
- lamindb/models/run.py +563 -0
- lamindb/{_save.py → models/save.py} +9 -7
- lamindb/models/schema.py +732 -0
- lamindb/models/transform.py +360 -0
- lamindb/models/ulabel.py +249 -0
- {lamindb-1.1.1.dist-info → lamindb-1.2a2.dist-info}/METADATA +5 -5
- {lamindb-1.1.1.dist-info → lamindb-1.2a2.dist-info}/RECORD +49 -50
- lamindb/_artifact.py +0 -1379
- lamindb/_collection.py +0 -440
- lamindb/_feature.py +0 -316
- lamindb/_is_versioned.py +0 -40
- lamindb/_record.py +0 -1064
- 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 -4475
- {lamindb-1.1.1.dist-info → lamindb-1.2a2.dist-info}/LICENSE +0 -0
- {lamindb-1.1.1.dist-info → lamindb-1.2a2.dist-info}/WHEEL +0 -0
@@ -8,8 +8,6 @@ from lamindb_setup.core._docs import doc_args
|
|
8
8
|
|
9
9
|
from lamindb.models import Record
|
10
10
|
|
11
|
-
from .core._settings import settings
|
12
|
-
|
13
11
|
if TYPE_CHECKING:
|
14
12
|
from lamindb.base.types import StrField
|
15
13
|
|
@@ -19,7 +17,7 @@ class QueryManager(models.Manager):
|
|
19
17
|
|
20
18
|
See Also:
|
21
19
|
|
22
|
-
:class:`lamindb.
|
20
|
+
:class:`lamindb.models.QuerySet`
|
23
21
|
`django Manager <https://docs.djangoproject.com/en/4.2/topics/db/managers/>`__
|
24
22
|
|
25
23
|
Examples:
|
@@ -39,8 +37,12 @@ class QueryManager(models.Manager):
|
|
39
37
|
self.source_field_name == "collection"
|
40
38
|
and self.target_field_name == "artifact"
|
41
39
|
):
|
40
|
+
from lamindb import settings
|
42
41
|
from lamindb.core._context import context
|
43
|
-
from lamindb.
|
42
|
+
from lamindb.models.artifact import (
|
43
|
+
WARNING_RUN_TRANSFORM,
|
44
|
+
_track_run_input,
|
45
|
+
)
|
44
46
|
|
45
47
|
if (
|
46
48
|
context.run is None
|
@@ -71,14 +73,14 @@ class QueryManager(models.Manager):
|
|
71
73
|
def df(self, **kwargs):
|
72
74
|
"""Convert to DataFrame.
|
73
75
|
|
74
|
-
For `**kwargs`, see :meth:`lamindb.
|
76
|
+
For `**kwargs`, see :meth:`lamindb.models.QuerySet.df`.
|
75
77
|
"""
|
76
78
|
return self.all().df(**kwargs)
|
77
79
|
|
78
80
|
def all(self):
|
79
81
|
"""Return QuerySet of all.
|
80
82
|
|
81
|
-
For `**kwargs`, see :meth:`lamindb.
|
83
|
+
For `**kwargs`, see :meth:`lamindb.models.QuerySet.df`.
|
82
84
|
"""
|
83
85
|
self._track_run_input_manager()
|
84
86
|
return self._all_base_class()
|
@@ -86,14 +88,14 @@ class QueryManager(models.Manager):
|
|
86
88
|
@doc_args(Record.search.__doc__)
|
87
89
|
def search(self, string: str, **kwargs):
|
88
90
|
"""{}""" # noqa: D415
|
89
|
-
from .
|
91
|
+
from .record import _search
|
90
92
|
|
91
93
|
return _search(cls=self.all(), string=string, **kwargs)
|
92
94
|
|
93
95
|
@doc_args(Record.lookup.__doc__)
|
94
96
|
def lookup(self, field: StrField | None = None, **kwargs) -> NamedTuple:
|
95
97
|
"""{}""" # noqa: D415
|
96
|
-
from .
|
98
|
+
from .record import _lookup
|
97
99
|
|
98
100
|
return _lookup(cls=self.all(), field=field, **kwargs)
|
99
101
|
|
@@ -5,7 +5,7 @@ import warnings
|
|
5
5
|
from collections import UserList
|
6
6
|
from collections.abc import Iterable
|
7
7
|
from collections.abc import Iterable as IterableType
|
8
|
-
from typing import TYPE_CHECKING, Any, Generic, NamedTuple, TypeVar
|
8
|
+
from typing import TYPE_CHECKING, Any, Generic, NamedTuple, TypeVar, Union
|
9
9
|
|
10
10
|
import pandas as pd
|
11
11
|
from django.core.exceptions import FieldError
|
@@ -15,27 +15,17 @@ from django.db.models.fields.related import ForeignObjectRel
|
|
15
15
|
from lamin_utils import logger
|
16
16
|
from lamindb_setup.core._docs import doc_args
|
17
17
|
|
18
|
-
from lamindb.models import
|
19
|
-
|
20
|
-
CanCurate,
|
21
|
-
Collection,
|
22
|
-
Feature,
|
23
|
-
IsVersioned,
|
24
|
-
Record,
|
25
|
-
Run,
|
26
|
-
Schema,
|
27
|
-
Transform,
|
28
|
-
)
|
18
|
+
from lamindb.models._is_versioned import IsVersioned
|
19
|
+
from lamindb.models.record import Record
|
29
20
|
|
30
|
-
from
|
31
|
-
|
32
|
-
T = TypeVar("T")
|
21
|
+
from ..errors import DoesNotExist
|
22
|
+
from .can_curate import CanCurate
|
33
23
|
|
34
24
|
if TYPE_CHECKING:
|
35
|
-
from collections.abc import Iterable
|
36
|
-
|
37
25
|
from lamindb.base.types import ListLike, StrField
|
38
26
|
|
27
|
+
T = TypeVar("T")
|
28
|
+
|
39
29
|
|
40
30
|
class MultipleResultsFound(Exception):
|
41
31
|
pass
|
@@ -82,6 +72,13 @@ def one_helper(self):
|
|
82
72
|
|
83
73
|
|
84
74
|
def get_backward_compat_filter_kwargs(queryset, expressions):
|
75
|
+
from lamindb.models import (
|
76
|
+
Artifact,
|
77
|
+
Collection,
|
78
|
+
Schema,
|
79
|
+
Transform,
|
80
|
+
)
|
81
|
+
|
85
82
|
if queryset.model in {Collection, Transform}:
|
86
83
|
name_mappings = {
|
87
84
|
"name": "key",
|
@@ -190,7 +187,7 @@ def process_expressions(queryset: QuerySet, expressions: dict) -> dict:
|
|
190
187
|
|
191
188
|
|
192
189
|
def get(
|
193
|
-
registry_or_queryset: type[Record]
|
190
|
+
registry_or_queryset: Union[type[Record], QuerySet],
|
194
191
|
idlike: int | str | None = None,
|
195
192
|
**expressions,
|
196
193
|
) -> Record:
|
@@ -257,7 +254,7 @@ class RecordList(UserList, Generic[T]):
|
|
257
254
|
|
258
255
|
def save(self) -> RecordList[T]:
|
259
256
|
"""Save all records to the database."""
|
260
|
-
from lamindb.
|
257
|
+
from lamindb.models.save import save
|
261
258
|
|
262
259
|
save(self)
|
263
260
|
return self
|
@@ -305,6 +302,11 @@ def get_basic_field_names(
|
|
305
302
|
|
306
303
|
|
307
304
|
def get_feature_annotate_kwargs(show_features: bool | list[str]) -> dict[str, Any]:
|
305
|
+
from lamindb.models import (
|
306
|
+
Artifact,
|
307
|
+
Feature,
|
308
|
+
)
|
309
|
+
|
308
310
|
features = Feature.filter()
|
309
311
|
if isinstance(show_features, list):
|
310
312
|
features.filter(name__in=show_features)
|
@@ -583,6 +585,8 @@ class QuerySet(models.QuerySet):
|
|
583
585
|
|
584
586
|
def delete(self, *args, **kwargs):
|
585
587
|
"""Delete all records in the query set."""
|
588
|
+
from lamindb.models import Artifact, Collection, Run, Transform
|
589
|
+
|
586
590
|
# both Transform & Run might reference artifacts
|
587
591
|
if self.model in {Artifact, Collection, Transform, Run}:
|
588
592
|
for record in self:
|
@@ -707,7 +711,7 @@ class QuerySet(models.QuerySet):
|
|
707
711
|
@doc_args(Record.search.__doc__)
|
708
712
|
def search(self, string: str, **kwargs):
|
709
713
|
"""{}""" # noqa: D415
|
710
|
-
from .
|
714
|
+
from .record import _search
|
711
715
|
|
712
716
|
return _search(cls=self, string=string, **kwargs)
|
713
717
|
|
@@ -715,7 +719,7 @@ def search(self, string: str, **kwargs):
|
|
715
719
|
@doc_args(Record.lookup.__doc__)
|
716
720
|
def lookup(self, field: StrField | None = None, **kwargs) -> NamedTuple:
|
717
721
|
"""{}""" # noqa: D415
|
718
|
-
from .
|
722
|
+
from .record import _lookup
|
719
723
|
|
720
724
|
return _lookup(cls=self, field=field, **kwargs)
|
721
725
|
|
@@ -723,7 +727,7 @@ def lookup(self, field: StrField | None = None, **kwargs) -> NamedTuple:
|
|
723
727
|
@doc_args(CanCurate.validate.__doc__)
|
724
728
|
def validate(self, values: ListLike, field: str | StrField | None = None, **kwargs):
|
725
729
|
"""{}""" # noqa: D415
|
726
|
-
from .
|
730
|
+
from .can_curate import _validate
|
727
731
|
|
728
732
|
return _validate(cls=self, values=values, field=field, **kwargs)
|
729
733
|
|
@@ -731,7 +735,7 @@ def validate(self, values: ListLike, field: str | StrField | None = None, **kwar
|
|
731
735
|
@doc_args(CanCurate.inspect.__doc__)
|
732
736
|
def inspect(self, values: ListLike, field: str | StrField | None = None, **kwargs):
|
733
737
|
"""{}""" # noqa: D415
|
734
|
-
from .
|
738
|
+
from .can_curate import _inspect
|
735
739
|
|
736
740
|
return _inspect(cls=self, values=values, field=field, **kwargs)
|
737
741
|
|
@@ -739,7 +743,7 @@ def inspect(self, values: ListLike, field: str | StrField | None = None, **kwarg
|
|
739
743
|
@doc_args(CanCurate.standardize.__doc__)
|
740
744
|
def standardize(self, values: Iterable, field: str | StrField | None = None, **kwargs):
|
741
745
|
"""{}""" # noqa: D415
|
742
|
-
from .
|
746
|
+
from .can_curate import _standardize
|
743
747
|
|
744
748
|
return _standardize(cls=self, values=values, field=field, **kwargs)
|
745
749
|
|