lamindb 0.45.0__py3-none-any.whl → 0.46a1__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.
@@ -6,11 +6,11 @@ from typing import Union
6
6
  import anndata as ad
7
7
  import fsspec
8
8
  import pandas as pd
9
+ from lamin_logger import logger
9
10
  from lamindb_setup import settings
11
+ from lamindb_setup.dev import StorageSettings
10
12
  from lamindb_setup.dev.upath import UPath, infer_filesystem
11
- from lnschema_core.models import File
12
-
13
- from lamindb._file_access import attempt_accessing_path
13
+ from lnschema_core.models import File, Storage
14
14
 
15
15
  try:
16
16
  from ._zarr import read_adata_zarr
@@ -20,6 +20,51 @@ except ImportError:
20
20
  raise ImportError("Please install zarr: pip install zarr")
21
21
 
22
22
 
23
+ AUTO_KEY_PREFIX = ".lamindb/"
24
+
25
+
26
+ # add type annotations back asap when re-organizing the module
27
+ def auto_storage_key_from_file(file: File):
28
+ if file.key is None:
29
+ return f"{AUTO_KEY_PREFIX}{file.id}{file.suffix}"
30
+ else:
31
+ return file.key
32
+
33
+
34
+ def attempt_accessing_path(file: File, storage_key: str):
35
+ if file.storage_id == settings.storage.id:
36
+ path = settings.storage.key_to_filepath(storage_key)
37
+ else:
38
+ logger.warning(
39
+ "file.path() is slower for files outside the currently configured storage"
40
+ " location"
41
+ )
42
+ storage = Storage.select(id=file.storage_id).one()
43
+ # find a better way than passing None to instance_settings in the future!
44
+ storage_settings = StorageSettings(storage.root, instance_settings=None)
45
+ path = storage_settings.key_to_filepath(storage_key)
46
+ # the following is for backward compat
47
+ if storage_key.startswith(AUTO_KEY_PREFIX) and not path.exists():
48
+ logger.warning(
49
+ "You have auto-keyed files in your storage root, please move them into"
50
+ f" {AUTO_KEY_PREFIX} within your storage location"
51
+ )
52
+ # try legacy_storage_key in root
53
+ for previous_prefix in ["", "lndb/"]:
54
+ legacy_storage_key = storage_key.replace(AUTO_KEY_PREFIX, previous_prefix)
55
+ path = settings.storage.key_to_filepath(legacy_storage_key)
56
+ if path.exists():
57
+ return path
58
+ return path
59
+
60
+
61
+ # add type annotations back asap when re-organizing the module
62
+ def filepath_from_file(file: File):
63
+ storage_key = auto_storage_key_from_file(file)
64
+ path = attempt_accessing_path(file, storage_key)
65
+ return path
66
+
67
+
23
68
  def read_adata_h5ad(filepath, **kwargs) -> ad.AnnData:
24
69
  fs, filepath = infer_filesystem(filepath)
25
70
 
@@ -9,6 +9,7 @@ def infer_suffix(dmem, adata_format: Optional[str] = None):
9
9
  """Infer LaminDB storage file suffix from a data object."""
10
10
  if isinstance(dmem, AnnData):
11
11
  if adata_format is not None:
12
+ # below should be zrad, not zarr
12
13
  if adata_format not in ("h5ad", "zarr"):
13
14
  raise ValueError
14
15
  return "." + adata_format
lamindb/dev/utils.py ADDED
@@ -0,0 +1,9 @@
1
+ def attach_func_to_class_method(func_name, cls, globals):
2
+ implementation = globals[func_name]
3
+ target = getattr(cls, func_name)
4
+ # assigning the original class definition docstring
5
+ # to the implementation only has an effect for regular methods
6
+ # not for class methods
7
+ # this is why we need @doc_args for class methods
8
+ implementation.__doc__ = target.__doc__
9
+ setattr(cls, func_name, implementation)
lamindb/types.py CHANGED
@@ -5,6 +5,14 @@
5
5
 
6
6
  PathLike
7
7
  DataLike
8
+ StrField
9
+ ListLike
8
10
  TransformType
