lamindb 0.71.1__py3-none-any.whl → 0.71.2__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/_run.py +2 -0
- lamindb/_transform.py +5 -11
- lamindb/core/_run_context.py +4 -0
- lamindb/core/versioning.py +18 -4
- {lamindb-0.71.1.dist-info → lamindb-0.71.2.dist-info}/METADATA +2 -2
- {lamindb-0.71.1.dist-info → lamindb-0.71.2.dist-info}/RECORD +9 -9
- {lamindb-0.71.1.dist-info → lamindb-0.71.2.dist-info}/LICENSE +0 -0
- {lamindb-0.71.1.dist-info → lamindb-0.71.2.dist-info}/WHEEL +0 -0
lamindb/__init__.py
CHANGED
lamindb/_run.py
CHANGED
@@ -13,6 +13,7 @@ def __init__(run: Run, *args, **kwargs):
|
|
13
13
|
transform: Transform = None
|
14
14
|
if "transform" in kwargs or len(args) == 1:
|
15
15
|
transform = kwargs.pop("transform") if len(args) == 0 else args[0]
|
16
|
+
params: str | None = kwargs.pop("params") if "params" in kwargs else None
|
16
17
|
reference: str | None = kwargs.pop("reference") if "reference" in kwargs else None
|
17
18
|
reference_type: str | None = (
|
18
19
|
kwargs.pop("reference_type") if "reference_type" in kwargs else None
|
@@ -25,6 +26,7 @@ def __init__(run: Run, *args, **kwargs):
|
|
25
26
|
transform=transform,
|
26
27
|
reference=reference,
|
27
28
|
reference_type=reference_type,
|
29
|
+
json=params,
|
28
30
|
)
|
29
31
|
|
30
32
|
|
lamindb/_transform.py
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
from __future__ import annotations
|
2
2
|
|
3
|
-
from lnschema_core.models import
|
3
|
+
from lnschema_core.models import Run, Transform
|
4
4
|
from lnschema_core.types import TransformType
|
5
5
|
|
6
6
|
from ._run import delete_run_artifacts
|
7
|
-
from .core.versioning import
|
7
|
+
from .core.versioning import process_is_new_version_of
|
8
8
|
|
9
9
|
|
10
10
|
def __init__(transform: Transform, *args, **kwargs):
|
@@ -32,15 +32,9 @@ def __init__(transform: Transform, *args, **kwargs):
|
|
32
32
|
"Only name, key, version, type, is_new_version_of, reference, "
|
33
33
|
f"reference_type can be passed, but you passed: {kwargs}"
|
34
34
|
)
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
if not isinstance(is_new_version_of, Transform):
|
39
|
-
raise TypeError("is_new_version_of has to be of type ln.Transform")
|
40
|
-
new_uid, version = get_uid_from_old_version(is_new_version_of, version)
|
41
|
-
if name is None:
|
42
|
-
name = is_new_version_of.name
|
43
|
-
|
35
|
+
new_uid, version, name = process_is_new_version_of(
|
36
|
+
is_new_version_of, version, name, Transform
|
37
|
+
)
|
44
38
|
# this is only because the user-facing constructor allows passing an id
|
45
39
|
# most others don't
|
46
40
|
if uid is None:
|
lamindb/core/_run_context.py
CHANGED
@@ -201,6 +201,7 @@ class run_context:
|
|
201
201
|
def _track(
|
202
202
|
cls,
|
203
203
|
*,
|
204
|
+
params: dict | None = None,
|
204
205
|
transform: Transform | None = None,
|
205
206
|
new_run: bool | None = None,
|
206
207
|
path: str | None = None,
|
@@ -216,6 +217,7 @@ class run_context:
|
|
216
217
|
whether the script exists in the git repository and add a link.
|
217
218
|
|
218
219
|
Args:
|
220
|
+
params: A dictionary of parameters to track for the run.
|
219
221
|
transform: Can be of type `"pipeline"` or `"notebook"`
|
220
222
|
(:class:`~lamindb.core.types.TransformType`).
|
221
223
|
new_run: If `False`, loads latest run of transform
|
@@ -310,11 +312,13 @@ class run_context:
|
|
310
312
|
)
|
311
313
|
if run is not None: # loaded latest run
|
312
314
|
run.started_at = datetime.now(timezone.utc) # update run time
|
315
|
+
run.json = params # update run params
|
313
316
|
logger.important(f"loaded: {run}")
|
314
317
|
|
315
318
|
if run is None: # create new run
|
316
319
|
run = Run(
|
317
320
|
transform=cls.transform,
|
321
|
+
params=params,
|
318
322
|
)
|
319
323
|
logger.important(f"saved: {run}")
|
320
324
|
# can only determine at ln.finish() if run was consecutive in
|
lamindb/core/versioning.py
CHANGED
@@ -42,10 +42,7 @@ def init_uid(
|
|
42
42
|
if is_new_version_of is not None:
|
43
43
|
stem_uid = is_new_version_of.stem_uid
|
44
44
|
else:
|
45
|
-
|
46
|
-
stem_uid = ids.base62_16()
|
47
|
-
elif n_full_id == 16:
|
48
|
-
stem_uid = ids.base62_12()
|
45
|
+
stem_uid = ids.base62(n_full_id - 4)
|
49
46
|
if version is not None:
|
50
47
|
if not isinstance(version, str):
|
51
48
|
raise ValueError(
|
@@ -90,3 +87,20 @@ def get_new_path_from_uid(old_path: UPath, old_uid: str, new_uid: str):
|
|
90
87
|
# for cloud path, the rename target must be the last part of the path
|
91
88
|
new_path = old_path.name.replace(old_uid, new_uid)
|
92
89
|
return new_path
|
90
|
+
|
91
|
+
|
92
|
+
def process_is_new_version_of(
|
93
|
+
is_new_version_of: IsVersioned,
|
94
|
+
version: str | None,
|
95
|
+
name: str | None,
|
96
|
+
type: type[IsVersioned],
|
97
|
+
) -> tuple[str, str, str]:
|
98
|
+
if is_new_version_of is not None and not isinstance(is_new_version_of, type):
|
99
|
+
raise TypeError(f"is_new_version_of has to be of type {type}")
|
100
|
+
if is_new_version_of is None:
|
101
|
+
uid = init_uid(version=version, n_full_id=type._len_stem_uid)
|
102
|
+
else:
|
103
|
+
uid, version = get_uid_from_old_version(is_new_version_of, version)
|
104
|
+
if name is None:
|
105
|
+
name = is_new_version_of.name
|
106
|
+
return uid, version, name
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.1
|
2
2
|
Name: lamindb
|
3
|
-
Version: 0.71.
|
3
|
+
Version: 0.71.2
|
4
4
|
Summary: A data framework for biology.
|
5
5
|
Author-email: Lamin Labs <open-source@lamin.ai>
|
6
6
|
Requires-Python: >=3.8
|
@@ -9,7 +9,7 @@ Classifier: Programming Language :: Python :: 3.8
|
|
9
9
|
Classifier: Programming Language :: Python :: 3.9
|
10
10
|
Classifier: Programming Language :: Python :: 3.10
|
11
11
|
Classifier: Programming Language :: Python :: 3.11
|
12
|
-
Requires-Dist: lnschema_core==0.66.
|
12
|
+
Requires-Dist: lnschema_core==0.66.4
|
13
13
|
Requires-Dist: lamindb_setup==0.71.3
|
14
14
|
Requires-Dist: lamin_utils==0.13.2
|
15
15
|
Requires-Dist: lamin_cli==0.13.1
|
@@ -1,4 +1,4 @@
|
|
1
|
-
lamindb/__init__.py,sha256=
|
1
|
+
lamindb/__init__.py,sha256=GKrW6unkqBBwwpxTXjuUv-5k4c4unimsV-vGFSWt68I,2182
|
2
2
|
lamindb/_annotate.py,sha256=kgbilILfgzoS-GEpjxzVwRMs7CoSa9BNEcIWXFBW69I,43915
|
3
3
|
lamindb/_artifact.py,sha256=8uBW-dhuWyBUQGs728sAPCnuhTic-NKjSbaneF07aMo,40106
|
4
4
|
lamindb/_can_validate.py,sha256=nvoZG-35n3HofkY4Xc6hBv9AV54_RDan7Hzp5TuqY9I,14709
|
@@ -13,10 +13,10 @@ lamindb/_parents.py,sha256=N9T8jbd3eaoHDLE9TD1y1QgGcO81E6Brapy8LILzRCQ,14790
|
|
13
13
|
lamindb/_query_manager.py,sha256=3zokXqxgj9vTJBnN2sbYKS-q69fyDDPF_aGq_rFHzXU,4066
|
14
14
|
lamindb/_query_set.py,sha256=n0owd74cTzGz6-mIv8SlDz0wcyRz7Xw3Ke1LhE8UlIg,10784
|
15
15
|
lamindb/_registry.py,sha256=fmX-BUnan3Y0WrEAx3qNwRYCIJwJgjoKnRnpgcXujEI,19358
|
16
|
-
lamindb/_run.py,sha256=
|
16
|
+
lamindb/_run.py,sha256=We50MUeGH778begutDGoNFM-n5_81_BfMCnZS1bdkt0,1937
|
17
17
|
lamindb/_save.py,sha256=_7r3TUV3B6Hp75r5O_ymu3fKWyBHbGa5vmE_pxrtsVI,10923
|
18
18
|
lamindb/_storage.py,sha256=VW8xq3VRv58-ciholvOdlcgvp_OIlLxx5GxLt-e2Irs,614
|
19
|
-
lamindb/_transform.py,sha256=
|
19
|
+
lamindb/_transform.py,sha256=E9C7psuOnsNrUQpWRuGgEUM8_pc7YhDn7n4ieHzB4X0,3169
|
20
20
|
lamindb/_ulabel.py,sha256=e5dw9h1tR0_u-DMn7Gzx0WhUhV5w7j4v3QbnLWQV7eI,1941
|
21
21
|
lamindb/_utils.py,sha256=LGdiW4k3GClLz65vKAVRkL6Tw-Gkx9DWAdez1jyA5bE,428
|
22
22
|
lamindb/_view.py,sha256=GV1FrqIMmdooEkA-5zvcTWgV1nqx1sehi6WdWEaFpxM,2171
|
@@ -25,7 +25,7 @@ lamindb/core/_data.py,sha256=Lico6-Vx15bNpGLl1bqFqEsh62pD4YKOOBnmahse1tI,17673
|
|
25
25
|
lamindb/core/_feature_manager.py,sha256=uTzZZ7-qqEAmdwi48Holy2j5VGTgmoQxhb21r6mLShI,15824
|
26
26
|
lamindb/core/_label_manager.py,sha256=0RtegYnK3zIisOnd970EobOrHMpp7OCH-mEoPrPXw2c,9075
|
27
27
|
lamindb/core/_mapped_collection.py,sha256=_OwFZh5SePDUD70XIK5kngv3we_Z5-YdGHNfpUSatSQ,19469
|
28
|
-
lamindb/core/_run_context.py,sha256=
|
28
|
+
lamindb/core/_run_context.py,sha256=7iCCOB2z154puBI7ZKzcaEZ5l6_9S8aSYBOBJI65lyc,17117
|
29
29
|
lamindb/core/_settings.py,sha256=rW1KfEXfT56XErwcnSuQxaCytpOy1kJ-u7tVmkmNmxY,6131
|
30
30
|
lamindb/core/_sync_git.py,sha256=06Te35UZj2QBaHNcc59VSC9vJgcFct7Z2sK78NLkZBs,4119
|
31
31
|
lamindb/core/_track_environment.py,sha256=xLZ6kgzxWS6MWZ5LQ_wkbJX99vmYOT8iQ-Fz4OHCgWw,754
|
@@ -33,7 +33,7 @@ lamindb/core/_transform_settings.py,sha256=eV96QKX9jOojjzF-a0oo0wXQsMXN2F6QV7orE
|
|
33
33
|
lamindb/core/exceptions.py,sha256=PHk5lyBdJPrrEQcid3ItfdNzz3fgiQsUmsEDdz063F0,197
|
34
34
|
lamindb/core/fields.py,sha256=Jgi_XI-iTe6cT7oD8FV_JqEpjN1Q9rZWwL8VLtj4jkA,164
|
35
35
|
lamindb/core/types.py,sha256=xeQF2x40p2pR9eIVQrXT74RrS810z2fbjmTRTSQUqPM,230
|
36
|
-
lamindb/core/versioning.py,sha256=
|
36
|
+
lamindb/core/versioning.py,sha256=T9d28erodCUmFlRA7InralbRoffdniPQxBE7qWqs2u8,3601
|
37
37
|
lamindb/core/datasets/__init__.py,sha256=zRP98oqUAaXhqWyKMiH0s_ImVIuNeziQQ2kQ_t0f-DI,1353
|
38
38
|
lamindb/core/datasets/_core.py,sha256=9bcDfVfMZ1h1WAS88ZBjy-R91xbP2KIm_ofHguXAKpY,20177
|
39
39
|
lamindb/core/datasets/_fake.py,sha256=BZF9R_1iF0HDnvtZNqL2FtsjSMuqDIfuFxnw_LJYIh4,953
|
@@ -48,7 +48,7 @@ lamindb/integrations/__init__.py,sha256=aH2PmO2m4-vwIifMYTB0Fyyr_gZWtVnV71jT0tVW
|
|
48
48
|
lamindb/integrations/_vitessce.py,sha256=b0FqTBsP-M6Q7xCYXVwFwM8DOIeeOBZEhYbryhtq4gk,2535
|
49
49
|
lamindb/setup/__init__.py,sha256=OwZpZzPDv5lPPGXZP7-zK6UdO4FHvvuBh439yZvIp3A,410
|
50
50
|
lamindb/setup/core/__init__.py,sha256=SevlVrc2AZWL3uALbE5sopxBnIZPWZ1IB0NBDudiAL8,167
|
51
|
-
lamindb-0.71.
|
52
|
-
lamindb-0.71.
|
53
|
-
lamindb-0.71.
|
54
|
-
lamindb-0.71.
|
51
|
+
lamindb-0.71.2.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
|
52
|
+
lamindb-0.71.2.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
|
53
|
+
lamindb-0.71.2.dist-info/METADATA,sha256=l49_xPwqfUDB6jUvUQoAVeQu8Tj3JUNCfTPB9cqOq_Y,2674
|
54
|
+
lamindb-0.71.2.dist-info/RECORD,,
|
File without changes
|
File without changes
|