lamindb 0.76.0__py3-none-any.whl → 0.76.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.
@@ -3,6 +3,7 @@ from __future__ import annotations
3
3
  from typing import TYPE_CHECKING, Literal
4
4
 
5
5
  from lamin_utils import logger
6
+ from lamin_utils._base62 import CHARSET_DEFAULT as BASE62_CHARS
6
7
  from lamindb_setup.core.upath import LocalPathClasses, UPath
7
8
  from lnschema_core import ids
8
9
 
@@ -10,6 +11,28 @@ if TYPE_CHECKING:
10
11
  from lnschema_core.models import IsVersioned
11
12
 
12
13
 
14
+ def message_update_key_in_version_family(
15
+ *,
16
+ suid: str,
17
+ existing_key: str,
18
+ registry: str,
19
+ new_key: str,
20
+ ) -> str:
21
+ return f'Or update key "{existing_key}" in your existing family:\n\nln.{registry}.filter(uid__startswith="{suid}").update(key="{new_key}")'
22
+
23
+
24
+ def increment_base62(s: str) -> str:
25
+ # we don't need to throw an error for zzzz because uids are enforced to be unique
26
+ # on the db level and have an enforced maximum length
27
+ value = sum(BASE62_CHARS.index(c) * (62**i) for i, c in enumerate(reversed(s)))
28
+ value += 1
29
+ result = ""
30
+ while value:
31
+ value, remainder = divmod(value, 62)
32
+ result = BASE62_CHARS[remainder] + result
33
+ return result.zfill(len(s))
34
+
35
+
13
36
  def bump_version(
14
37
  version: str,
15
38
  bump_type: str = "minor",
@@ -65,57 +88,43 @@ def set_version(version: str | None = None, previous_version: str | None = None)
65
88
  version: Version string.
66
89
  previous_version: Previous version string.
67
90
  """
68
- if version == previous_version:
69
- raise ValueError(f"Please increment the previous version: '{previous_version}'")
70
91
  if version is None and previous_version is not None:
71
92
  version = bump_version(previous_version, bump_type="major")
72
93
  return version
73
94
 
74
95
 
75
- def init_uid(
96
+ def create_uid(
76
97
  *,
77
98
  version: str | None = None,
78
99
  n_full_id: int = 20,
79
- is_new_version_of: IsVersioned | None = None,
80
- ) -> str:
81
- if is_new_version_of is not None:
82
- stem_uid = is_new_version_of.stem_uid
100
+ revises: IsVersioned | None = None,
101
+ ) -> tuple[str, IsVersioned | None]:
102
+ if revises is not None:
103
+ if not revises.is_latest:
104
+ # need one more request
105
+ revises = revises.__class__.objects.get(
106
+ is_latest=True, uid__startswith=revises.stem_uid
107
+ )
108
+ logger.warning(
109
+ f"didn't pass the latest version in `revises`, retrieved it: {revises}"
110
+ )
111
+ suid = revises.stem_uid
112
+ vuid = increment_base62(revises.uid[-4:])
83
113
  else:
84
- stem_uid = ids.base62(n_full_id - 4)
114
+ suid = ids.base62(n_full_id - 4)
115
+ vuid = "0000"
85
116
  if version is not None:
86
117
  if not isinstance(version, str):
87
118
  raise ValueError(
88
119
  "`version` parameter must be `None` or `str`, e.g., '0.1', '1', '2',"
89
120
  " etc."
90
121
  )
91
- return stem_uid + ids.base62_4()
92
-
93
-
94
- def get_uid_from_old_version(
95
- is_new_version_of: IsVersioned,
96
- version: str | None = None,
97
- using_key: str | None = None,
98
- ) -> tuple[str, str]:
99
- """{}""" # noqa: D415
100
- msg = ""
101
- if is_new_version_of.version is None:
102
- previous_version = "1"
103
- msg = f"setting previous version to '{previous_version}'"
104
- else:
105
- previous_version = is_new_version_of.version
106
- version = set_version(version, previous_version)
107
- new_uid = init_uid(
108
- version=version,
109
- n_full_id=is_new_version_of._len_full_uid,
110
- is_new_version_of=is_new_version_of,
111
- )
112
- # the following covers the edge case where the old file was unversioned
113
- if is_new_version_of.version is None:
114
- is_new_version_of.version = previous_version
115
- is_new_version_of.save(using=using_key)
116
- if msg != "":
117
- msg += f"& new version to '{version}'"
118
- return new_uid, version
122
+ if revises is not None:
123
+ if version == revises.version:
124
+ raise ValueError(
125
+ f"Please increment the previous version: '{revises.version}'"
126
+ )
127
+ return suid + vuid, revises
119
128
 
120
129
 
121
130
  def get_new_path_from_uid(old_path: UPath, old_uid: str, new_uid: str):
@@ -128,18 +137,18 @@ def get_new_path_from_uid(old_path: UPath, old_uid: str, new_uid: str):
128
137
  return new_path
129
138
 
130
139
 
131
- def process_is_new_version_of(
132
- is_new_version_of: IsVersioned,
140
+ def process_revises(
141
+ revises: IsVersioned | None,
133
142
  version: str | None,
134
143
  name: str | None,
135
144
  type: type[IsVersioned],
136
- ) -> tuple[str, str, str]:
137
- if is_new_version_of is not None and not isinstance(is_new_version_of, type):
138
- raise TypeError(f"is_new_version_of has to be of type {type.__name__}")
139
- if is_new_version_of is None:
140
- uid = init_uid(version=version, n_full_id=type._len_full_uid)
141
- else:
142
- uid, version = get_uid_from_old_version(is_new_version_of, version)
145
+ ) -> tuple[str, str, str, IsVersioned | None]:
146
+ if revises is not None and not isinstance(revises, type):
147
+ raise TypeError(f"`revises` has to be of type `{type.__name__}`")
148
+ uid, revises = create_uid(
149
+ revises=revises, version=version, n_full_id=type._len_full_uid
150
+ )
151
+ if revises is not None:
143
152
  if name is None:
144
- name = is_new_version_of.name
145
- return uid, version, name
153
+ name = revises.name
154
+ return uid, version, name, revises
@@ -109,4 +109,6 @@ def save_vitessce_config(
109
109
  logger.important(
110
110
  f"go to: https://lamin.ai/{slug}/artifact/{vitessce_config_artifact.uid}"
111
111
  )
112
+ run.finished_at = datetime.now(timezone.utc)
113
+ run.save()
112
114
  return vitessce_config_artifact
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lamindb
3
- Version: 0.76.0
3
+ Version: 0.76.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,10 +9,10 @@ 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.73.0
13
- Requires-Dist: lamindb_setup==0.76.4
14
- Requires-Dist: lamin_utils==0.13.2
15
- Requires-Dist: lamin_cli==0.16.1
12
+ Requires-Dist: lnschema_core==0.73.2
13
+ Requires-Dist: lamindb_setup==0.76.6
14
+ Requires-Dist: lamin_utils==0.13.4
15
+ Requires-Dist: lamin_cli==0.16.2
16
16
  Requires-Dist: rapidfuzz
17
17
  Requires-Dist: pyarrow
18
18
  Requires-Dist: typing_extensions!=4.6.0
@@ -24,7 +24,7 @@ Requires-Dist: pandas
24
24
  Requires-Dist: graphviz
25
25
  Requires-Dist: psycopg2-binary
26
26
  Requires-Dist: lamindb_setup[aws] ; extra == "aws"
27
- Requires-Dist: bionty==0.48.1 ; extra == "bionty"
27
+ Requires-Dist: bionty==0.48.3 ; extra == "bionty"
28
28
  Requires-Dist: pre-commit ; extra == "dev"
29
29
  Requires-Dist: nox ; extra == "dev"
30
30
  Requires-Dist: laminci>=0.3 ; extra == "dev"
@@ -57,13 +57,5 @@ Provides-Extra: zarr
57
57
 
58
58
  # LaminDB - A data framework for biology
59
59
 
60
- - Manage data & metadata with a unified Python API ("lakehouse").
61
- - Track data lineage across notebooks & pipelines.
62
- - Integrate registries for experimental metadata & in-house ontologies.
63
- - Validate, standardize & annotate.
64
- - Collaborate across distributed databases.
65
-
66
- ## Documentation
67
-
68
- Read the [docs](https://lamin.ai/docs).
60
+ Read the [docs](https://docs.lamin.ai).
69
61
 
@@ -0,0 +1,59 @@
1
+ lamindb/__init__.py,sha256=OCLxYHwhRyaf6Zx-AKHTSEFWM-J342YRxDP2hhCIu6c,2309
2
+ lamindb/_artifact.py,sha256=RygNHePDo895KG61FctFRdHO4jVa9cmj-yBBsyRE50A,43840
3
+ lamindb/_can_validate.py,sha256=ne8-9sAG9vXnMXZqso6mYMt-xDg16h-gq6yHJXKFpuI,17690
4
+ lamindb/_collection.py,sha256=F_VgpLBprrzUQ-tPngWvO9vFd7jX66MVwIi031JOris,14871
5
+ lamindb/_curate.py,sha256=EAikoFg2rL8kRsWEIXH33P1VplSGAACMuFHanicguWw,55964
6
+ lamindb/_feature.py,sha256=nZhtrH0ssoNls-hV-dkwfK9sKypg2El59R9qfarxfUE,5340
7
+ lamindb/_feature_set.py,sha256=DmAy96V_RyV0yiyvWOCHgustXPsCaMwn4TrWwh2qDd8,8104
8
+ lamindb/_filter.py,sha256=Fs7_x3tA_KVz0lYt0bJkWfjnEKAnkVN20CfKhp9aKWg,1403
9
+ lamindb/_finish.py,sha256=wCjPmTBmL_z2WcZq9v6TZroZ_J_Te9KC5GzFuYdrIRc,9413
10
+ lamindb/_from_values.py,sha256=8kYpR8Q85EOaTcsPGjVHeZh29fGVgum5OEQf4Hsz_80,13533
11
+ lamindb/_is_versioned.py,sha256=5lAnhTboltFkZCKVRV1uxkm0OCjJz_HKi3yQq_vEuMs,1306
12
+ lamindb/_parents.py,sha256=eMavdd6IO6STOVJSlR2TzdRtx6sKYDKsMOtlR3DZlgQ,15599
13
+ lamindb/_query_manager.py,sha256=Ipe85HL31DDwMbC8CN_1Svbwk48a_DUh_INGQdZL08I,4222
14
+ lamindb/_query_set.py,sha256=mwNfGWcZbI5a1VfuiQzkweU4VQchE8Va8HiCIa0GNu4,11604
15
+ lamindb/_record.py,sha256=MDLvcsZ23lZkThnrYQtj_uW-1BnxCPpyJ5mKl9KPs4A,21199
16
+ lamindb/_run.py,sha256=5M_r1zGDv9HlqbqRKTWCYCOtENovJ-8mQ4kY7XqcLaU,1888
17
+ lamindb/_save.py,sha256=Fu7Z84btKOXfTfpunKLni21s5ER2zIllqg5e3nPq-0A,10910
18
+ lamindb/_storage.py,sha256=GBVChv-DHVMNEBJL5l_JT6B4RDhZ6NnwgzmUICphYKk,413
19
+ lamindb/_transform.py,sha256=Ck674iuKIp9HDpHuyFFM2xKJcFAUvQDRTnEdnx00Rq0,4114
20
+ lamindb/_ulabel.py,sha256=XDSdZBXX_ki5s1vOths3MjF2x5DPggBR_PV_KF4SGyg,1611
21
+ lamindb/_utils.py,sha256=LGdiW4k3GClLz65vKAVRkL6Tw-Gkx9DWAdez1jyA5bE,428
22
+ lamindb/_view.py,sha256=4Ln2ItTb3857PAI-70O8eJYqoTJ_NNFc7E_wds6OGns,2412
23
+ lamindb/core/__init__.py,sha256=QePKN3dkGuNEfIc2CKwBt3Kcl39bbghX6XwXKpK3BA0,1491
24
+ lamindb/core/_context.py,sha256=O4ovdIfvIC9E4oaqpSjBqwHOKThmP8_aod0MiOWaEwI,19517
25
+ lamindb/core/_data.py,sha256=eocOXsZGu62LPtz6yIlvHhPSJTf3yF2ITZTffyflWYI,16269
26
+ lamindb/core/_feature_manager.py,sha256=94tX6gq_Rx7fkDARQBxB2z92qUDpHocFSAdKv5izMT4,32490
27
+ lamindb/core/_label_manager.py,sha256=jSLvxAuTuOYosSh_QJhIz3bqnbmWKP43y5abVMb-hOQ,9240
28
+ lamindb/core/_mapped_collection.py,sha256=ST-cTfokIGkRadjSHEyvIK2san8cGr7WZpgbgs5neLI,22025
29
+ lamindb/core/_settings.py,sha256=GGEB8BU5GinIfD4ktr1Smp6GPHGaInu46MhP4EecZDY,5950
30
+ lamindb/core/_sync_git.py,sha256=qc0yfPyKeG4uuNT_3qsv-mkIMqhLFqfXNeNVO49vV00,4547
31
+ lamindb/core/_track_environment.py,sha256=STzEVUzOeUEWdX7WDJUkKH4u08k7eupRX6AXQwoVt14,828
32
+ lamindb/core/exceptions.py,sha256=qNFYN5Jc7Y6kw4re-jsW0AEIprsV2HB1wTcJiO-u-ks,1278
33
+ lamindb/core/fields.py,sha256=47Jmh3efUr5ZscgimR_yckY-I3cNf8ScLutbwKCK3j4,162
34
+ lamindb/core/schema.py,sha256=KiYQn_8fokSMztTNDe6qUocZzKXWxU32H-YChNJv51A,1877
35
+ lamindb/core/types.py,sha256=uVBqSVLoQaTkqP9nqsJhwU6yYnx8H5e6-ZxrB6vpOOw,265
36
+ lamindb/core/versioning.py,sha256=__SOHhk5OjMJgAUjixzp0GFcQrpjm8sBUXC9Fouk2AE,5162
37
+ lamindb/core/datasets/__init__.py,sha256=zRP98oqUAaXhqWyKMiH0s_ImVIuNeziQQ2kQ_t0f-DI,1353
38
+ lamindb/core/datasets/_core.py,sha256=CgVF_pXuBXLElzubDMsl1DbpYOnXCY0HleITVvBKih4,19873
39
+ lamindb/core/datasets/_fake.py,sha256=BZF9R_1iF0HDnvtZNqL2FtsjSMuqDIfuFxnw_LJYIh4,953
40
+ lamindb/core/storage/__init__.py,sha256=9B3JqHydQnclP4NUY2kEc99K1cJBQZA4jyy3EmDxsYk,541
41
+ lamindb/core/storage/_anndata_accessor.py,sha256=jmEZeeZlt8-qBXRkU0tTA-t6dVEb_dH86wc1ok0jSRY,24030
42
+ lamindb/core/storage/_anndata_sizes.py,sha256=aXO3OB--tF5MChenSsigW6Q-RuE8YJJOUTVukkLrv9A,1029
43
+ lamindb/core/storage/_backed_access.py,sha256=YcWCeT2eligJGsBdjJS_-4el_eC9J088jxUWG9lsleM,3231
44
+ lamindb/core/storage/_tiledbsoma.py,sha256=GNPG8pDYmZLFBSujsQ8VqlfWaFmDO58kgBXw6JESQJs,7812
45
+ lamindb/core/storage/_valid_suffixes.py,sha256=vUSeQ4s01rdhD_vSd6wKmFBsgMJAKkBMnL_T9Y1znMg,501
46
+ lamindb/core/storage/_zarr.py,sha256=5ceEz6YIvgvUnVVNWhK5Z4W0WfrvyvY82Yna5jSX1_E,3661
47
+ lamindb/core/storage/objects.py,sha256=OzvBCS-Urz5mr-O95qYt6RGBDDX5HmjfRRKWPPDn1ZE,1797
48
+ lamindb/core/storage/paths.py,sha256=woOrjtBhNnzm8DjF262ipwyZaQ_A-7MT2ZPoiefAfYk,7728
49
+ lamindb/core/subsettings/__init__.py,sha256=KFHPzIE7f7Bj4RgMjGQF4CjTdHVG_VNFBrCndo49ixo,198
50
+ lamindb/core/subsettings/_creation_settings.py,sha256=54mfMH_osC753hpxcl7Dq1rwBD2LHnWveXtQpkLBITE,1194
51
+ lamindb/core/subsettings/_transform_settings.py,sha256=4YbCuZtJo6zdytl6UQR4GvdDkTtT6SRBqVzofGzNOt8,583
52
+ lamindb/integrations/__init__.py,sha256=MoLRD_qqX5WHFUAqHL6zoY_cDkWH0zimaGT_1CyXKnk,124
53
+ lamindb/integrations/_vitessce.py,sha256=aDCyZTddpMfUzjEo0DXQ3XlD--ebSqnsGiMxJBunX90,5141
54
+ lamindb/setup/__init__.py,sha256=OwZpZzPDv5lPPGXZP7-zK6UdO4FHvvuBh439yZvIp3A,410
55
+ lamindb/setup/core/__init__.py,sha256=SevlVrc2AZWL3uALbE5sopxBnIZPWZ1IB0NBDudiAL8,167
56
+ lamindb-0.76.2.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
57
+ lamindb-0.76.2.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
58
+ lamindb-0.76.2.dist-info/METADATA,sha256=99nkmjVubVfQahE9S4aO1e8Ot6G4iFaPZltNBE-oFPo,2381
59
+ lamindb-0.76.2.dist-info/RECORD,,