lamindb 1.11.2__py3-none-any.whl → 1.11.3__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
@@ -114,7 +114,7 @@ Backwards compatibility.
114
114
 
115
115
  # ruff: noqa: I001
116
116
  # denote a release candidate for 0.1.0 with 0.1rc1, 0.1a1, 0.1b1, etc.
117
- __version__ = "1.11.2"
117
+ __version__ = "1.11.3"
118
118
 
119
119
  import warnings as _warnings
120
120
 
lamindb/models/schema.py CHANGED
@@ -258,6 +258,12 @@ class Schema(SQLRecord, CanCurate, TracksRun):
258
258
 
259
259
  Composite schemas can have multiple slots, e.g., for an `AnnData`, one schema for slot `obs` and another one for `var`.
260
260
 
261
+ To create a schema, one of the following must be passed:
262
+ - `features`: A list of :class:`~lamindb.Feature` records, e.g., `[Feature(...), Feature(...)]`.
263
+ - `itype`: A registry field, e.g., `Feature` or `bionty.Gene.ensembl_gene_id`, to constrain feature identifiers to be valid identifiers of the registry.
264
+ - `slots`: A dictionary mapping slot names to :class:`~lamindb.Schema` objects, e.g., `{"obs": Schema(...), "var": Schema(...), "obsm": Schema(...)}`.
265
+ - `is_type=True`: To create a schema type, e.g., `ln.Schema(name="ProteinPanel", is_type=True)`.
266
+
261
267
  Args:
262
268
  features: `list[SQLRecord] | list[tuple[Feature, dict]] | None = None` Feature
263
269
  records, e.g., `[Feature(...), Feature(...)]` or Features with their config, e.g., `[Feature(...).with_config(optional=True)]`.
@@ -565,6 +571,10 @@ class Schema(SQLRecord, CanCurate, TracksRun):
565
571
  coerce_dtype=coerce_dtype,
566
572
  n_features=n_features,
567
573
  )
574
+ if not features and not slots and not is_type and not itype:
575
+ raise InvalidArgument(
576
+ "Please pass features or slots or itype or set is_type=True"
577
+ )
568
578
  if not is_type:
