Jupyterlab extension to detect notebook kernels similarly to how nb_conda_kernel does
Project description
nb_venv_kernels
Use Python virtual environments as Jupyter kernels. Discovers and registers kernels from venv, uv, and conda environments in JupyterLab's kernel selector.
Features
- Unified kernel discovery - conda, venv, and uv environments in one kernel selector
- Auto-detection - distinguishes uv from venv via
pyvenv.cfg - Smart ordering - current environment first, then conda, uv, venv, system
- Drop-in replacement - replaces nb_conda_kernels while preserving all conda functionality
- CLI management - register, unregister, and list environments
- Zero config - auto-enables on install, works immediately
Install
pip install nb_venv_kernels
The extension installs itself as the default kernel spec manager via jupyter_config.json. If nb_conda_kernels is installed, nb_venv_kernels takes precedence and includes all conda kernel discovery functionality.
Usage
Register environments after installing ipykernel:
nb_venv_kernels register /path/to/.venv
nb_venv_kernels list
nb_venv_kernels unregister /path/to/.venv
Manage Jupyter configuration:
nb_venv_kernels config enable # Enable VEnvKernelSpecManager
nb_venv_kernels config disable # Disable VEnvKernelSpecManager
nb_venv_kernels config show # Show current config status
Registered environments with ipykernel appear in JupyterLab's kernel selector.
Environment Registries
Environments are registered in separate files based on their source:
- venv:
~/.venv/environments.txt - uv:
~/.uv/environments.txt - conda:
~/.conda/environments.txt+ global environments fromconda env list
The register command auto-detects uv environments via pyvenv.cfg and writes to the appropriate registry.
How It Works
- Scans
{path}/share/jupyter/kernels/*/kernel.jsonfor each registered environment - Configures kernel to use venv's python directly with
VIRTUAL_ENVandPATHenvironment variables - Kernel order: current environment first, then conda, uv, venv, system
- Caches results for 60 seconds
config enablebacks up existing config,config disablerestores from backup
Configuration
Optional settings in jupyter_server_config.py:
c.VEnvKernelSpecManager.venv_only = True # Hide system/conda kernels
c.VEnvKernelSpecManager.env_filter = r"\.tox|\.nox" # Exclude by pattern
c.VEnvKernelSpecManager.name_format = "{language} [{source} env:{environment}]" # Default format
Display name variables: {language}, {environment}, {source} (uv/venv), {kernel}, {display_name}
Uninstall
pip uninstall nb_venv_kernels
After uninstall, nb_conda_kernels (if installed) will resume handling kernel discovery.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nb_venv_kernels-1.0.8.tar.gz.
File metadata
- Download URL: nb_venv_kernels-1.0.8.tar.gz
- Upload date:
- Size: 549.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
68f897d6fc53ee83321f12386af9231eb54909080b5a0e24bda7e3f7b50e8a4e
|
|
| MD5 |
302d4b9491a61524b31fb8387cb5edb7
|
|
| BLAKE2b-256 |
913cf25995efc344953405b937ac5ba882f4d036e386b6d33965b3bc9b13d520
|
File details
Details for the file nb_venv_kernels-1.0.8-py3-none-any.whl.
File metadata
- Download URL: nb_venv_kernels-1.0.8-py3-none-any.whl
- Upload date:
- Size: 27.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9378aa26288edd64ed68beb4be6027123b3eaf930e48c546f86adfa1d5557c26
|
|
| MD5 |
6d7969fcf860d893ee54bff8bd203a73
|
|
| BLAKE2b-256 |
abdd08d6880288621d4d6fb727f99e301082733d02b83cc260ce1cc3c104f43c
|