Open manzt opened 1 week ago
I saw this project and had the exact same thought!
In fact I don‘t think we’d need dependency specification in a code cell at all: jupyter has a perfect place for notebook-wide structured metadata already.
Should be able to benefit from:
When it lands to save the export to the notebook metadata.
In fact I don‘t think we’d need dependency specification in a code cell at all: jupyter has a perfect place for notebook-wide structured metadata already.
Yeah, I'm a bit torn on this. Keeping in a notebook cell as a comment aligns closer with scripts, but hiding means we could do more to control the behavior of adding/removing dependencies. We'd probably need better ways to show this metadata to users though in the notebook, if we choose to hide it. When/if we introduce locking, we could always write a new lock on any command (add
, run
, ...) and also offer something like juv sync
to sync the lock.
uv scripts now also support uv.tool.exclude-newer
metadata. Even without a lock file, this could go a long way for making one-off notebooks more reproducible to add a timestamp to the notebook meta that we could have a flag to run.
e.g.,
juv init Untitled.ipynb # writes a timestamp to the notebook metadata
juv add Untitled.ipynb notebook
# juv timestamp Untitled.ipynb # explicitly update
juv run Untitled.ipynb
juv run --exclude-newer=last-timestamp Untitled.ipyng
The purpose of putting it into the metadata isn’t supposed to hide it, but to allow us to
juv run
, we’ll be able to inject the plugin into that environment, making that not a problem
Ref: https://x.com/rahuldave/status/1848072186340196391
The idea would be to put a lockfile in the notebook metadata (either cell-level or top-level) and we could update the lock file on
run
/add
/lock
.Then we could add a flag to
--locked
to skip dependency resolution and just create the enviroment from the lockfile.