Metadata-Version: 2.4
Name: jupyterlab-cell-queue
Version: 0.1.0
Summary: See, remove and stop the cells waiting to run in a JupyterLab notebook.
Project-URL: Homepage, https://github.com/quietuseful/jupyterlab-cell-queue
Project-URL: Issues, https://github.com/quietuseful/jupyterlab-cell-queue/issues
Author: quietuseful
License: BSD 3-Clause License
        
        Copyright (c) 2026, jupyterlab-cell-queue contributors
        All rights reserved.
        
        Redistribution and use in source and binary forms, with or without
        modification, are permitted provided that the following conditions are met:
        
        1. Redistributions of source code must retain the above copyright notice, this
           list of conditions and the following disclaimer.
        
        2. Redistributions in binary form must reproduce the above copyright notice,
           this list of conditions and the following disclaimer in the documentation
           and/or other materials provided with the distribution.
        
        3. Neither the name of the copyright holder nor the names of its
           contributors may be used to endorse or promote products derived from
           this software without specific prior written permission.
        
        THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
        AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
        IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
        DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
        FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
        DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
        SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
        CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
        OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
        OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
License-File: LICENSE
Classifier: Framework :: Jupyter
Classifier: Framework :: Jupyter :: JupyterLab
Classifier: Framework :: Jupyter :: JupyterLab :: 4
Classifier: Framework :: Jupyter :: JupyterLab :: Extensions
Classifier: Framework :: Jupyter :: JupyterLab :: Extensions :: Prebuilt
Classifier: License :: OSI Approved :: BSD License
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.9
Description-Content-Type: text/markdown

# jupyterlab-cell-queue

A JupyterLab 4 extension that shows the cells waiting to run in the current
notebook and lets you remove them before they start.

Today, when you press "Run All" or queue several cells with Shift+Enter,
JupyterLab sends every cell to the kernel at once. A cell that is already in
the kernel's queue cannot be withdrawn; the only way out is to interrupt, which
drops everything. This extension holds waiting cells in the browser instead and
sends them one at a time, so a waiting cell can still be removed.

Related requests: jupyterlab/jupyterlab#7825, jupyter/notebook#2340.

## Features

- **Cell Queue side panel** (right sidebar): the running cell and every waiting
  cell of the current notebook, with its position and first line of code.
- **Remove** a single waiting cell. It goes back to idle and is never sent.
- **Stop after current cell**: the running cell finishes, all waiting cells
  are removed. Also a command and a notebook context-menu entry.
- **Jump to a cell** by clicking its entry.
- **Remove Cell From Queue** for the active cell (command palette and cell
  context menu).

Behaviour that stays as in stock JupyterLab:

- Waiting cells show the `[*]` prompt.
- An error stops the queue. Cells tagged `raises-exception` do not stop it,
  matching the kernel's `stop_on_error` rule.
- An interrupt (KeyboardInterrupt) stops the queue.
- A kernel restart, kernel change or dead kernel clears the queue.
- Deleting a waiting cell removes it from the queue. Moving a waiting cell keeps
  it in the queue.
- Markdown cells render immediately.

## Limits, please read

1. **The queue lives in the browser tab.** If you close the tab, reload the
   page, close the notebook or your computer goes to sleep, waiting cells are
   not run. The cell that is already running keeps running in the kernel.
2. **Slower for many tiny cells.** Each cell costs one extra round trip
   between browser and kernel. Measured locally (JupyterLab 4.4.4, ipykernel
   6.29, same machine): "Run All" over 102 trivial cells took 5.3 s with the
   extension and 1.2 s without it, about 40 ms extra per cell. For cells that
   take seconds or minutes this does not matter; for hundreds of instant cells
   it does.
3. **Waiting cells run the code they have when they are sent**, not when you
   pressed Shift+Enter. Entries edited since they were queued are marked
   "edited" in the panel.
