lamindb 0.73.0__py3-none-any.whl → 0.73.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 CHANGED
@@ -41,7 +41,7 @@ Modules & settings:
41
41
  """
42
42
 
43
43
  # denote a release candidate for 0.1.0 with 0.1rc1, 0.1a1, 0.1b1, etc.
44
- __version__ = "0.73.0"
44
+ __version__ = "0.73.2"
45
45
 
46
46
  import os as _os
47
47
 
lamindb/_annotate.py CHANGED
@@ -813,7 +813,10 @@ def standardize_and_inspect(
813
813
  values: Iterable[str], field: FieldAttr, registry: Registry, **kwargs
814
814
  ):
815
815
  """Standardize and inspect values using a registry."""
816
- if hasattr(registry, "standardize"):
816
+ if hasattr(registry, "standardize") and hasattr(
817
+ registry,
818
+ "synonyms", # https://github.com/laminlabs/lamindb/issues/1685
819
+ ):
817
820
  values = registry.standardize(values, field=field, mute=True, **kwargs)
818
821
  return registry.inspect(values, field=field, mute=True, **kwargs)
819
822
 
@@ -976,7 +979,7 @@ def save_artifact(
976
979
  except ImportError:
977
980
  pass
978
981
  if artifact is None:
979
- raise ValueError("data must be a DataFrame, AnnData or MuData object")
982
+ raise ValueError("data must be a DataFrame, AnnData or MuData object.")
980
983
  artifact.save()
981
984
 
982
985
  feature_kwargs = check_registry_organism(
lamindb/_artifact.py CHANGED
@@ -196,6 +196,8 @@ def get_stat_or_artifact(
196
196
  if not isinstance(path, LocalPathClasses):
197
197
  size, hash, hash_type = None, None, None
198
198
  if stat is not None:
199
+ # convert UPathStatResult to fsspec info dict
200
+ stat = stat.as_info()
199
201
  if "ETag" in stat: # is file
200
202
  size, hash, hash_type = get_stat_file_cloud(stat)
201
203
  elif stat["type"] == "directory":
@@ -1109,6 +1111,5 @@ for name in METHOD_NAMES:
1109
1111
  Artifact._delete_skip_storage = _delete_skip_storage
1110
1112
  Artifact._save_skip_storage = _save_skip_storage
1111
1113
  Artifact.path = path
1112
- Artifact.stage = cache
1113
1114
  # this seems a Django-generated function
1114
1115
  delattr(Artifact, "get_visibility_display")
lamindb/_registry.py CHANGED
@@ -54,7 +54,7 @@ def suggest_records_with_similar_names(record: Registry, kwargs) -> bool:
54
54
  """
55
55
  if kwargs.get("name") is None:
56
56
  return False
57
- queryset = _search(record.__class__, kwargs["name"], truncate_words=True, limit=5)
57
+ queryset = _search(record.__class__, kwargs["name"], truncate_words=True, limit=20)
58
58
  if not queryset.exists(): # empty queryset
59
59
  return False
60
60
  for alternative_record in queryset:
@@ -549,24 +549,3 @@ if ln_setup._TESTING: # type: ignore
549
549
 
550
550
  for name in METHOD_NAMES:
551
551
  attach_func_to_class_method(name, Registry, globals())
552
-
553
-
554
- @classmethod # type: ignore
555
- def __get_schema_name__(cls) -> str:
556
- schema_module_name = cls.__module__.split(".")[0]
557
- schema_name = schema_module_name.replace("lnschema_", "")
558
- return schema_name
559
-
560
-
561
- @classmethod # type: ignore
562
- def __get_name_with_schema__(cls) -> str:
563
- schema_name = cls.__get_schema_name__()
564
- if schema_name == "core":
565
- schema_prefix = ""
566
- else:
567
- schema_prefix = f"{schema_name}."
568
- return f"{schema_prefix}{cls.__name__}"
569
-
570
-
571
- Registry.__get_schema_name__ = __get_schema_name__
572
- Registry.__get_name_with_schema__ = __get_name_with_schema__
lamindb/_view.py CHANGED
@@ -1,14 +1,16 @@
1
1
  from __future__ import annotations
2
2
 
3
+ import builtins
3
4
  import importlib
4
5
  import inspect
5
6
 
6
- from IPython.display import display
7
7
  from lamin_utils import colors, logger
8
8
  from lamindb_setup import settings
9
9
  from lamindb_setup._init_instance import get_schema_module_name
10
10
  from lnschema_core import Registry
11
11
 
12
+ is_run_from_ipython = getattr(builtins, "__IPYTHON__", False)
13
+
12
14
 
