Skip to main content

A concurrent python kernel for Jupyter supporting AnyIO, AsyncIO and Trio.

Project description

Async kernel

pypi downloads CI Ruff uv basedpyright - checked Built with Material for MkDocs codecov

logo-svg

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

Documentation

Installation

pip install async-kernel

Asyncio

An asyncio kernel based backend with the name 'async' is installed when the kernel is installed.

Trio backend

To add a kernel spec for a trio backend.

pip install trio
async-kernel -a async-trio --interface.backend=trio

For further detail about kernel spec customisation see command line usage.

Message handling

  • When a message is received the msg_handler is called with:

    • 'job' (a dict of msg, received_time and ident)
    • the channel
    • msg_type
    • A function send_reply
  • The msg_handler

    • determines the subshell_id and run mode.
    • obtains the handler from the kernel with the same name as the msg_type.
    • determines the run mode
    • creates cached version of the run_handler with a unique version per:
      • The handler
      • channel
      • subshell_id
      • send_reply (constant or per-channel)
    • Obtains the caller associated with the channel and schedules execution of the cached handler

Run mode

The run modes available are:

  • RunMode.directCaller.call_direct: Run the request directly in the scheduler.
  • RunMode.queueCaller.queue_call: Run the request in a queue dedicated to the subshell, handler & channel.
  • RunMode.taskCaller.call_soon: Run the request in a separate task.
  • RunMode.threadCaller.to_thread: Run the request in a separate worker thread.

These are the currently assigned run modes.

SocketID shell control
comm_close direct direct
comm_info_request direct direct
comm_msg queue queue
comm_open direct direct
complete_request thread thread
create_subshell_request None thread
debug_request None queue
delete_subshell_request None thread
execute_request queue queue
history_request thread thread
inspect_request thread thread
interrupt_request direct direct
is_complete_request thread thread
kernel_info_request direct direct
list_subshell_request None direct
shutdown_request None direct

Origin

Async kernel started as a fork of IPyKernel. Thank you to the original contributors of IPyKernel that made Async kernel possible.

[^non-main-thread]: The Shell can run in other threads with the associated limitations with regard to signalling and interrupts.

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

async_kernel-0.12.0.tar.gz (287.7 kB view details)

Uploaded Source

Built Distribution

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

async_kernel-0.12.0-py3-none-any.whl (94.0 kB view details)

Uploaded Python 3

File details

Details for the file async_kernel-0.12.0.tar.gz.

File metadata

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

File hashes

Hashes for async_kernel-0.12.0.tar.gz
Algorithm Hash digest
SHA256 8d675bfb3ae27e3556446343636bda37c9e0061256953cdd63417dcf742519e0
MD5 70cb30d7a96d119c3f8cefe6c57f2b21
BLAKE2b-256 9300417c3f264a52ccbfbff32ed1244794632f107b9b8274cde83dda3668aa92

See more details on using hashes here.

Provenance

The following attestation bundles were made for async_kernel-0.12.0.tar.gz:

Publisher: publish-to-pypi.yml on fleming79/async-kernel

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

File details

Details for the file async_kernel-0.12.0-py3-none-any.whl.

File metadata

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

File hashes

Hashes for async_kernel-0.12.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ec15ae2a309f748caaf3368bbead7e07ce97393cc06e8e2a5fe8f0ddc08a51e1
MD5 3ca8eba2381cfadfae709fcb2edca9ac
BLAKE2b-256 2e21e3b7917fe9a8a4344a514473ce38ee50b5a74309f59cc356f21eea530e44

See more details on using hashes here.

Provenance

The following attestation bundles were made for async_kernel-0.12.0-py3-none-any.whl:

Publisher: publish-to-pypi.yml on fleming79/async-kernel

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