Skip to content

Conversation

@ap--
Copy link

@ap-- ap-- commented Feb 21, 2025

Hey Lamins,

I sometimes find myself making a quick change in the python interpreter and I'd like to keep track of this somehow.
To check how complicated an implementation could be, I made a quick proof of concept for tracking interactive shell usage.

Ideally this would probably build on ipython to be a bit more feature rich, but I think this can be implemented in an afternoon.

This proof-of-concept PR adds lamin repl as a cli command:

lamin repl user/instance
Lamin CLI Python 3.12.8 (main, Dec  3 2024, 18:42:41) [Clang 16.0.0 (clang-1600.0.26.4)] on darwin
This session is tracked on your lamin instance.
>>> import lamindb as ln
>>> ln.connect("user/instance")
>>> ln.track()
→ updated transform description, loaded Transform('GqB9xtcBHmqv0000'), started new Run('02uXPwNj...') at 2025-02-21 12:21:58 UTC
>>> import pandas as pd
>>> ln.Artifact.from_df(pd.DataFrame({"A":[1,2,3]}), description="repl").save()
... uploading hu6ApyOvSuw12YWg0000.parquet: 100.0%
Artifact(uid='hu6ApyOvSuw12YWg0000', is_latest=True, description='repl', suffix='.parquet', kind='dataset', otype='DataFrame', size=1571, hash='ZaO9nevOHyNYuWxs9jjerg', space_id=1, storage_id=2, run_id=42, created_by_id=4, created_at=2025-02-21 12:22:55 UTC)
>>> exit()
→ go to: https://lamin.ai/user/instance/transform/GqB9xtcBHmqv0000

Which let's you store the interactive shell commands in the instance

lamin load https://lamin.ai/user/instance/transform/GqB9xtcBHmqv0000
→ script is here: interactive-7eaaf87d-0fd2-4087-8b4e-a4a0dc0dd106cat interactive-7eaaf87d-0fd2-4087-8b4e-a4a0dc0dd106 
import lamindb as ln
ln.connect("user/instance")
ln.track("GqB9xtcBHmqv0000")
import pandas as pd
ln.Artifact.from_df(pd.DataFrame({"A":[1,2,3]}), description="repl").save()

Cheers,
Andreas

A proof of concept for tracking interactive shell usage
@falexwolf
Copy link
Member

falexwolf commented Feb 21, 2025

This is very cool! 😄 Thank you!! ❤️

It's going to be the third type of run context complementing ln.track() in script/notebook and ln.tracked() for a function. 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants