lamindb 1.3.0__py3-none-any.whl → 1.3.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
@@ -72,7 +72,7 @@ Backward compatibility.
72
72
 
73
73
  # ruff: noqa: I001
74
74
  # denote a release candidate for 0.1.0 with 0.1rc1, 0.1a1, 0.1b1, etc.
75
- __version__ = "1.3.0"
75
+ __version__ = "1.3.2"
76
76
 
77
77
  import warnings
78
78
 
lamindb/_view.py CHANGED
@@ -11,7 +11,7 @@ from lamindb_setup._init_instance import get_schema_module_name
11
11
 
12
12
  from lamindb.models import Feature, FeatureValue, ParamValue, Record
13
13
 
14
- from .models.feature import convert_pandas_dtype_to_lamin_dtype
14
+ from .models.feature import serialize_pandas_dtype
15
15
 
16
16
  if TYPE_CHECKING:
17
17
  import pandas as pd
@@ -114,7 +114,7 @@ def view(
114
114
  """
115
115
  if df is not None:
116
116
  descriptions = {
117
- col_name: convert_pandas_dtype_to_lamin_dtype(dtype)
117
+ col_name: serialize_pandas_dtype(dtype)
118
118
  for col_name, dtype in df.dtypes.to_dict().items()
119
119
  }
120
120
  feature_dtypes = dict(Feature.objects.values_list("name", "dtype"))
lamindb/base/types.py CHANGED
@@ -7,7 +7,7 @@ Central object types.
7
7
 
8
8
  ArtifactKind
9
9
  TransformType
10
- FeatureDtype
10
+ Dtype
11
11
 
12
12
  Basic types.
13
13
 
@@ -38,14 +38,53 @@ TransformType = Literal[
38
38
  "pipeline", "notebook", "upload", "script", "function", "linker"
39
39
  ]
40
40
  ArtifactKind = Literal["dataset", "model"]
41
- FeatureDtype = Literal[
42
- "cat", # categorical variables
43
- "num", # numerical variables
44
- "str", # string variables
45
- "int", # integer variables
46
- "float", # float variables
47
- "bool", # boolean variables
48
- "date", # date variables
49
- "datetime", # datetime variables
50
- "object", # this is a pandas type, we're only using it for complicated types, not for strings
41
+
42
+ # below is used for Feature.dtype and Param.dtype
43
+ Dtype = Literal[
44
+ "cat", # categoricals
45
+ "num", # numericals
46
+ "str", # string
47
+ "int", # integer / numpy.integer
48
+ "float", # float
49
+ "bool", # boolean
50
+ "date", # date
51
+ "datetime", # datetime
52
+ "object", # this is a pandas input dtype, we're only using it for complicated types, not for strings
51
53
  ]
54
+ """Data type.
55
+
56
+ Data types in lamindb are a string-serialized abstraction of common data types.
57
+
58
+ Overview
59
+ ========
60
+
61
+ ============ ============ =================================================
62
+ description lamindb pandas
63
+ ============ ============ =================================================
64
+ categorical `"cat"` `category`
65
+ numerical `"num"` `int | float`
66
+ integer `"int"` `int64 | int32 | int16 | int8 | uint | ...`
67
+ float `"float"` `float64 | float32 | float16 | float8 | ...`
68
+ string `"str"` `object`
69
+ datetime `"datetime"` `datetime`
70
+ date `"date"` `date`
71
+ ============ ============ =================================================
72
+
73
+ Categoricals
74
+ ============
75
+
76
+ Beyond indicating that a feature is a categorical, `lamindb` allows you to define the registry to which values are restricted.
77
+
78
+ For example, `'cat[ULabel]'` or `'cat[bionty.CellType]'` indicate that permissible values are from the `ULabel` or `CellType` registry, respectively.
79
+
80
+ You can also reference multiple registries, e.g., `'cat[ULabel|bionty.CellType]'` indicates that values can be from either registry.
81
+
82
+ You can also restrict to sub-types defined in registries via the `type` column, e.g., `'cat[ULabel[CellMedium]]'` indicates that values must be of type `CellMedium` within the `ULabel` registry.
83
+
84
+ Literal
85
+ =======
86
+
87
+ A `Dtype` object in `lamindb` is a `Literal` up to further specification of `"cat"`.
88
+
89
+ """
90
+ FeatureDtype = Dtype # backward compat
lamindb/core/types.py CHANGED
@@ -6,7 +6,7 @@ from anndata import AnnData
6
6
  from lamindb_setup.core.types import UPathStr
7
7
 
8
8
  from lamindb.base.types import (
9
- FeatureDtype,
9
+ Dtype,
10
10
  FieldAttr,
11
11
  ListLike,
12
12
  StrField,