Skip to content

Commit

Permalink
feat: provide a default implementation (#13)
Browse files Browse the repository at this point in the history
The default implementation does nothing, but allows ipywidgets
to be used without a kernel.
This is a common use case in testing/CI.
  • Loading branch information
maartenbreddels authored Mar 22, 2023
1 parent b39a369 commit 309b829
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions comm/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
It also provides a base Comm implementation and a default CommManager for the IPython case.
"""

from .base_comm import CommManager
from .base_comm import BaseComm, CommManager

__version__ = "0.1.2"
__all__ = [
Expand All @@ -20,12 +20,17 @@
_comm_manager = None


class DummyComm(BaseComm):
def publish_msg(self, msg_type, data=None, metadata=None, buffers=None, **keys):
pass


def _create_comm(*args, **kwargs):
"""Create a Comm.
This method is intended to be replaced, so that it returns your Comm instance.
"""
raise NotImplementedError("Cannot ")
return DummyComm(*args, **kwargs)


def _get_comm_manager():
Expand Down

0 comments on commit 309b829

Please # to comment.