Add juv venv
to support exporting explicit notebook enviroments
#80
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Alternative to #62
Some editors and enviroments are missing the benefits from
juv
standalone notebooks, simply because we don't make it easy to use the specified virutal enviroment outside of spawning a Jupyter runtime withjuv run
.While we typically try to hide virtual environments, they remain crucial for ecosystem like language servers, autocomplete, and intellisense, and exposing some way to quickly make a notebok enviroment is the easiest way to bring
juv
standalone notebooks to unknown tools.To improve compatibility with more editors and tools, this PR introduces:
This command creates a virtual environment with the dependencies and locking behavior expected from
juv
, and addsipykernel
for running the notebook. The resulting environment can be selected in an editor like VS Code.To create a venv with only the locked dependencies, add the
--no-kernel
flag:Alternatives
While editor-specific integrations for
juv
would be ideal (and still welcome!), they require significant effort. I anticipate there will be opportunities to piggyback on whatever editors do to support uv standalone scripts in the future.In the meantime, this approach provides a decent escape hatch. I think it's a reasonable tradeoff for individuals that want to use their favorite editor with notebook support and also read/write standalone notebooks.
Note
It's worth noting that these commands are basically sugar for composing some lesser known
juv
anduv
commands:or, when including
ipykernel
:However, I think having a simple high-level API is ideal. It also means one does not need to have
uv
installed (even though they should!)