Skip to main content

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

juv has five main commands:

  • juv init initializes a new notebook
  • juv add adds dependencies to an existing notebook
  • juv lab launches a Jupyter Lab session
  • juv notebook launches a classic notebook session
  • juv nbclassic launches a classic notebook session

A script will be converted to a notebook before launching.

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

juv-0.1.2.tar.gz (35.7 kB view details)

Uploaded Source

Built Distribution

juv-0.1.2-py3-none-any.whl (6.2 kB view details)

Uploaded Python 3

File details

Details for the file juv-0.1.2.tar.gz.

File metadata

  • Download URL: juv-0.1.2.tar.gz
  • Upload date:
  • Size: 35.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for juv-0.1.2.tar.gz
Algorithm Hash digest
SHA256 64307b2e75866232b6ebff86cc371cfc0eaf8477705377a34a05b585b797b530
MD5 6752f63173e332ff028a3826201d0c24
BLAKE2b-256 a0440f9eb61a4bb49031569083da912172da9aa421961b5c6a83e60cef8afa26

See more details on using hashes here.

File details

Details for the file juv-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: juv-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 6.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for juv-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b565119ae3d47e72e03b9e3c92155cee1e3fe21142d67164d828587fac72a209
MD5 0196f605940ef26dc61e806db3f480d4
BLAKE2b-256 0e87b134d889cbacc8a96ab7a907d6ada2ef472b9968d51c0ae2dbef77d375e3

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page