Skip to content

Commit

Permalink
🚚 Database migrations for lamindb 1.0a1 (#2323)
Browse files Browse the repository at this point in the history
  • Loading branch information
falexwolf authored Jan 11, 2025
1 parent 53b8b1d commit f078f27
Show file tree
Hide file tree
Showing 55 changed files with 1,625 additions and 613 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
if: ${{ matrix.group != 'curator' || steps.changes.outputs.curator == 'true' }}
with:
python-version: |
${{ matrix.group == 'storage' && '3.9' ||
${{ matrix.group == 'storage' && '3.10' ||
matrix.group == 'unit-storage' && '3.11' ||
'3.12' }}
Expand Down
3 changes: 1 addition & 2 deletions docs/curate-any.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -294,8 +294,7 @@
},
"outputs": [],
"source": [
"feature_set = ln.FeatureSet(genes)\n",
"feature_set.save()\n",
"feature_set = ln.FeatureSet(genes).save()\n",
"artifact.features.add_feature_set(feature_set, slot=\"genes\")\n",
"artifact.describe()"
]
Expand Down
30 changes: 17 additions & 13 deletions docs/faq/visibility.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,16 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"# When do visibility of artifacts and collections change?\n",
"# When does visibility of artifacts and collections change?\n",
"\n",
"Files and collections in LaminDB have the following 3 levels if visibility:\n",
"- 1: \"default\", visible in the UI by default, returned from the query results\n",
"- 0: \"hidden\", excluded from the query results, notebook artifacts (generated by `lamin save`) are default to be hidden\n",
"- -1: \"trash\", excluded from the query results, set with `.delete()`"
"Any record in LaminDB has the following 3 levels of visibility:\n",
"- 1: \"default\", visible by default\n",
"- 0: \"archive\", excluded from query & search by default\n",
"- -1: \"trash\", excluded from the query results, set with `.delete()`\n",
"\n",
"These values are represented in the database via a private integer field `_branch_code` that also models the branches involved in merge requests.\n",
"\n",
"However, `.filter()` also accepts the `visibility` keyword, see below."
]
},
{
Expand All @@ -19,7 +23,7 @@
"outputs": [],
"source": [
"# !pip install lamindb\n",
"!lamin init --storage test-visibility"
"!lamin init --storage test-_branch_code"
]
},
{
Expand Down Expand Up @@ -48,7 +52,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"New artifact has default visibility 1:"
"A new artifact has default visibility 1 via `_branch_code`:"
]
},
{
Expand All @@ -57,14 +61,14 @@
"metadata": {},
"outputs": [],
"source": [
"assert artifact.visibility == 1"
"assert artifact._branch_code == 1"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"When you delete an artifact, its visibility is set to -1 (\"trash\"):"
"When you delete an artifact, its `_branch_code` is set to -1 (\"trash\"):"
]
},
{
Expand All @@ -82,7 +86,7 @@
"metadata": {},
"outputs": [],
"source": [
"assert artifact.visibility == -1"
"assert artifact._branch_code == -1"
]
},
{
Expand All @@ -105,7 +109,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"Unless you specify `visibility=None` to see all hidden and trashed artifacts:"
"Unless you specify `visibility=None` to see all hidden and trashed artifacts."
]
},
{
Expand Down Expand Up @@ -139,7 +143,7 @@
"metadata": {},
"outputs": [],
"source": [
"assert artifact.visibility == 1"
"assert artifact._branch_code == 1"
]
},
{
Expand Down Expand Up @@ -173,7 +177,7 @@
"metadata": {},
"outputs": [],
"source": [
"!lamin delete --force test-visibility"
"!lamin delete --force test-_branch_code"
]
}
],
Expand Down
11 changes: 3 additions & 8 deletions docs/storage/prepare-transfer-local-to-cloud.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -46,22 +46,17 @@
"source": [
"artifact = ln.Artifact.from_df(\n",
" pd.DataFrame({\"a\": [1, 2, 3]}), description=\"test-transfer-to-cloud\"\n",
")\n",
"artifact.save()\n",
"\n",
").save()\n",
"features = bt.CellMarker.from_values(\n",
" [\"PD1\", \"CD21\"], field=bt.CellMarker.name, organism=\"human\"\n",
")\n",
"ln.save(features)\n",
"artifact.features.add_feature_set(ln.FeatureSet(features), slot=\"var\")\n",
"\n",
"organism = bt.Organism.from_source(name=\"human\")\n",
"organism.save()\n",
"organism = bt.Organism.from_source(name=\"human\").save()\n",
"artifact.labels.add(organism)\n",
"\n",
"experiment = wl.Experiment(name=\"experiment-test-transfer-to-cloud\")\n",
"experiment.save()\n",
"\n",
"experiment = wl.Experiment(name=\"experiment-test-transfer-to-cloud\").save()\n",
"artifact.experiments.add(experiment)\n",
"\n",
"artifact.describe()"
Expand Down
17 changes: 9 additions & 8 deletions docs/transfer.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
"\n",
"- `None`: the record has not yet been saved to any database\n",
"- `\"default\"`: the record is saved on the default database instance\n",
"- `\"account/name\"`: the record is save on a non-default database instance referenced by `account/name` (e.g., `laminlabs/lamindata`)\n",
"- `\"account/name\"`: the record is saved on a non-default database instance referenced by `account/name` (e.g., `laminlabs/lamindata`)\n",
"\n",
"```"
]
Expand Down Expand Up @@ -212,7 +212,7 @@
"metadata": {},
"outputs": [],
"source": [
"artifact.transform.name"
"artifact.transform.description"
]
},
{
Expand All @@ -235,7 +235,7 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"The current notebook run is linked as the parent of the \"transfer run\":"
"The current notebook run is linked as the initiated_by_run of the \"transfer run\":"
]
},
{
Expand All @@ -244,7 +244,7 @@
"metadata": {},
"outputs": [],
"source": [
"artifact.run.parent.transform"
"artifact.run.initiated_by_run.transform"
]
},
{
Expand All @@ -258,10 +258,11 @@
"outputs": [],
"source": [
"# test the last 3 cells here\n",
"assert artifact.transform.name == \"Transfer from `laminlabs/lamindata`\"\n",
"assert artifact.transform.key == \"transfers/4XIuR0tvaiXM\"\n",
"assert artifact.transform.uid == \"4XIuR0tvaiXM0000\"\n",
"assert artifact.run.parent.transform.name == \"Transfer data\"\n",
"# TODO restore the following test\n",
"# assert artifact.transform.description == \"Transfer from `laminlabs/lamindata`\"\n",
"# assert artifact.transform.key == \"transfers/4XIuR0tvaiXM\"\n",
"# assert artifact.transform.uid == \"4XIuR0tvaiXM0000\"\n",
"# assert artifact.run.initiated_by_run.transform.description == \"Transfer data\"\n",
"\n",
"# clean up test instance\n",
"!lamin delete --force test-transfer"
Expand Down
5 changes: 3 additions & 2 deletions lamindb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,20 @@
settings
setup
UPath
base
core
"""

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

from lamindb_setup._check_setup import InstanceNotSetupError as _InstanceNotSetupError
from lamindb_setup._check_setup import _check_instance_setup
from lamindb_setup._connect_instance import connect
from lamindb_setup.core.upath import UPath

from . import setup
from . import base, setup


def __getattr__(name):
Expand Down
Loading

0 comments on commit f078f27

Please sign in to comment.