Show HN:Juvio – Jupyter 的 UV 内核
Show HN: Juvio – UV Kernel for Jupyter

原始链接: https://github.com/OKUA1/juvio

Juvio 简化了笔记本的依赖管理,允许使用 `%juvio install` 命令直接在笔记本中安装包。依赖项被保存为元数据(PEP 723 风格),使用 uv 打开时能够自动设置正确的包版本,确保可复现性,无需单独的 requirements 文件。 Juvio 使用类似 Jupytext 的 `# %%` 标记的脚本风格格式,方便进行 Git 差异比较和版本控制。 开始使用:安装 Juvio 和 uv,启用 JupyterLab 扩展,创建一个 Juvio 笔记本,安装必要的包,然后运行代码。Juvio 简化了工作流程,保证了可复现性,并改进了 Git 集成。

Juvio是一个新的Jupyter内核,简化了笔记本的依赖项管理。它利用PEP 723将项目需求直接存储在笔记本中,无需单独的requirements文件。打开笔记本时,Juvio会使用UV自动创建一个临时的环境,其中包含指定的依赖项,从而确保可重复性。这允许用户轻松共享笔记本,而不会出现依赖冲突。一些用户表达了对维护锁文件的担忧。另一些用户将其与`marimo.io`和`juv`等现有解决方案进行了比较,强调了其独特的特性:在同一个JupyterLab会话中为每个笔记本创建单独的虚拟环境。虽然Juvio不支持`pyproject.toml`或JupyterLite,但它旨在解决轻松共享具有已定义依赖项的笔记本的常见问题。

原文
  • 💡 Inline Dependency Management

    Install packages right from the notebook:

    %juvio install numpy pandas

    Dependencies are saved directly in the notebook as metadata (PEP 723-style), like:

    # /// script
    # requires-python = "==3.10.17"
    # dependencies = [
    # "numpy==2.2.5",
    # "pandas==2.2.3"
    # ]
    # ///
  • ⚙️ Automatic Environment Setup

    When the notebook is opened, Juvio installs the dependencies automatically in an ephemeral virtual environment (using uv), ensuring that the notebook runs with the correct versions of the packages and Python.

  • 📁 Git-Friendly Format

    Notebooks are converted on the fly to a script-style format using # %% markers, making diffs and version control painless:

    # %%
    %juvio install numpy
    # %%
    import numpy as np
    # %%
    arr = np.array([1, 2, 3])
    print(arr)
    # %%

1. Install Juvio:

pip install juvio
jupyter labextension enable juvio-frontend

2. Make sure you have uv installed:

https://docs.astral.sh/uv/getting-started/installation/

3. Start JupyterLab and create a Juvio Notebook.

4. Install necessary packages in the notebook and run your code

Dependencies are tracked, environments are reproducible, and your notebook stays Git-clean ✨

  • No additional lock or requirements files are needed
  • Guaranteed reproducibility
  • Cleaner Git diffs
  • uv – ultra-fast Python package management
  • PEP 723 – Python inline dependency standards
  • jupytext-like format for easy version control
联系我们 contact @ memedata.com