13
15
  def view(
14
16
  n: int = 7, schema: str | None = None, registries: list[str] | None = None
@@ -25,6 +27,11 @@ def view(
25
27
  Examples:
26
28
  >>> ln.view()
27
29
  """
30
+ if is_run_from_ipython:
31
+ from IPython.display import display as show
32
+ else:
33
+ show = logger.print
34
+
28
35
  if schema is not None:
29
36
  schema_names = [schema]
30
37
  else:
@@ -60,4 +67,4 @@ def view(
60
67
  df = orm.df().iloc[-n:]
61
68
  if df.shape[0] > 0:
62
69
  logger.print(colors.blue(colors.bold(orm.__name__)))
63
- display(df)
70
+ show(df)
@@ -125,13 +125,13 @@ def validate_labels(labels: QuerySet | list | dict, parents: bool = True):
125
125
 
126
126
 
127
127
  class LabelManager:
128
- """Label manager (:attr:`~lamindb.core.Data.labels`).
128
+ """Label manager (:attr:`~lamindb.core.HasFeatures.labels`).
129
129
 
130
130
  This allows to manage untyped labels :class:`~lamindb.ULabel` and arbitrary
131
131
  typed labels (e.g., :class:`~bionty.CellLine`) and associate labels
132
132
  with features.
133
133
 
134
- See :class:`~lamindb.core.Data` for more information.
134
+ See :class:`~lamindb.core.HasFeatures` for more information.
135
135
  """
136
136
 
137
137
  def __init__(self, host: Artifact | Collection):
lamindb/core/schema.py CHANGED
@@ -1,10 +1,10 @@
1
- from typing import Type
1
+ from __future__ import annotations
2
2
 
3
3
  from django.db.models import ManyToManyField
4
4
  from lnschema_core.models import Feature, FeatureSet, LinkORM, Registry
5
5
 
6
6
 
7
- def dict_schema_name_to_model_name(orm: Type[Registry]) -> dict[str, Registry]:
7
+ def dict_schema_name_to_model_name(orm: type[Registry]) -> dict[str, Registry]:
8
8
  d: dict = {
9
9
  i.related_model.__get_name_with_schema__(): i.related_model
10
10
  for i in orm._meta.related_objects
@@ -21,7 +21,7 @@ def dict_schema_name_to_model_name(orm: Type[Registry]) -> dict[str, Registry]:
21
21
 
22
22
 
23
23
  def dict_related_model_to_related_name(
24
- orm: Type[Registry], links: bool = False
24
+ orm: type[Registry], links: bool = False
25
25
  ) -> dict[str, str]:
26
26
  def include(model: Registry):
27
27
  return not links != issubclass(model, LinkORM)
@@ -138,7 +138,7 @@ def process_is_new_version_of(
138
138
  if is_new_version_of is not None and not isinstance(is_new_version_of, type):
139
139
  raise TypeError(f"is_new_version_of has to be of type {type}")
140
140
  if is_new_version_of is None:
141
- uid = init_uid(version=version, n_full_id=type._len_stem_uid)
141
+ uid = init_uid(version=version, n_full_id=type._len_full_uid)
142
142
  else:
143
143
  uid, version = get_uid_from_old_version(is_new_version_of, version)
144
144
  if name is None:
@@ -39,9 +39,13 @@ def save_vitessce_config(vitessce_config: VitessceConfig, description: str) -> A
39
39
  if "url" not in file:
40
40
  raise ValueError("Each file must have a 'url' key.")
41
41
  filename = file["url"].split("/")[-1]
42
- assert filename.endswith((".anndata.zarr", ".spatialdata.zarr"))
43
- filestem = filename.replace(".anndata.zarr", "").replace(
44
- ".spatialdata.zarr", ""
42
+ assert filename.endswith(
43
+ (".anndata.zarr", ".spatialdata.zarr", ".ome.zarr")
44
+ )
45
+ filestem = (
46
+ filename.replace(".anndata.zarr", "")
47
+ .replace(".spatialdata.zarr", "")
48
+ .replace(".ome.zarr", "")
45
49
  )
46
50
  artifact = Artifact.filter(uid__startswith=filestem).one_or_none()
47
51
  if artifact is None:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lamindb
3
- Version: 0.73.0
3
+ Version: 0.73.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,8 +9,8 @@ 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.68.0
13
- Requires-Dist: lamindb_setup==0.73.0
12
+ Requires-Dist: lnschema_core==0.69.0
13
+ Requires-Dist: lamindb_setup==0.73.1
14
14
  Requires-Dist: lamin_utils==0.13.2
15
15
  Requires-Dist: lamin_cli==0.14.0
16
16
  Requires-Dist: rapidfuzz
@@ -25,7 +25,7 @@ Requires-Dist: graphviz
25
25
  Requires-Dist: psycopg2-binary
26
26
  Requires-Dist: psutil
27
27
  Requires-Dist: lamindb_setup[aws] ; extra == "aws"
28
- Requires-Dist: bionty==0.43.1 ; extra == "bionty"
28
+ Requires-Dist: bionty==0.44.0 ; extra == "bionty"
29
29
  Requires-Dist: pandas<2 ; extra == "dev"
30
30
  Requires-Dist: pre-commit ; extra == "dev"
31
31
  Requires-Dist: nox ; extra == "dev"
@@ -1,6 +1,6 @@
1
- lamindb/__init__.py,sha256=J7AraTNN8zk-iL_9_WY9zTUtEPPmvRdOK1r1-96jSfA,2207
2
- lamindb/_annotate.py,sha256=_2DeWFQ4pNaPtUYOqHzNPNrkvhPdxpl6i0OwynQ0jME,44271
3
- lamindb/_artifact.py,sha256=HnaCSfeW_1Knesvkz2loJH4AY7WBrm_pFRd-ZgVz6Pg,40747
1
+ lamindb/__init__.py,sha256=ewJ0w3ggVARCnYyCLLJ_24n2eQDgjK3TXkzjyBn67sE,2207
2
+ lamindb/_annotate.py,sha256=CScyKVB3k_x5p0pihxO1UrTFBCvPcSSjBXvGY3YgTLs,44381
3
+ lamindb/_artifact.py,sha256=uMUlXCGU1JYSnOYMxCwEe_1MslbcnZACP9SYL-a4zRk,40816
4
4
  lamindb/_can_validate.py,sha256=s1q0lxplqnhytrVgArBTm05XKMMmpreK0ZlVCsd2jjk,14849
5
5
  lamindb/_collection.py,sha256=AGiztgM_OIet617aF86muL6lIv6GEDcmXorize6V62U,14657
6
6
  lamindb/_feature.py,sha256=Aawz4jCgjhuneZnmoty7JkZI3zjA_50vr_0dnFjSN3U,7348
@@ -12,18 +12,18 @@ lamindb/_is_versioned.py,sha256=0PgRCmxEmYDcAjllLSOYZm132B1lW6QgmBBERhRyFt0,1341
12
12
  lamindb/_parents.py,sha256=kb5AHkntpTP5g2lk1aPL0FmIilYZYVZvj6stddFOI40,15075
13
13
  lamindb/_query_manager.py,sha256=qxwrBM8UmNQnUiNOfe84YN6NpfJBg2wQ2JqUfH6HHhc,4225
14
14
  lamindb/_query_set.py,sha256=JgdJY2pACCqjC4AHjFiMAdq_qjeuhEo2NUX68f6ODwk,11597
15
- lamindb/_registry.py,sha256=ukzQaMtfySnirfk6XMQKFLyaLIVxIp61TI3Y0WoE6og,19346
15
+ lamindb/_registry.py,sha256=hoBkVl8D4yLQKMoOhVIDTNkO_401yCoVHI4MlNHDZgI,18756
16
16
  lamindb/_run.py,sha256=b7A52M1On3QzFgIYyfQoz5Kk7V3wcu9p_Prq5bzd8v8,1838
17
17
  lamindb/_save.py,sha256=It4XO448D8NG2cReo9Xy0lQBQdkMm_rCx_TGD1qZWWc,11864
18
18
  lamindb/_storage.py,sha256=VW8xq3VRv58-ciholvOdlcgvp_OIlLxx5GxLt-e2Irs,614
19
19
  lamindb/_transform.py,sha256=E9C7psuOnsNrUQpWRuGgEUM8_pc7YhDn7n4ieHzB4X0,3169
20
20
  lamindb/_ulabel.py,sha256=XDSdZBXX_ki5s1vOths3MjF2x5DPggBR_PV_KF4SGyg,1611
21
21
  lamindb/_utils.py,sha256=LGdiW4k3GClLz65vKAVRkL6Tw-Gkx9DWAdez1jyA5bE,428
22
- lamindb/_view.py,sha256=GV1FrqIMmdooEkA-5zvcTWgV1nqx1sehi6WdWEaFpxM,2171
22
+ lamindb/_view.py,sha256=NdWWF75rmkCHefqBViUnsHLu3OViJ1z_bEvfcedydsw,2330
23
23
  lamindb/core/__init__.py,sha256=RkE5BrdOWNHQIz60z1npYoRim-Ot24-L7JTmLXd2WTU,1363
24
24
  lamindb/core/_data.py,sha256=xkjEvAhWeEEYRIZIi9Qbb0aEWiUPttq-qnCLx_2xy48,16172
25
25
  lamindb/core/_feature_manager.py,sha256=h7puH83LjaiJrBlmw3wSkUVO5c_LVfubCJKklPryP84,26205
26
- lamindb/core/_label_manager.py,sha256=uRwzRVXBN-3B6EFCR2oox3p3lfxtICcAipG-1zVIN9w,9626
26
+ lamindb/core/_label_manager.py,sha256=d9r3tiNDFbpZQmxE1jmgdgnMYPOfTPpAKGKtRRLmVj8,9640
27
27
  lamindb/core/_mapped_collection.py,sha256=_OwFZh5SePDUD70XIK5kngv3we_Z5-YdGHNfpUSatSQ,19469
28
28
  lamindb/core/_run_context.py,sha256=aGdZv4IeYo7QpXl9H9U7RNwpgzqGeCDKPuoSdtP-CAE,18988
29
29
  lamindb/core/_settings.py,sha256=rW1KfEXfT56XErwcnSuQxaCytpOy1kJ-u7tVmkmNmxY,6131
@@ -32,9 +32,9 @@ lamindb/core/_track_environment.py,sha256=xLZ6kgzxWS6MWZ5LQ_wkbJX99vmYOT8iQ-Fz4O
32
32
  lamindb/core/_transform_settings.py,sha256=eV96QKX9jOojjzF-a0oo0wXQsMXN2F6QV7orE06oFC8,161
33
33
  lamindb/core/exceptions.py,sha256=bbm-PeSy24qFcqh2HpucZWpwGAvk-TL_3FUoAPb3e3E,867
34
34
  lamindb/core/fields.py,sha256=Jgi_XI-iTe6cT7oD8FV_JqEpjN1Q9rZWwL8VLtj4jkA,164
35
- lamindb/core/schema.py,sha256=CshQ80Sau8yIeWC_hbP0E476EJx4-BzVv75wf5vW2No,1850
35
+ lamindb/core/schema.py,sha256=BbG7JGrXVLwEX_6eQb8ouJc9Q-MgazwqHvAM5dtrWtM,1861
36
36
  lamindb/core/types.py,sha256=xeQF2x40p2pR9eIVQrXT74RrS810z2fbjmTRTSQUqPM,230
37
- lamindb/core/versioning.py,sha256=eEnLPW7lumrkZY-EovZfaQWU44vnuWs4bFGZWrgNSGc,4943
37
+ lamindb/core/versioning.py,sha256=zbp3wAWOqU1uDF9wRrpaS9JfmRglUQtVHvFpWWoJHZk,4943
38
38
  lamindb/core/datasets/__init__.py,sha256=zRP98oqUAaXhqWyKMiH0s_ImVIuNeziQQ2kQ_t0f-DI,1353
39
39
  lamindb/core/datasets/_core.py,sha256=bMNtx2tXhzvjLkHmg9I5jE1xMTxPH68hovnX6_NjT6g,19858
40
40
  lamindb/core/datasets/_fake.py,sha256=BZF9R_1iF0HDnvtZNqL2FtsjSMuqDIfuFxnw_LJYIh4,953
@@ -46,10 +46,10 @@ lamindb/core/storage/_zarr.py,sha256=5ceEz6YIvgvUnVVNWhK5Z4W0WfrvyvY82Yna5jSX1_E
46
46
  lamindb/core/storage/objects.py,sha256=OzvBCS-Urz5mr-O95qYt6RGBDDX5HmjfRRKWPPDn1ZE,1797
47
47
  lamindb/core/storage/paths.py,sha256=H9OPCuI7fPNRmvtQRFda92VIi6whnW6Q9BAZ6U8VWI4,8203
48
48
  lamindb/integrations/__init__.py,sha256=aH2PmO2m4-vwIifMYTB0Fyyr_gZWtVnV71jT0tVWSw0,123
49
- lamindb/integrations/_vitessce.py,sha256=b0FqTBsP-M6Q7xCYXVwFwM8DOIeeOBZEhYbryhtq4gk,2535
49
+ lamindb/integrations/_vitessce.py,sha256=Qd39OuNsL0GXU7nMvEWLRRESFQ0mwGf_ePMJE_FDYm8,2639
50
50
  lamindb/setup/__init__.py,sha256=OwZpZzPDv5lPPGXZP7-zK6UdO4FHvvuBh439yZvIp3A,410
51
51
  lamindb/setup/core/__init__.py,sha256=SevlVrc2AZWL3uALbE5sopxBnIZPWZ1IB0NBDudiAL8,167
52
- lamindb-0.73.0.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
53
- lamindb-0.73.0.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
54
- lamindb-0.73.0.dist-info/METADATA,sha256=4HwOjMczVyTTooI8kH_aUPPO9rE-4gaCCUT86z7qExc,2735
55
- lamindb-0.73.0.dist-info/RECORD,,
52
+ lamindb-0.73.2.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
53
+ lamindb-0.73.2.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
54
+ lamindb-0.73.2.dist-info/METADATA,sha256=bsHf6jMyHwkf2btB1WlAnrsfjN-9ue3xBK0thFSQt_s,2735
55
+ lamindb-0.73.2.dist-info/RECORD,,