lamindb 0.77.2__py3-none-any.whl → 1.0rc1__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.
Files changed (89) hide show
  1. lamindb/__init__.py +39 -32
  2. lamindb/_artifact.py +95 -64
  3. lamindb/_can_curate.py +19 -10
  4. lamindb/_collection.py +51 -49
  5. lamindb/_feature.py +9 -9
  6. lamindb/_finish.py +99 -86
  7. lamindb/_from_values.py +20 -17
  8. lamindb/_is_versioned.py +2 -1
  9. lamindb/_parents.py +23 -16
  10. lamindb/_query_manager.py +3 -3
  11. lamindb/_query_set.py +85 -18
  12. lamindb/_record.py +121 -46
  13. lamindb/_run.py +3 -3
  14. lamindb/_save.py +14 -8
  15. lamindb/{_feature_set.py → _schema.py} +34 -31
  16. lamindb/_storage.py +2 -1
  17. lamindb/_transform.py +51 -23
  18. lamindb/_ulabel.py +17 -8
  19. lamindb/_view.py +15 -14
  20. lamindb/base/__init__.py +24 -0
  21. lamindb/base/fields.py +281 -0
  22. lamindb/base/ids.py +103 -0
  23. lamindb/base/types.py +51 -0
  24. lamindb/base/users.py +30 -0
  25. lamindb/base/validation.py +67 -0
  26. lamindb/core/__init__.py +19 -14
  27. lamindb/core/_context.py +297 -228
  28. lamindb/core/_data.py +44 -49
  29. lamindb/core/_describe.py +41 -31
  30. lamindb/core/_django.py +59 -44
  31. lamindb/core/_feature_manager.py +192 -168
  32. lamindb/core/_label_manager.py +22 -22
  33. lamindb/core/_mapped_collection.py +17 -14
  34. lamindb/core/_settings.py +1 -12
  35. lamindb/core/_sync_git.py +56 -9
  36. lamindb/core/_track_environment.py +1 -1
  37. lamindb/core/datasets/_core.py +5 -6
  38. lamindb/core/exceptions.py +0 -7
  39. lamindb/core/fields.py +1 -1
  40. lamindb/core/loaders.py +18 -2
  41. lamindb/core/{schema.py → relations.py} +22 -19
  42. lamindb/core/storage/_anndata_accessor.py +1 -2
  43. lamindb/core/storage/_backed_access.py +2 -1
  44. lamindb/core/storage/_tiledbsoma.py +40 -13
  45. lamindb/core/storage/objects.py +1 -1
  46. lamindb/core/storage/paths.py +13 -8
  47. lamindb/core/subsettings/__init__.py +0 -2
  48. lamindb/core/types.py +2 -23
  49. lamindb/core/versioning.py +11 -7
  50. lamindb/{_curate.py → curators/__init__.py} +700 -57
  51. lamindb/curators/_spatial.py +528 -0
  52. lamindb/integrations/_vitessce.py +1 -3
  53. lamindb/migrations/0052_squashed.py +1261 -0
  54. lamindb/migrations/0053_alter_featureset_hash_alter_paramvalue_created_by_and_more.py +57 -0
  55. lamindb/migrations/0054_alter_feature_previous_runs_and_more.py +35 -0
  56. lamindb/migrations/0055_artifact_type_artifactparamvalue_and_more.py +61 -0
  57. lamindb/migrations/0056_rename_ulabel_ref_is_name_artifactulabel_label_ref_is_name_and_more.py +22 -0
  58. lamindb/migrations/0057_link_models_latest_report_and_others.py +356 -0
  59. lamindb/migrations/0058_artifact__actions_collection__actions.py +22 -0
  60. lamindb/migrations/0059_alter_artifact__accessor_alter_artifact__hash_type_and_more.py +31 -0
  61. lamindb/migrations/0060_alter_artifact__actions.py +22 -0
  62. lamindb/migrations/0061_alter_collection_meta_artifact_alter_run_environment_and_more.py +45 -0
  63. lamindb/migrations/0062_add_is_latest_field.py +32 -0
  64. lamindb/migrations/0063_populate_latest_field.py +45 -0
  65. lamindb/migrations/0064_alter_artifact_version_alter_collection_version_and_more.py +33 -0
  66. lamindb/migrations/0065_remove_collection_feature_sets_and_more.py +22 -0
  67. lamindb/migrations/0066_alter_artifact__feature_values_and_more.py +352 -0
  68. lamindb/migrations/0067_alter_featurevalue_unique_together_and_more.py +20 -0
  69. lamindb/migrations/0068_alter_artifactulabel_unique_together_and_more.py +20 -0
  70. lamindb/migrations/0069_alter_artifact__accessor_alter_artifact__hash_type_and_more.py +1294 -0
  71. lamindb/migrations/0069_squashed.py +1770 -0
  72. lamindb/migrations/0070_lamindbv1_migrate_data.py +78 -0
  73. lamindb/migrations/0071_lamindbv1_migrate_schema.py +741 -0
  74. lamindb/migrations/0072_remove_user__branch_code_remove_user_aux_and_more.py +148 -0
  75. lamindb/migrations/0073_merge_ourprojects.py +945 -0
  76. lamindb/migrations/0074_lamindbv1_part4.py +374 -0
  77. lamindb/migrations/0075_lamindbv1_part5.py +276 -0
  78. lamindb/migrations/0076_lamindbv1_part6.py +621 -0
  79. lamindb/migrations/0077_lamindbv1_part6b.py +228 -0
  80. lamindb/migrations/0078_lamindbv1_part6c.py +468 -0
  81. lamindb/migrations/0079_alter_rundata_value_json_and_more.py +36 -0
  82. lamindb/migrations/__init__.py +0 -0
  83. lamindb/models.py +4064 -0
  84. {lamindb-0.77.2.dist-info → lamindb-1.0rc1.dist-info}/METADATA +15 -20
  85. lamindb-1.0rc1.dist-info/RECORD +100 -0
  86. {lamindb-0.77.2.dist-info → lamindb-1.0rc1.dist-info}/WHEEL +1 -1
  87. lamindb/core/subsettings/_transform_settings.py +0 -21
  88. lamindb-0.77.2.dist-info/RECORD +0 -63
  89. {lamindb-0.77.2.dist-info → lamindb-1.0rc1.dist-info}/LICENSE +0 -0
