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

MIT

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.2.tar.gz (67.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.2-py3-none-any.whl (18.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: nb_nebi_kernels-0.2.tar.gz
  • Upload date:
  • Size: 67.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.2.tar.gz
Algorithm Hash digest
SHA256 2205d4914b85c4d32facb63710b99a0443cf2f96c1934c5dd7abedb30eaf90ff
MD5 09f3a4e658346a7df63309a79f2c8954
BLAKE2b-256 98f9416f02704991b978211d5595e3c91cd7678bcc15be8992c5fef23d0aaa85

See more details on using hashes here.

Provenance

The following attestation bundles were made for nb_nebi_kernels-0.2.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.2-py3-none-any.whl.

File metadata

  • Download URL: nb_nebi_kernels-0.2-py3-none-any.whl
  • Upload date:
  • Size: 18.4 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0a5f7e93f49297d048c2505b488b9f7b53a3142ea661445d2d6c0b316871f527
MD5 f120be8beca28226f63f79f3feab8d8a
BLAKE2b-256 0e135b6b718399f406ced6bb6254413e6a83bfd008e83c7b23584f18e6f19e52

See more details on using hashes here.

Provenance

The following attestation bundles were made for nb_nebi_kernels-0.2-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