Skip to content

Commit

Permalink
Revert "Configurables needs to be configurable (ipython#1037)"
Browse files Browse the repository at this point in the history
This reverts commit a38167b.
  • Loading branch information
blink1073 committed Dec 7, 2022
1 parent 72e7853 commit 0201459
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 17 deletions.
14 changes: 3 additions & 11 deletions ipykernel/ipkernel.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@
import comm
from IPython.core import release
from IPython.utils.tokenutil import line_at_cursor, token_at_cursor
from traitlets import Any, Bool, HasTraits, Instance, List, Type, observe, observe_compat
from traitlets import Any, Bool, Instance, List, Type, observe, observe_compat
from zmq.eventloop.zmqstream import ZMQStream

from .comm.comm import BaseComm
from .comm.manager import CommManager
from .compiler import XCachingCompiler
from .debugger import Debugger, _is_debugpy_available
from .eventloops import _use_appnope
Expand All @@ -41,18 +40,12 @@
_EXPERIMENTAL_KEY_NAME = "_jupyter_types_experimental"


def _create_comm(*args, **kwargs):
def create_comm(*args, **kwargs):
"""Create a new Comm."""
return BaseComm(*args, **kwargs)


def _get_comm_manager(*args, **kwargs):
"""Create a new CommManager."""
return CommManager(*args, **kwargs)


comm.create_comm = _create_comm
comm.get_comm_manager = _get_comm_manager
comm.create_comm = create_comm


class IPythonKernel(KernelBase):
Expand Down Expand Up @@ -119,7 +112,6 @@ def __init__(self, **kwargs):

self.comm_manager = comm.get_comm_manager()

assert isinstance(self.comm_manager, HasTraits)
self.shell.configurables.append(self.comm_manager)
comm_msg_types = ["comm_open", "comm_msg", "comm_close"]
for msg_type in comm_msg_types:
Expand Down
7 changes: 1 addition & 6 deletions ipykernel/tests/test_ipkernel_direct.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@
import zmq
from IPython.core.history import DummyDB

from ipykernel.comm.comm import BaseComm
from ipykernel.ipkernel import IPythonKernel, _create_comm
from ipykernel.ipkernel import IPythonKernel

from .conftest import MockIPyKernel

Expand Down Expand Up @@ -187,10 +186,6 @@ async def fake_poll_control_queue():
await control_future


def test_create_comm():
assert isinstance(_create_comm(), BaseComm)


def test_finish_metadata(ipkernel: IPythonKernel) -> None:
reply_content = dict(status="error", ename="UnmetDependency")
metadata = ipkernel.finish_metadata({}, {}, reply_content)
Expand Down

0 comments on commit 0201459

Please sign in to comment.