9
11
  """
10
- from lnschema_core.types import DataLike, PathLike, TransformType # noqa
12
+ from lnschema_core.types import ( # noqa
13
+ DataLike,
14
+ ListLike,
15
+ PathLike,
16
+ StrField,
17
+ TransformType,
18
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lamindb
3
- Version: 0.45.0
3
+ Version: 0.46a1
4
4
  Summary: LaminDB: Manage R&D data & analyses.
5
5
  Author-email: Lamin Labs <laminlabs@gmail.com>
6
6
  Requires-Python: >=3.8
@@ -8,9 +8,9 @@ Description-Content-Type: text/markdown
8
8
  Classifier: Programming Language :: Python :: 3.8
9
9
  Classifier: Programming Language :: Python :: 3.9
10
10
  Classifier: Programming Language :: Python :: 3.10
11
- Requires-Dist: lnschema_core==0.36.1
12
- Requires-Dist: lamindb_setup==0.47.11
13
- Requires-Dist: lamin_logger==0.7.1
11
+ Requires-Dist: lnschema_core==0.38.0
12
+ Requires-Dist: lamindb_setup==0.48.1
13
+ Requires-Dist: lamin_logger==0.7.4
14
14
  Requires-Dist: erdiagram>=0.1.2
15
15
  Requires-Dist: rapidfuzz
16
16
  Requires-Dist: pydantic[dotenv]
@@ -24,7 +24,7 @@ Requires-Dist: pandas
24
24
  Requires-Dist: botocore==1.29.76 ; extra == "aws"
25
25
  Requires-Dist: boto3==1.26.76 ; extra == "aws"
26
26
  Requires-Dist: fsspec[s3]==2023.5.0 ; extra == "aws"
27
- Requires-Dist: lnschema_bionty==0.24.0 ; extra == "bionty"
27
+ Requires-Dist: lnschema_bionty==0.25.5 ; extra == "bionty"
28
28
  Requires-Dist: readfcs>=1.1.3 ; extra == "fcs"
29
29
  Requires-Dist: fsspec[gs]==2023.5.0 ; extra == "gcp"
30
30
  Requires-Dist: nbproject>=0.9.0 ; extra == "jupyter"
@@ -57,7 +57,9 @@ Provides-Extra: zarr
57
57
 
58
58
  # LaminDB
59
59
 
60
- Open-source data lake to manage your existing data in your existing infrastructure.
60
+ Open-source data lake, warehouse & feature store for biology.
61
+
62
+ Manage your existing data & analyses in your existing infrastructure.
61
63
 
62
64
  ```{warning}
63
65
 
@@ -69,21 +71,22 @@ Update 2023-06-14:
69
71
  - The last version before the migration is 0.41.2.
70
72
  ```
71
73
 
72
- ## Features
74
+ ## What?
73
75
 
74
- Free:
76
+ LaminDB is a free & open-source Python library allowing you to:
75
77
 
76
- - Track [data lineage](https://lamin.ai/docs/guide/data-lineage) across notebooks, pipelines & apps.
77
- - Manage [biological registries, ontologies & features](https://lamin.ai/docs/biology/registries).
78
- - [Query, search & look up anything](https://lamin.ai/docs/guide/select), [manage & migrate custom schemas](https://lamin.ai/docs/setup/migrate).
79
- - [Persist, load](https://lamin.ai/docs/guide/files-records#in-memory-objects) & [stream data objects](https://lamin.ai/docs/guide/stream) with a single line of code.
80
- - [Idempotent](https://lamin.ai/docs/faq/idempotency) and [ACID](https://lamin.ai/docs/faq/acid) operations.
81
- - Use a mesh of LaminDB instances and [share them in a hub](https://lamin.ai/laminlabs) akin to GitHub.
78
+ - Manage files & datasets while tracking [provenance](https://lamin.ai/docs/guide/data-lineage) across pipelines, notebooks & apps.
79
+ - Manage biological [registries](https://lamin.ai/docs/biology/registries), [ontologies](https://lamin.ai/docs/bionty/) & features.
80
+ - Rely on integrity & quality through largely automated data validation and [idempotent](https://lamin.ai/docs/faq/idempotency) & [ACID](https://lamin.ai/docs/faq/acid) operations.
81
+ - Use a simple API for common tasks like:
82
+ - [Queries, searches & look ups](https://lamin.ai/docs/guide/select).
83
+ - Saving, loading & [streaming](https://lamin.ai/docs/guide/stream) of data objects.
84
+ - Collaborate across a mesh of LaminDB instances ([share them in a hub](https://lamin.ai/laminlabs) akin to GitHub).
82
85
 
83
- Enterprise:
86
+ You can combine LaminDB with LaminApp & consulting services on an enterprise plan:
84
87
 
85
- - Explore, share data & submit samples with LaminApp (deployable in your infrastructure).
86
- - Receive support, code templates & services for a BioTech data & analytics platform.
88
+ - LaminApp: Explore & collaborate on data in a UI (deployable in your infrastructure).
89
+ - Services: Support & code templates for a BioTech data & analytics platform.
87
90
 
88
91
  ## Usage overview
89
92
 
@@ -0,0 +1,36 @@
1
+ lamindb/__init__.py,sha256=oNhOp57mSmXcWLsgnviLZJE52YLsoWR0x0wdB0TvZKA,2843
2
+ lamindb/_context.py,sha256=HxFGplpi4KP5X4pQ0WOhN85rEv3J0GSNVPWtx4EPlPQ,14229
3
+ lamindb/_dataset.py,sha256=Bu5Peo7KS4V6mRWuaWTtQwshtPRKW13JbnvsHXY_c58,5322
4
+ lamindb/_delete.py,sha256=wQqi17_YOO1QT-eKgHycewrw_qpbsRLv7siBkhynyUk,1245
5
+ lamindb/_feature_set.py,sha256=eUzfPYY2zRhiN9KSNgqJaryM1RRFH_n_EXN1Bri5tb4,4896
6
+ lamindb/_file.py,sha256=AR4EVjHnF-vnGxC_101ms1DGbK8NEwHeLNue0S14FFg,24407
7
+ lamindb/_from_values.py,sha256=vbxTujbmmX6zSTBhOwrt6k-VGgA-QGAtjvYbzqEHNnw,8188
8
+ lamindb/_logger.py,sha256=d1jQdFL4gMKbzcc1dMOgKoEaUlWhyK-VsnxYLlG9caY,48
9
+ lamindb/_orm.py,sha256=1T-KpGJW8lVjsyzX7u3OTV1SsFqE0jDoSnPXK4kGO38,12216
10
+ lamindb/_save.py,sha256=gQvioV_ZEw_R6vcLJIiqRcr21vb_0ivJqzwCmj4bPFI,7495
11
+ lamindb/_select.py,sha256=lh1nPb0UUYYQCiHQeeZ6J8xfSufQYxYmmmdIKYZKZ4I,763
12
+ lamindb/_transform.py,sha256=EG87wlUffGI_-N92Qu-qklNRs4hTEeHpEtspYIVGKtc,911
13
+ lamindb/_view.py,sha256=TuWkdIFu8H__5PJK-L1m9CRySmyRPCgcAxZpue8Q154,1455
14
+ lamindb/types.py,sha256=svg5S_aynuGfbEOsbmqkR_gF9d9YMzfOkcvGN37Rzvg,232
15
+ lamindb/dev/__init__.py,sha256=HvTL5KH73egC4_zFmhxw_OA1Wyzx4phP7L1HvaR6xKw,268
16
+ lamindb/dev/_settings.py,sha256=1UXCQF1fwYQoqZ3FKb5v5-xaJbggrkgeddIVU5iMDhY,2526
17
+ lamindb/dev/hashing.py,sha256=ZPdGg7w-hyzJqQcxqHiVV5TF3x2CqNBZHrc5KVi4vFU,943
18
+ lamindb/dev/utils.py,sha256=LGdiW4k3GClLz65vKAVRkL6Tw-Gkx9DWAdez1jyA5bE,428
19
+ lamindb/dev/datasets/__init__.py,sha256=4HzUArEtxe_QXMCiqmSFXhurCU09iKRWfUL0wLXbWpQ,905
20
+ lamindb/dev/datasets/_core.py,sha256=kSki3AXiefI05XwmbR8eqlx1-5anTwKluWjDOXYpuXM,9792
21
+ lamindb/dev/datasets/_fake.py,sha256=S8mNho-oSh1M9x9oOSsUBLLHmBAegsOLlFk6LnF81EA,942
22
+ lamindb/dev/storage/__init__.py,sha256=ux4W0cpr5jRn5bLjawMqVK4GIwTgp7eKSf_lgdo3lBk,463
23
+ lamindb/dev/storage/_anndata_sizes.py,sha256=OOM9mJmhvho5JacsuMsHTXoWfvF0vjxRvg_Pi9VkAo4,730
24
+ lamindb/dev/storage/_backed_access.py,sha256=kTUKeC7QNSC_sJi2ZHwMV5FJFe4aH-P7oJAcR4NN-HY,15505
25
+ lamindb/dev/storage/_zarr.py,sha256=7W1Jos1QOOF3f41uML_arQoDTNPZVpRyP2m3SLWaCAo,2766
26
+ lamindb/dev/storage/file.py,sha256=RzKvbyiqSwvYbbLNs5C4zsXXnQP8L24PSyCEDWmacn0,5911
27
+ lamindb/dev/storage/object.py,sha256=x8sy23WqkGir2sg2c3AngQPgv0RbErEA6cpvVN0Zc4I,945
28
+ lamindb/schema/__init__.py,sha256=PznznlFvbeNSZKpn1RS6Gv0JMXFkLmU2_ej_1hVLSTs,796
29
+ lamindb/schema/_core.py,sha256=nWR3X_rNd1AbWw3naMiBi8ppAEpqIDyEYqM54feRB_s,766
30
+ lamindb/setup/__init__.py,sha256=8-0F2C4Glx23-b8-D_1CBGgRBM5PppVhazhoXZYOLsg,275
31
+ lamindb/setup/dev/__init__.py,sha256=iD0f2lx_Hgp-udkiPGal7si5waJSOgvnG6Id-g1mMOY,213
32
+ lamindb-0.46a1.dist-info/entry_points.txt,sha256=MioM8vSpKwXxY3geNBwjo1wnwy1l15WjJYlI3lpKuZI,53
33
+ lamindb-0.46a1.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
34
+ lamindb-0.46a1.dist-info/WHEEL,sha256=EZbGkh7Ie4PoZfRQ8I0ZuP9VklN_TvcZ6DSE5Uar4z4,81
35
+ lamindb-0.46a1.dist-info/METADATA,sha256=i9kIaqmFJPiFBuHX9QI2_z-Se6FYtoqSZdC_-9LF0TE,11035
36
+ lamindb-0.46a1.dist-info/RECORD,,