569
579
  schema = (
570
580
  Schema.objects.using(using)
@@ -1211,12 +1221,14 @@ def get_type_str(dtype: str | None) -> str | None:
1211
1221
  return type_str
1212
1222
 
1213
1223
 
1214
- def _get_related_name(self: Schema) -> str:
1224
+ def _get_related_name(self: Schema) -> str | None:
1215
1225
  related_models = dict_related_model_to_related_name(self, instance=self._state.db)
1216
- related_name = related_models.get(
1217
- parse_cat_dtype(self.itype, is_itype=True)["registry_str"]
1218
- )
1219
- return related_name
1226
+ if self.itype:
1227
+ related_name = related_models.get(
1228
+ parse_cat_dtype(self.itype, is_itype=True)["registry_str"]
1229
+ )
1230
+ return related_name
1231
+ return None
1220
1232
 
1221
1233
 
1222
1234
  class SchemaFeature(BaseSQLRecord, IsLink):
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: lamindb
3
- Version: 1.11.2
3
+ Version: 1.11.3
4
4
  Summary: A data framework for biology.
5
5
  Author-email: Lamin Labs <open-source@lamin.ai>
6
6
  Requires-Python: >=3.10,<3.14
@@ -10,8 +10,8 @@ Classifier: Programming Language :: Python :: 3.11
10
10
  Classifier: Programming Language :: Python :: 3.12
11
11
  Classifier: Programming Language :: Python :: 3.13
12
12
  Requires-Dist: lamin_utils==0.15.0
13
- Requires-Dist: lamin_cli==1.7.1
14
- Requires-Dist: lamindb_setup[aws]==1.10.1
13
+ Requires-Dist: lamin_cli==1.7.2
14
+ Requires-Dist: lamindb_setup[aws]==1.10.2
15
15
  Requires-Dist: bionty>=1.7a1
16
16
  Requires-Dist: wetlab>=1.5a1
17
17
  Requires-Dist: nbproject==0.11.1
@@ -1,4 +1,4 @@
1
- lamindb/__init__.py,sha256=HGxNpCYe-NeHQHiQXY8bEEfDXbH0zN_ucGrXIEO7cBw,3241
1
+ lamindb/__init__.py,sha256=HMUumigBGh4kV575MUCUvTam38t9r89FrswKHngTzgE,3241
2
2
  lamindb/_finish.py,sha256=4KkFyb9d-GEGjDw_zDrnGt_bq3auQ_OQu0hV-2U73AQ,21355
3
3
  lamindb/_tracked.py,sha256=fls9yd7EEGO9Ni51kA_pcBkeLpzm2HZrWtwYGQequNE,4395
4
4
  lamindb/_view.py,sha256=GOKTfwnEaly9fdeWo9SlhYRc3UWEyLDmTlIUzjFXMYY,4960
@@ -132,7 +132,7 @@ lamindb/models/query_set.py,sha256=zwMlYRfjvAQ4NjIKpk19ipiP43UhGiUoU2wxntnBDUY,3
132
132
  lamindb/models/record.py,sha256=2eKEDqpiX5-aN2kUVXLuTVvQUspqQ5h10onbQM6Ta7g,13041
133
133
  lamindb/models/run.py,sha256=LVZ2z5QV4aVYYsqGcLmMfqvPpKj4EGGHVts_RR8_c-E,14443
134
134
  lamindb/models/save.py,sha256=CEifxocJuoLIuapqtiGk-eKvXfQSK4v389CWBo4FxOA,17264
135
- lamindb/models/schema.py,sha256=LQuPQhyLitloRGxq6DWZMHcR-xDZY1NctPHjrC6t1iw,49827
135
+ lamindb/models/schema.py,sha256=2sULbJ-3bRkYvkhKImV3vbC5U_dW5IVzN6qYdS1n5y0,50656
136
136
  lamindb/models/sqlrecord.py,sha256=kL2YS0lAENLXVMC5bzQuOZrRpujdLsBCJCf0sX_4PlE,72686
137
137
  lamindb/models/storage.py,sha256=n7jth0RQ19K0W8ICbrAO942d5jBm1-h7DsrSjMJgAB0,15551
138
138
  lamindb/models/transform.py,sha256=FcIPqmSk1hahg2Cr8q6lm1kKpbdvu2JUceSlPIV9Dww,12780
@@ -142,7 +142,7 @@ lamindb/setup/_switch.py,sha256=njZJN__JOhVrBFGClQG1wobdhJJp6l_XzPGKtKSCrfU,434
142
142
  lamindb/setup/core/__init__.py,sha256=SevlVrc2AZWL3uALbE5sopxBnIZPWZ1IB0NBDudiAL8,167
143
143
  lamindb/setup/errors/__init__.py,sha256=bAHTxOUJW1rm4zpF0Pvqkftn8W6iMGnQ-uyNBu13Nfg,171
144
144
  lamindb/setup/types/__init__.py,sha256=ATaosOi6q-cDWB52T69_sRmLMqj8cHfc-vljzZsrJNw,169
145
- lamindb-1.11.2.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
146
- lamindb-1.11.2.dist-info/WHEEL,sha256=CpUCUxeHQbRN5UGRQHYRJorO5Af-Qy_fHMctcQ8DSGI,82
147
- lamindb-1.11.2.dist-info/METADATA,sha256=69LKvBDk40m1gfwl-DIpwIxQqCxNt5zPWf0zuIz9pHc,8552
148
- lamindb-1.11.2.dist-info/RECORD,,
145
+ lamindb-1.11.3.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
146
+ lamindb-1.11.3.dist-info/WHEEL,sha256=CpUCUxeHQbRN5UGRQHYRJorO5Af-Qy_fHMctcQ8DSGI,82
147
+ lamindb-1.11.3.dist-info/METADATA,sha256=FxBbZm4UuBjbwipN7ePcA9bdTVEcKTEPgo0GI-2tu8k,8552
148
+ lamindb-1.11.3.dist-info/RECORD,,