Skip to content

Commit

Permalink
Missing register comm target (#37)
Browse files Browse the repository at this point in the history
* Missing register comm target

* Linting

Co-authored-by: David Brochart <[email protected]>

---------

Co-authored-by: David Brochart <[email protected]>
  • Loading branch information
martinRenou and davidbrochart authored Jan 31, 2025
1 parent ce1d17d commit 8d4cfa4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/ypywidgets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,8 @@
__version__ = importlib.metadata.version("ypywidgets")
except importlib.metadata.PackageNotFoundError: # pragma: no cover
__version__ = "unknown"


from .comm import register_comm_target

register_comm_target()
11 changes: 11 additions & 0 deletions src/ypywidgets/comm.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,17 @@
from .widget import Widget


def handle_comm_opened(*args, **kwargs):
# TODO handle comm open from front-end
pass # pragma: nocover


def register_comm_target():
comm_manager = comm.get_comm_manager()
if comm_manager is not None:
comm_manager.register_target("ywidget", handle_comm_opened)


def create_widget_comm(
data: dict | None = None,
metadata: dict | None = None,
Expand Down

0 comments on commit 8d4cfa4

Please sign in to comment.