Can I disable tracking run inputs?

Yes, if you switch track_run_inputs to False.

# !pip install 'lamindb[jupyter]'
!lamin init --storage test-run-inputs
Hide code cell output
 initialized lamindb: testuser1/test-run-inputs
import lamindb as ln
 connected lamindb: testuser1/test-run-inputs

Some test artifacts:

ln.context.track(transform=ln.Transform(key="Dummpy pipeline"))
ln.Artifact(ln.core.datasets.file_jpg_paradisi05(), description="My image").save()
ln.Artifact(ln.core.datasets.file_mini_csv(), description="My csv").save()
/tmp/ipykernel_4337/1610319432.py:1: FutureWarning: Use ln.track() instead of track, track will be removed in the future.
  ln.context.track(transform=ln.Transform(key="Dummpy pipeline"))
 created Transform('qf1rYZOPdxZx0000'), started new Run('dZFPmBrP...') at 2025-05-08 07:35:36 UTC
 recommendation: to identify the script across renames, pass the uid: ln.track("qf1rYZOPdxZx")
Artifact(uid='D6h2t6ROx7NmQ2HS0000', is_latest=True, description='My csv', suffix='.csv', size=11, hash='z1LdF2qN4cN0M2sXrcW8aw', space_id=1, storage_id=1, run_id=1, created_by_id=1, created_at=2025-05-08 07:35:37 UTC)

Call ln.track():

ln.track("Rx2s9aPTMQLY0000")

Don’t track artifact as run input

ln.settings.track_run_inputs = False
artifact = ln.Artifact.get(description="My image")
artifact.cache()
PosixUPath('/home/runner/work/lamindb/lamindb/docs/faq/test-run-inputs/.lamindb/MkBA1hyh1PPvl6Lm0000.jpg')

No run inputs are linked to the current notebook run:

ln.Run.get(id=ln.context.run.id).input_artifacts.all()
<ArtifactBasicQuerySet []>
artifact.view_lineage()
../_images/56f0a0454eadbc31eaabcae5d679afd3188c30fbbc20d6e26215e053f93b7b55.svg
Hide code cell content
assert len(ln.Run.get(id=ln.context.run.id).input_artifacts.all()) == 0

Manually track artifact as run input

Let us manually track an artifact by passing is_run_input to either .cache(), .load() or .open():

artifact.cache(is_run_input=True)
PosixUPath('/home/runner/work/lamindb/lamindb/docs/faq/test-run-inputs/.lamindb/MkBA1hyh1PPvl6Lm0000.jpg')

You can see the fcs artifact is now being added to the run inputs:

for input in ln.Run.get(id=ln.context.run.id).input_artifacts.all():
    print(input)
artifact.view_lineage()
../_images/e5d3ec85d537b2d578ed8a2ca8f08ad5416ccaae012dd27dbe4685e92d45d721.svg
Hide code cell content
assert len(ln.Run.get(id=ln.context.run.id).input_artifacts.all()) == 1

Automatically track artifacts as run input

If you switch the following setting, and call to .load(), .cache() and .open() will track the artifact as run input.

ln.settings.track_run_inputs = True
artifact = ln.Artifact.get(description="My csv")
artifact.load()
test
0 1
1 2
2 3
for input in ln.Run.get(id=ln.context.run.id).input_artifacts.all():
    print(input)
artifact.view_lineage()
../_images/3e04d0a0bd1ff737656027f45e266edcaf7e011ef49b24807991e9dedc60cc9b.svg
Hide code cell content
assert len(ln.Run.get(id=ln.context.run.id).input_artifacts.all()) == 2
Hide code cell content
!lamin delete --force test-run-inputs