@@ -3,20 +3,16 @@ from __future__ import annotations
3
3
  import shutil
4
4
  from typing import TYPE_CHECKING
5
5
 
6
- import anndata as ad
7
6
  import fsspec
8
- import pandas as pd
9
7
  from lamin_utils import logger
10
8
  from lamindb_setup.core import StorageSettings
11
9
  from lamindb_setup.core.upath import (
12
10
  LocalPathClasses,
13
11
  UPath,
14
- create_path,
15
- infer_filesystem,
16
12
  )
17
- from lnschema_core.models import Artifact, Storage
18
13
 
19
14
  from lamindb.core._settings import settings
15
+ from lamindb.models import Artifact, Storage
20
16
 
21
17
  if TYPE_CHECKING:
22
18
  from pathlib import Path
@@ -30,7 +26,7 @@ AUTO_KEY_PREFIX = ".lamindb/"
30
26
  # add type annotations back asap when re-organizing the module
31
27
  def auto_storage_key_from_artifact(artifact: Artifact):
32
28
  if artifact.key is None or artifact._key_is_virtual:
33
- is_dir = artifact.n_objects is not None
29
+ is_dir = artifact.n_files is not None
34
30
  return auto_storage_key_from_artifact_uid(artifact.uid, artifact.suffix, is_dir)
35
31
  else:
36
32
  return artifact.key
@@ -52,10 +48,19 @@ def check_path_is_child_of_root(path: UPathStr, root: UPathStr) -> bool:
52
48
  # and for fsspec.utils.get_protocol
53
49
  path_str = str(path)
54
50
  root_str = str(root)
51
+ root_protocol = fsspec.utils.get_protocol(root_str)
55
52
  # check that the protocols are the same first
56
- if fsspec.utils.get_protocol(path_str) != fsspec.utils.get_protocol(root_str):
53
+ if fsspec.utils.get_protocol(path_str) != root_protocol:
57
54
  return False
58
- return UPath(root_str).resolve() in UPath(path_str).resolve().parents
55
+ if root_protocol in {"http", "https"}:
56
+ # in this case it is a base url, not a file
57
+ # so formally does not exist
58
+ resolve_kwargs = {"follow_redirects": False}
59
+ else:
60
+ resolve_kwargs = {}
61
+ return (
62
+ UPath(root_str).resolve(**resolve_kwargs) in UPath(path_str).resolve().parents
63
+ )
59
64
 
60
65
 
61
66
  # returns filepath and root of the storage
@@ -3,10 +3,8 @@
3
3
  .. autosummary::
4
4
  :toctree: .
5
5
 
6
- TransformSettings
7
6
  CreationSettings
8
7
 
9
8
  """
10
9
 
11
10
  from ._creation_settings import CreationSettings
12
- from ._transform_settings import TransformSettings
lamindb/core/types.py CHANGED
@@ -1,27 +1,6 @@
1
- """Types.
2
-
3
- Central object types.
4
-
5
- .. autosummary::
6
- :toctree: .
7
-
8
- ArtifactType
9
- TransformType
10
- FeatureDtype
11
-
12
- Basic types.
13
-
14
- .. autosummary::
15
- :toctree: .
16
-
17
- UPathStr
18
- StrField
19
- ListLike
20
- """
21
-
22
1
  from lamindb_setup.core.types import UPathStr
23
- from lnschema_core.types import (
24
- ArtifactType,
2
+
3
+ from lamindb.base.types import (
25
4
  FeatureDtype,
26
5
  FieldAttr,
27
6
  ListLike,
@@ -5,10 +5,11 @@ from typing import TYPE_CHECKING, Literal
5
5
  from lamin_utils import logger
6
6
  from lamin_utils._base62 import increment_base62
7
7
  from lamindb_setup.core.upath import LocalPathClasses, UPath
8
- from lnschema_core import ids
8
+
9
+ from lamindb.base import ids
9
10
 
10
11
  if TYPE_CHECKING:
11
- from lnschema_core.models import IsVersioned
12
+ from lamindb.models import IsVersioned
12
13
 
13
14
 
14
15
  def message_update_key_in_version_family(
@@ -132,15 +133,18 @@ def get_new_path_from_uid(old_path: UPath, old_uid: str, new_uid: str):
132
133
  def process_revises(
133
134
  revises: IsVersioned | None,
134
135
  version: str | None,
135
- name: str | None,
136
+ key: str | None,
137
+ description: str | None,
136
138
  type: type[IsVersioned],
137
- ) -> tuple[str, str, str, IsVersioned | None]:
139
+ ) -> tuple[str, str, str, str, IsVersioned | None]:
138
140
  if revises is not None and not isinstance(revises, type):
139
141
  raise TypeError(f"`revises` has to be of type `{type.__name__}`")
140
142
  uid, revises = create_uid(
141
143
  revises=revises, version=version, n_full_id=type._len_full_uid
142
144
  )
143
145
  if revises is not None:
144
- if name is None:
145
- name = revises.name
146
- return uid, version, name, revises
146
+ if description is None:
147
+ description = revises.description
148
+ if key is None:
149
+ key = revises.key
150
+ return uid, version, key, description, revises