{"library":"pyviz-comms","title":"PyViz Comms","description":"pyviz-comms is a Python library that provides a simple bidirectional communication architecture between Python and JavaScript, primarily for use within Jupyter environments (Classic Notebook and JupyterLab). It acts as a low-level building block for the HoloViz ecosystem, enabling interactive content rendering. The library is currently at version 3.0.6 and aligns its major releases with JupyterLab versions to ensure compatibility.","language":"python","status":"active","last_verified":"Fri May 15","install":{"commands":["pip install pyviz-comms"],"cli":null},"imports":["from pyviz_comms import Comm","from ipykernel.comm import Comm as IPyComm"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"from pyviz_comms import Comm\nfrom IPython.display import display, Javascript\n\ndef python_message_handler(msg):\n    print(f\"Python received: {msg['content']['data']}\")\n\n# Create a new comm target\ncomm_id = 'my_pyviz_comm_example'\ncomm = Comm(target_name=comm_id, data={})\ncomm.on_msg(python_message_handler)\n\n# Send a message from Python to the frontend\ncomm.send(data={'status': 'hello from python!'})\n\n# To make this truly bidirectional, a JavaScript counterpart is needed in the Jupyter frontend.\n# Run the following JavaScript in a separate Jupyter cell:\n#\n# %%javascript\n# if (window.PyViz == undefined) { window.PyViz = {}; }\n# if (window.PyViz.comms == undefined) { window.PyViz.comms = {}; }\n#\n# Jupyter.notebook.kernel.comm_manager.register_target('my_pyviz_comm_example', function(comm) {\n#     window.PyViz.comms[comm.comm_id] = comm;\n#     comm.on_msg(function(msg) {\n#         console.log(\"JS received:\", msg.content.data);\n#         comm.send({'response': 'hello from JS!'});\n#     });\n#     comm.send({'ready': true});\n#     console.log(\"JS comm 'my_pyviz_comm_example' registered and ready.\");\n# });\n\n# After running the JS, you could send another message from Python:\n# comm.send(data={'action': 'update_chart'})","lang":"python","description":"This quickstart demonstrates how to establish a basic bidirectional communication channel using `pyviz_comms.Comm` within a Jupyter environment. It sets up a Python-side message handler and sends an initial message. For full interactivity, a corresponding JavaScript snippet must be executed in a Jupyter frontend cell to register the client-side comm and handle messages from Python, as well as send messages back. This example illustrates the low-level nature of `pyviz-comms`; higher-level libraries like Panel abstract much of this complexity.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":{"tag":null,"tag_description":null,"last_tested":"2026-05-15","installed_version":"3.0.6","pypi_latest":"3.0.6","is_stale":false,"summary":{"python_range":"3.10–3.9","success_rate":100,"avg_install_s":1.8,"avg_import_s":0.13,"wheel_type":"wheel"},"results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"pyviz-comms","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.09,"mem_mb":4,"disk_size":"19.1M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"pyviz-comms","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.8,"import_time_s":0.06,"mem_mb":4,"disk_size":"20M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"pyviz-comms","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.16,"mem_mb":4.8,"disk_size":"21.1M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"pyviz-comms","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.9,"import_time_s":0.14,"mem_mb":4.8,"disk_size":"22M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"pyviz-comms","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.13,"mem_mb":4.7,"disk_size":"12.9M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"pyviz-comms","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.6,"import_time_s":0.14,"mem_mb":4.7,"disk_size":"13M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"pyviz-comms","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.11,"mem_mb":4.7,"disk_size":"12.7M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"pyviz-comms","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.6,"import_time_s":0.12,"mem_mb":4.7,"disk_size":"13M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"pyviz-comms","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.17,"mem_mb":6.6,"disk_size":"18.4M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"pyviz-comms","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":2.1,"import_time_s":0.15,"mem_mb":7.1,"disk_size":"19M"}]}}