Skip to main content

Jupyter Python Comm implementation, for usage in ipykernel, xeus-python etc.

Project description

Comm

It provides a way to register a Kernel Comm implementation, as per the Jupyter kernel protocol. It also provides a base Comm implementation and a default CommManager that can be used.

Register a comm implementation in the kernel:

Case 1: Using the default CommManager and the BaseComm implementations

We provide default implementations for usage in IPython:

import comm


class MyCustomComm(comm.base_comm.BaseComm):
    def publish_msg(self, msg_type, data=None, metadata=None, buffers=None, **keys):
        # TODO implement the logic for sending comm messages through the iopub channel
        pass


comm.create_comm = MyCustomComm

This is typically what ipykernel and JupyterLite's pyolite kernel will do.

Case 2: Providing your own comm manager creation implementation

import comm

comm.create_comm = custom_create_comm
comm.get_comm_manager = custom_comm_manager_getter

This is typically what xeus-python does (it has its own manager implementation using xeus's C++ messaging logic).

Comm users

Libraries like ipywidgets can then use the comms implementation that has been registered by the kernel:

from comm import create_comm, get_comm_manager

# Create a comm
comm_manager = get_comm_manager()
comm = create_comm()

comm_manager.register_comm(comm)

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

comm-0.2.1.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

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

comm-0.2.1-py3-none-any.whl (7.2 kB view details)

Uploaded Python 3

File details

Details for the file comm-0.2.1.tar.gz.

File metadata

  • Download URL: comm-0.2.1.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for comm-0.2.1.tar.gz
Algorithm Hash digest
SHA256 0bc91edae1344d39d3661dcbc36937181fdaddb304790458f8b044dbc064b89a
MD5 d3ce0c65921009db26269436ca6deae5
BLAKE2b-256 b940386982b9f3e6b3126c75f6e7939de40f3eb0f5d4f5bf884ba8123454eb3e

See more details on using hashes here.

File details

Details for the file comm-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: comm-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 7.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.11.7

File hashes

Hashes for comm-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 87928485c0dfc0e7976fd89fc1e187023cf587e7c353e4a9b417555b44adf021
MD5 c4d048ab8b6b6af8874847038aedb21a
BLAKE2b-256 6ec1e7335bd49aa3fa3bd453e34a4580b0076804f219897ad76d4d5aa4d8f22f

See more details on using hashes here.

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