A little wrapper around `uv` to launch ephemeral Jupyter notebooks.
Project description
juv
A little wrapper around uv
to launch ephemeral Jupyter notebooks.
uvx juv
# A wrapper around uv to launch ephemeral Jupyter notebooks.
#
# Usage: juv [uvx flags] <COMMAND>[@version] [PATH]
#
# Commands:
# init: Initialize a new notebook
# add: Add dependencies to the notebook
# lab: Launch notebook/script in Jupyter Lab
# notebook: Launch notebook/script in Jupyter Notebook
# nbclassic: Launch notebook/script in Jupyter Notebook Classic
#
# Examples:
# juv init foo.ipynb
# juv add foo.ipynb numpy pandas
# juv lab foo.ipynb
# juv nbclassic script.py
# juv --python=3.8 notebook@6.4.0 foo.ipynb
Scripts will be converted to notebooks before launching the Jupyter session.
uvx juv lab script.py # creates script.ipynb
Any flags that are passed prior to the command (e.g., uvx juv --with=polars lab
) will be forwarded to uvx
as-is. This allows you to specify additional
dependencies, a different interpreter, etc.
what
PEP 723 (inline script metadata) allows
specifying dependencies as comments within Python scripts, enabling
self-contained, reproducible execution. This feature could significantly
improve reproducibility in the data science ecosystem, since many analyses are
shared as standalone code (not packages). However, a lot of data science code
lives in notebooks (.ipynb
files), not Python scripts (.py
files).
juv
bridges this gap by:
- Extending PEP 723-style metadata support from
uv
to Jupyter notebooks - Launching Jupyter sessions with the specified dependencies
It's a simple Python script that parses the notebook and starts a Jupyter
session with the specified dependencies (piggybacking on uv
's existing
functionality).
alternatives
juv
is opinionated and might not suit your preferences. That's ok! uv
is
super extensible, and I recommend reading the wonderful
documentation to learn about its primitives.
For example, you can achieve a similar workflow using the --with-requirements
flag:
uvx --with-requirements=requirements.txt --from=jupyter-core --with=jupyterlab jupyter lab notebook.ipynb
While slightly more verbose and breaking self-containment, this approach totally works and saves you from installing another dependency.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file juv-0.1.3.tar.gz
.
File metadata
- Download URL: juv-0.1.3.tar.gz
- Upload date:
- Size: 28.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | af7b11fef84000edc6df165ffc9115db516e6ceda76c389682732f5d6cd7ea11 |
|
MD5 | c4d011dd41d5c1a0bb8ceadf68f03347 |
|
BLAKE2b-256 | 06cbaade44ae30bb55fa3c716047e11268633c4e15dc21ab29ef7e0e33d8846b |
File details
Details for the file juv-0.1.3-py3-none-any.whl
.
File metadata
- Download URL: juv-0.1.3-py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.1.1 CPython/3.12.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | cfc6b7b05b76af2e261410d6a9c1d653ca00a3c25dc199892e1dbd9fb09da52c |
|
MD5 | c7eeeae1222c3d7de39da2022c946d66 |
|
BLAKE2b-256 | cc41aea11005ea20df86b7a5afdf08b0a36abe20e299c451d7e9e3f74d47168f |