A concurrent python kernel for Jupyter supporting AnyIO, AsyncIO and Trio.
Project description
Async kernel
Async kernel is a Python Jupyter kernel with concurrent message handling.
Messages are processed fairly whilst preventing asynchronous deadlocks by using
a unique message handler per channel, message_type and subshell_id.
Highlights
- Experimental support for Jupyterlite try it online here 👈
- Debugger client
- anyio compatible event loops
- aiologic thread-safe synchronisation primitives
- Easy multi-thread / multi-event loop management
- IPython shell
- Per-subshell user_ns
- GUI event loops [^gui note][^gui caller note]
- inline
- ipympl
- tk with asyncio[^asyncio guest] or trio backend running as a guest
- qt with asyncio[^asyncio guest] or trio backend running as a guest
[^gui note]: A gui event loop is provided by starting the event loop (host) and then running an asynchronous backend as a guest in the event loop. Kernel messaging is performed as usual in the asynchronous backend. For this reason it is not possible to enable a gui event loop at runtime.
[^gui caller note]: It is also possible to use a caller to run a gui event loop in a separate thread (with a backend running as a guest) if the gui allows it (qt will only run in the main thread). Also note that pyplot will only permit one interactive gui library in a process.
[^asyncio guest]: The asyncio implementation of start_guest_run was written by
the author of aiologic and provided as a
(gist).
Installation
pip install async-kernel
Kernel specs
A kernel spec with the name 'async' is added when async kernel is installed.
Kernel specs can be added/removed via the command line.
The kernel is configured via the interface with the options:
interface.backendinterface.backend_optionsinterface.loopinterface.loop_options
Backends
The backend defines the asynchronous library provided in the thread in which it is running.
- asyncio
- trio
Example - change kernel spec to use trio
pip install trio
async-kernel -a async --interface.backend=trio
Gui event loop
The kernel can be started with a gui event loop as the host and the backend running as a guest.
asyncio backend
# tk
async-kernel -a async-tk --interface.loop=tk
# qt
pip install PySide6-Essentials
async-kernel -a async-qt --interface.loop=qt
trio backend
pip install trio
# tk
async-kernel -a async-tk --interface.loop=tk --interface.backend=trio
# qt
pip install PySide6-Essentials
async-kernel -a async-qt --interface.loop=qt --interface.backend=trio
For further detail about kernel spec customisation see command line usage.
Origin
Async kernel started as a fork of IPyKernel. Thank you to the original contributors of IPyKernel that made Async kernel possible.
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 async_kernel-0.12.3.tar.gz.
File metadata
- Download URL: async_kernel-0.12.3.tar.gz
- Upload date:
- Size: 304.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
16973e72d8de40a26a83884deb8ec0cda746225ce53f427997db7382af2d3408
|
|
| MD5 |
4a0bfc53726674f89442cfef7adc0c2d
|
|
| BLAKE2b-256 |
4d6ac30d1e4a3ca2fd1311d440574a00cb9b9a88772ed26edc4e6e7d9a880ed5
|
Provenance
The following attestation bundles were made for async_kernel-0.12.3.tar.gz:
Publisher:
publish-to-pypi.yml on fleming79/async-kernel
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
async_kernel-0.12.3.tar.gz -
Subject digest:
16973e72d8de40a26a83884deb8ec0cda746225ce53f427997db7382af2d3408 - Sigstore transparency entry: 962199359
- Sigstore integration time:
-
Permalink:
fleming79/async-kernel@b968d1c301d04761e6391231860e32e4788a431c -
Branch / Tag:
refs/heads/main - Owner: https://github.com/fleming79
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@b968d1c301d04761e6391231860e32e4788a431c -
Trigger Event:
workflow_run
-
Statement type:
File details
Details for the file async_kernel-0.12.3-py3-none-any.whl.
File metadata
- Download URL: async_kernel-0.12.3-py3-none-any.whl
- Upload date:
- Size: 105.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
18ac33f23ae315a4c1ead845366a3c1ebc26d2dea40382dd87b0ef736c886622
|
|
| MD5 |
663e0bf50f8e432beefa9ea7015c3f5d
|
|
| BLAKE2b-256 |
3cd6fa8b591bc2677be87979a736423080aba4082899eb9b981eb7c8ce578f2e
|
Provenance
The following attestation bundles were made for async_kernel-0.12.3-py3-none-any.whl:
Publisher:
publish-to-pypi.yml on fleming79/async-kernel
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
async_kernel-0.12.3-py3-none-any.whl -
Subject digest:
18ac33f23ae315a4c1ead845366a3c1ebc26d2dea40382dd87b0ef736c886622 - Sigstore transparency entry: 962199361
- Sigstore integration time:
-
Permalink:
fleming79/async-kernel@b968d1c301d04761e6391231860e32e4788a431c -
Branch / Tag:
refs/heads/main - Owner: https://github.com/fleming79
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-to-pypi.yml@b968d1c301d04761e6391231860e32e4788a431c -
Trigger Event:
workflow_run
-
Statement type: