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.1.0.tar.gz (5.4 kB view details)

Uploaded Source

Built Distribution

comm-0.1.0-py2.py3-none-any.whl (5.7 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

  • Download URL: comm-0.1.0.tar.gz
  • Upload date:
  • Size: 5.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.5

File hashes

Hashes for comm-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9d56c0bc699e6c47c1542c8a5681853e94654dfc68a9d858a82f644745c17061
MD5 ad3c77ac741dec9da0da2d6e10896c8d
BLAKE2b-256 4e3f05bef5c868e0007845b61ce3e20f032201f94636cb17ad69bc6de8f6b2cb

See more details on using hashes here.

Provenance

File details

Details for the file comm-0.1.0-py2.py3-none-any.whl.

File metadata

  • Download URL: comm-0.1.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.5

File hashes

Hashes for comm-0.1.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 e086af597f6f34b3c79fdfb074f210c4af230da16102a86c4b7a3c7c59973941
MD5 ad7ced386ba2589c0e0f4f7da3d6265e
BLAKE2b-256 d5f53a1e7504dfa46c7faf765d882d8997d771a551ef25c7b4a9fe8c61f9e3ad

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page