Skip to main content

Embed JupyterLab in PySide6 applications

Project description

jupyqt

ci documentation pypi version

Embed JupyterLab in PySide6 applications — no ipykernel, no ZMQ, no qasync.

Features

  • Background-thread kernel — cell execution never blocks the Qt event loop
  • Top-level await — async/await works in notebook cells out of the box
  • Qt proxy — safely manipulate Qt widgets from notebook code
  • jupyverse server — full JupyterLab UI via QWebEngineView or external browser

Installation

pip install jupyqt

With uv:

uv add jupyqt

Quick start

from PySide6.QtWidgets import QApplication, QMainWindow, QVBoxLayout, QWidget
from jupyqt import EmbeddedJupyter

app = QApplication([])
window = QMainWindow()

jupyter = EmbeddedJupyter()
jupyter.shell.push({"greeting": "Hello from jupyqt!"})
jupyter.start()

central = QWidget()
QVBoxLayout(central).addWidget(jupyter.widget())
window.setCentralWidget(central)
window.show()

app.exec()
jupyter.shutdown()

Exposing Qt objects to the notebook

Wrap Qt objects with wrap_qt() so notebook cells can safely call methods on the main thread:

jupyter.push({
    "window": jupyter.wrap_qt(main_window),
    "label": jupyter.wrap_qt(some_label),
    "do_stuff": my_function,
})

Then in a notebook cell:

window.setWindowTitle("Controlled from Jupyter!")
label.setText("Updated from a cell")

import asyncio
for i in range(5):
    await asyncio.sleep(0.5)
    do_stuff()

Examples

# Minimal smoke test
uv run python examples/minimal_app.py

# Full demo with exposed UI, counter widget, and demo notebook
uv run python examples/demo_app.py

Architecture

┌─────────────────────────────────────┐
│  JupyterLabWidget (QWebEngineView)  │  ← Qt main thread
└───────────────┬─────────────────────┘
                │ HTTP / WebSocket
┌───────────────┴─────────────────────┐
│  jupyverse (fps + anyio)            │  ← server thread
└───────────────┬─────────────────────┘
                │ anyio MemoryObjectStreams
┌───────────────┴─────────────────────┐
│  Wire Protocol + InteractiveShell   │  ← kernel thread (asyncio)
└───────────────┬─────────────────────┘
                │ QtProxy (blocking invoke)
┌───────────────┴─────────────────────┐
│  Host Qt Application                │  ← Qt main thread
└─────────────────────────────────────┘

Three threads, no shared event loop, no reentrancy.

Project details


Download files

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

Source Distribution

jupyqt-0.3.1.tar.gz (61.7 kB view details)

Uploaded Source

Built Distribution

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

jupyqt-0.3.1-py3-none-any.whl (23.4 kB view details)

Uploaded Python 3

File details

Details for the file jupyqt-0.3.1.tar.gz.

File metadata

  • Download URL: jupyqt-0.3.1.tar.gz
  • Upload date:
  • Size: 61.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for jupyqt-0.3.1.tar.gz
Algorithm Hash digest
SHA256 7753c8d9f3275e004ee836207af2bd93c715f2c7abce0dfd9c6b50761d40f224
MD5 bdf6b0caf4f3a5cef562d84267fcad31
BLAKE2b-256 83bcb6b73f6e3cce617517c053aca9b238a7ce3c2eab1853db77ab783bd80396

See more details on using hashes here.

Provenance

The following attestation bundles were made for jupyqt-0.3.1.tar.gz:

Publisher: release.yml on SciQLop/jupyqt

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

File details

Details for the file jupyqt-0.3.1-py3-none-any.whl.

File metadata

  • Download URL: jupyqt-0.3.1-py3-none-any.whl
  • Upload date:
  • Size: 23.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for jupyqt-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 158e9d72273d4c3f54dfc24f9af12677aef9c73e42d61a23b8d3c1aa31187a5b
MD5 e3d9f1d0b8a91661852e9453008be7ea
BLAKE2b-256 0aaecb8bc317c504b378402dc8a45f1e91436af9c8bd00838a7bdc1fca22e825

See more details on using hashes here.

Provenance

The following attestation bundles were made for jupyqt-0.3.1-py3-none-any.whl:

Publisher: release.yml on SciQLop/jupyqt

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