jupyterlab commands

July 28, 2026 ยท View on GitHub

Arbitrary python commands for notebooks in JupyterLab

Build Status codecov License PyPI Binder

About

This extension adds arbitrary Python commands to JupyterLab's command palette. Commands can run outside notebooks and consoles, making them useful for tasks such as:

  • running predefined nbconvert functions without adding code to a notebook
  • interacting with version control without recording that interaction in a notebook

Installation

pip install jupyterlab-commands

Configuration

Install the server extension and add commands to jupyter_lab_config.py:

def convert(request, *args, **kwargs):
    import json
    import os
    import subprocess

    import tornado

    data = json.loads(tornado.escape.json_decode(request.body))
    path = os.path.join(os.getcwd(), data["path"])
    subprocess.run(["jupyter", "nbconvert", path, "--to", "html"], check=True)
    return {"body": "ok"}


c.JupyterLabCommands.commands = {"convert": convert}

Commands appear in the command palette:

Command palette

Command output appears in the terminal:

Terminal output

jupyterlab-nbconvert-nocode provides notebook conversion with code cells removed.

License

Licensed under the Apache License 2.0. See LICENSE.

Note

This library was generated using copier from the Base Python Project Template repository.