Skip to content

Commit

Permalink
🚚 Integrate ourprojects into lamindb (#2342)
Browse files Browse the repository at this point in the history
  • Loading branch information
falexwolf authored Jan 13, 2025
1 parent 431200a commit a987a1d
Show file tree
Hide file tree
Showing 14 changed files with 1,229 additions and 42 deletions.
3 changes: 0 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,3 @@
[submodule "sub/clinicore"]
path = sub/clinicore
url = https://github.com/laminlabs/clinicore
[submodule "sub/ourprojects"]
path = sub/ourprojects
url = https://github.com/laminlabs/ourprojects
1 change: 0 additions & 1 deletion docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ rest
:hidden:
bionty
ourprojects
wetlab
clinicore
cellregistry
Expand Down
12 changes: 5 additions & 7 deletions docs/faq/validate-fields.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
"source": [
"# Django field validation\n",
"\n",
"[Django field validation](https://docs.djangoproject.com/en/5.1/ref/validators/) are enabled for models that inherit the `ValidateFields` class.\n",
"\n",
"For instance: [`ourprojects.Reference`](https://docs.lamin.ai/ourprojects.reference)"
"[Django field validation](https://docs.djangoproject.com/en/5.1/ref/validators/) are enabled for models that inherit the `ValidateFields` class."
]
},
{
Expand All @@ -17,8 +15,8 @@
"metadata": {},
"outputs": [],
"source": [
"# !pip install lamindb[ourprojects]\n",
"!lamin init --storage ./test-django-validation --modules ourprojects"
"# pip install lamindb\n",
"!lamin init --storage ./test-django-validation"
]
},
{
Expand All @@ -27,7 +25,7 @@
"metadata": {},
"outputs": [],
"source": [
"import ourprojects as pj\n",
"import lamindb as ln\n",
"from lamindb.base.validation import FieldValidationError"
]
},
Expand All @@ -38,7 +36,7 @@
"outputs": [],
"source": [
"try:\n",
" pj.Reference(name=\"my ref\", doi=\"abc.ef\", url=\"myurl.com\")\n",
" ln.Reference(name=\"my ref\", doi=\"abc.ef\", url=\"myurl.com\")\n",
"except FieldValidationError as e:\n",
" print(e)"
]
Expand Down
5 changes: 0 additions & 5 deletions docs/ourprojects.md

This file was deleted.

2 changes: 1 addition & 1 deletion docs/storage/prepare-transfer-local-to-cloud.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"metadata": {},
"outputs": [],
"source": [
"ln.setup.init(storage=\"./test-transfer-to-cloud\", modules=\"bionty,wetlab,ourprojects\")\n",
"ln.setup.init(storage=\"./test-transfer-to-cloud\", modules=\"bionty,wetlab\")\n",
"ln.setup.settings.auto_connect = False"
]
},
Expand Down
24 changes: 18 additions & 6 deletions lamindb/__init__.py
Original file line number Diff line number Diff line change
@@ -1,28 +1,37 @@
"""A data framework for biology.
Core registries.
Tracking notebooks & scripts.
.. autosummary::
:toctree: .
track
finish
Registries.
.. autosummary::
:toctree: .
Artifact
Collection
Transform
ULabel
Run
User
Storage
ULabel
Feature
FeatureSet
Param
Collection
Project
Reference
Person
Key functionality.
.. autosummary::
:toctree: .
track
finish
connect
Curator
view
Expand All @@ -44,7 +53,7 @@
"""

# denote a release candidate for 0.1.0 with 0.1rc1, 0.1a1, 0.1b1, etc.
__version__ = "1.0a2"
__version__ = "1.0a3"

from lamindb_setup._check_setup import InstanceNotSetupError as _InstanceNotSetupError
from lamindb_setup._check_setup import _check_instance_setup
Expand Down Expand Up @@ -87,6 +96,9 @@ def __getattr__(name):
Feature,
FeatureSet,
Param,
Person,
Project,
Reference,
Run,
Storage,
Transform,
Expand Down
3 changes: 3 additions & 0 deletions lamindb/base/validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,12 @@ def validate_literal_fields(record: "Record", kwargs) -> None:
Raises:
ValidationError: If any field value is not in its Literal's allowed values
"""
# check is based on string to avoid circular imports
if record.__class__.__name__ == "Feature":
# the FeatureDtype is more complicated than a simple literal
# because it allows constructs like cat[ULabel] etc.
# the User model is used at startup and throws a datetime-related error otherwise
# simmilar for Storage & Source
return None
try:
type_hints = get_type_hints(record.__class__)
Expand Down
Loading

0 comments on commit a987a1d

Please sign in to comment.