Prepare sync artifacts from a local instance to a cloud instance
¶
!lamin disconnect
# need to add pertdb to environment in order to import it
!lamin settings modules set bionty,pertdb
import lamindb as ln
import bionty as bt
import pertdb
import pandas as pd
ln.setup.init(storage="./test-sync-to-cloud", modules="bionty,pertdb")
! re-setting django: avoid this by clearing the default instance on the command line via: lamin disconnect
→ initialized lamindb: testuser1/test-sync-to-cloud
artifact = ln.Artifact.from_dataframe(
pd.DataFrame({"a": [1, 2, 3]}), description="test-sync-to-cloud"
).save()
features = bt.CellMarker.from_values(
["PD1", "CD21"], field=bt.CellMarker.name, organism="human"
).save()
artifact.features._add_schema(ln.Schema(features), slot="var")
organism = bt.Organism.from_source(name="human").save()
artifact.labels.add(organism)
compound = pertdb.Compound(name="compound-test-sync-to-cloud").save()
artifact.compounds.add(compound)
artifact.describe()
! no run & transform got linked, call `ln.track()` & re-run
Artifact: (0000) | description: test-sync-to-cloud ├── uid: z0mP1efG9nGB8KzX0000 run: │ kind: dataset otype: DataFrame │ hash: 7L2QcOI8XJdkWHCN_8OZNg size: 1.6 KB │ branch: main space: all │ created_at: 2026-06-22 07:41:41 UTC created_by: testuser1 │ n_observations: 3 ├── storage/path: │ /home/runner/work/lamindb/lamindb/docs/storage/test-sync-to-cloud/.lamindb/z0mP1efG9nGB8KzX0000.parquet ├── Dataset features │ └── var (2 bionty.CellMarker) │ CD21 num │ PD1 num └── Labels └── .organisms bionty.Organism human .compounds pertdb.Compound compound-test-sync-to-cloud
assert artifact.features.slots["var"].members.count() == 2