Skip to main content

nb-nebi-kernels

A custom Jupyter KernelSpecManager that automatically discovers local and remote Nebi-tracked Pixi workspaces and exposes each environment as a Jupyter kernel.

How it works

  1. Discovers locally-tracked workspaces via nebi workspace list --json.
  2. Optionally discovers additional local workspaces from configured roots.
  3. Optionally discovers remote workspaces from the Nebi API using NEBI_REMOTE_URL and NEBI_AUTH_TOKEN.
  4. Enumerates environments per workspace (pixi info --json for local workspaces, remote pixi.toml parsing for remote-only workspaces).
  5. Classifies each kernel into a structured state (ready, outdated, remote-not-pulled, local-not-installed, local-missing-deps).
  6. Launches each installed kernelspec's own command via pixi run --frozen with environment isolation.

Installation

pip install nb-nebi-kernels

That's it — the kernel spec manager is automatically configured when installed into your JupyterLab environment.

Prerequisites

  • Nebi CLI on your PATH
  • Pixi on your PATH
  • At least one tracked nebi workspace (nebi init in a pixi project)
  • For remote discovery: NEBI_REMOTE_URL and NEBI_AUTH_TOKEN

Usage

Once installed, any nebi-tracked pixi workspace appears as a kernel in JupyterLab or Notebook:

  • A workspace data-science with environments default and gpu shows as two kernels: data-science (default) and data-science (gpu)
  • A workspace web-app with only the default environment shows as just web-app
  • A remote-only workspace can still appear as a kernel (state: remote-not-pulled) before it is pulled locally
  • Python, R, Julia, xeus, and other kernels work generically through their installed kernel.json.
  • If one pixi environment contains multiple kernelspecs, the primary keeps the existing kernel name and additional kernels get deterministic suffixes.

If discovery returns no workspaces, Jupyter falls back to its default kernels. If workspaces are discovered but local tools/dependencies are missing, kernels are surfaced as non-ready instead of crashing.

Configuration

Optional behavior can be configured through environment variables and traitlets.

Environment variables

  • NEBI_REMOTE_URL: Base Nebi server URL used for remote workspace discovery.
  • NEBI_AUTH_TOKEN: Bearer token used for Nebi API requests.
  • NEBI_WORKSPACE_DISCOVERY_PATHS: Extra local workspace roots, separated by the OS path separator (: on Linux/macOS, ; on Windows).

Traitlets

# Example in jupyter_server_config.py
c.NebiKernelSpecManager.workspace_discovery_roots = ["/mnt/shared/nebi-workspaces"]
c.NebiKernelSpecManager.required_launch_dependencies = ["optional-extra-package"]
  • workspace_discovery_roots adds local discovery roots (in addition to nebi workspace list results).
  • required_launch_dependencies optionally adds package checks beyond the installed Jupyter kernelspec. Default: [].

Kernel states and metadata

Each generated kernelspec includes state metadata for UI consumers.

nebi_state Meaning Launch
ready Local workspace/env is installed and dependencies are satisfied. Allowed
outdated Local and remote versions differ. Allowed
remote-not-pulled Workspace exists remotely but has no local path yet. Blocked
local-not-installed Local environment is not installed/materialized. Blocked
local-missing-deps Local environment is missing required dependencies or a Jupyter kernelspec. Blocked

Important metadata fields:

  • nebi_state, nebi_not_ready_reason, nebi_missing_dependencies
  • nebi_local_version, nebi_remote_version, nebi_outdated
  • nebi_discovery_hash, nebi_discovered_at

Stable nebi_not_ready_reason values include:

  • workspace-not-pulled
  • missing-dependencies
  • kernel-not-installed
  • local-version-behind-remote
  • environment-not-installed
  • workspace-missing
  • manifest-missing
  • pixi-missing
  • pixi-timeout
  • pixi-list-failed
  • pixi-json-parse-failed

Development

# Install dev dependencies
pixi install -e dev

# Run tests
pixi run test

# Run tests with coverage
pixi run test-cov

# Run linting
pixi run lint

# Format code
pixi run format

# Run type checking
pixi run typecheck

Architecture

src/nb_nebi_kernels/
├── __init__.py      # Exports NebiKernelSpecManager
├── discovery.py     # Local/remote workspace discovery + environment probing
├── launcher.py      # Kernel launcher with state-aware launch blocking
└── manager.py       # KernelSpecManager subclass (core logic)
  • discovery.py — Parses local nebi workspace list --json, optionally discovers remote workspaces through the Nebi API, resolves environment names, and probes local env install/dependency health.
  • launcher.py — Clears PIXI_* environment variables, blocks non-launchable states with actionable stderr messages, then execs pixi run in the workspace directory.
  • manager.py — Subclasses KernelSpecManager, merges local and remote workspace views, classifies per-kernel state, and emits structured kernelspec metadata.

License

Apache License 2.0

Download files

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

Source Distribution

nb_nebi_kernels-0.3.tar.gz (71.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nb_nebi_kernels-0.3-py3-none-any.whl (22.6 kB view details)

Uploaded Python 3

File details

Details for the file nb_nebi_kernels-0.3.tar.gz.

File metadata

  • Download URL: nb_nebi_kernels-0.3.tar.gz
  • Upload date:
  • Size: 71.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for nb_nebi_kernels-0.3.tar.gz
Algorithm Hash digest
SHA256 10da3801ce6dea72a094b412361ecfa4211fd2ff5865c25035d08446c1437f2d
MD5 6709f370e08e834e5c1b48ff666a477e
BLAKE2b-256 d6120f7e5faf79edfc70e97896bb9ec1b2cedac98203abe58ac8869482a74c88

See more details on using hashes here.

Provenance

The following attestation bundles were made for nb_nebi_kernels-0.3.tar.gz:

Publisher: release.yaml on nebari-dev/nb-nebi-kernels

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file nb_nebi_kernels-0.3-py3-none-any.whl.

File metadata

  • Download URL: nb_nebi_kernels-0.3-py3-none-any.whl
  • Upload date:
  • Size: 22.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for nb_nebi_kernels-0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 82b23f508b175b1112706f8d56e351c6fb79a590c8dbc49963ed7b8bc8fa99b7
MD5 fd57f8cdc9f1267cbb6c85554133784c
BLAKE2b-256 3252e28dd251332de04e3817f3abfc7202e4c3c6b669c6258ae258fcd9ccb27a

See more details on using hashes here.

Provenance

The following attestation bundles were made for nb_nebi_kernels-0.3-py3-none-any.whl:

Publisher: release.yaml on nebari-dev/nb-nebi-kernels

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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