4. **Removed cells keep their previous output and execution count.** Stock
   JupyterLab clears a cell's output as soon as it is queued; this extension
   clears it only when the cell is actually sent.
5. **Only one cell executor can be active.** The extension replaces the
   `@jupyterlab/notebook-extension:cell-executor` plugin. It does not work
   together with other extensions that replace it, such as server-side
   execution in jupyter-collaboration or jupyter-server-nbmodel.
6. **Only this tab's queue is shown.** Requests sent by other clients
   connected to the same kernel are not visible.

## Requirements and install

- JupyterLab >= 4.4 (tested: 4.4.4 and 4.5.6). The cell-executor interface it
  relies on is unchanged in 4.6.6 and 4.7.0b2 (source compared, not run).
- Jupyter Notebook 7: basic check passed on 7.4.4 (queue, remove).

Not published on PyPI yet. To build from source you need Node.js >= 20 and a
`jupyter` with JupyterLab 4:

```bash
tools/build.sh /path/to/jupyter     # builds into ~/.cache/jupyterlab-cell-queue-build
```

Then either point JupyterLab at the built folder
(`--LabApp.extra_labextensions_path=<folder containing jupyterlab-cell-queue/>`),
or build a wheel with `WHEEL_PYTHON=/path/to/python tools/build.sh` (needs
`hatchling==1.27.0` and `hatch-jupyter-builder==0.9.1`) and `pip install` it.

To turn it off: `jupyter labextension disable jupyterlab-cell-queue` (add
`--level=user` if you cannot write to the Python environment), then reload the
browser tab. JupyterLab then uses its own executor again: checked on 4.4.4,
where the core `cell-executor` plugin was active again after the reload and
"Run All" behaved as stock. `jupyter labextension enable jupyterlab-cell-queue`
turns it back on. To remove it completely: `pip uninstall jupyterlab-cell-queue`
and reload.

## Privacy and permissions

Frontend only. No server extension, no network requests of its own, no
telemetry, no storage. Cell code is displayed as text only, never executed or
rendered as HTML by the panel.

## Development and tests

```bash
npm test                 # 42 unit tests, Node's built-in test runner, no install needed
node tools/mutate.mjs    # breaks the code 13 ways on purpose; every mutation must fail a test
```

The unit tests cover order, one-at-a-time sending, remove, stop after current,
errors (incl. `raises-exception`), interrupt/restart/kernel change (the first
kernel start of a notebook keeps the queue), notebook
closed, cell deleted or moved while waiting, the same cell queued twice, two
notebooks at once and listener failures.

`tools/e2e_jupyterlab.py` drives a real JupyterLab with a real IPython kernel
through Playwright (27 checks: the scenarios above plus jump, panel contents,
prompts and console errors). It needs a running server started with
`--LabApp.expose_app_in_browser=True`.

Dependencies: only JupyterLab's own packages (provided by JupyterLab at
runtime) and `@jupyterlab/builder` for the build. Exact versions and hashes are
in `package-lock.json`. The bundled output contains only `css-loader` and
`style-loader` runtime code (MIT).

## Not verified

- JupyterLab 4.6 and 4.7 in a running instance.
- Kernels other than ipykernel (e.g. IRkernel, which handles aborted requests
  differently).
- Real-time collaboration (several users in one notebook).
- Behaviour with JupyterLab's "windowed" notebook mode on very large
  notebooks beyond the cell counts used in the tests.
- `pip uninstall jupyterlab-cell-queue` restoring the core executor: follows
  from how jupyterlab_server reads `disabledExtensions` (only from installed
  extensions), but was not run. Disabling with `jupyter labextension disable`
  was run.
- Turning the core `cell-executor` plugin back on in JupyterLab's Plugin
  Manager while this extension is active (two plugins would then provide the
  same executor). Disable this extension instead.
- If the kernel is shutting down, JupyterLab shows its "Kernel Terminating"
  dialog; with several waiting cells you may see it once per cell.

## License

BSD 3-Clause, see `LICENSE`.
