Skip to content

Commit

Permalink
run server locally
Browse files Browse the repository at this point in the history
  • Loading branch information
Quentin Peter committed Dec 4, 2022
1 parent c331f32 commit 18d090a
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 5 deletions.
1 change: 1 addition & 0 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ To release a new version of Spyder you need to follow these steps:
* Update our subrepos with the following commands, but only if new versions are available!

git subrepo pull external-deps/spyder-kernels
git subrepo pull external-deps/spyder-kernels-server
git subrepo pull external-deps/python-lsp-server
git subrepo pull external-deps/qtconsole

Expand Down
2 changes: 1 addition & 1 deletion external-deps/qtconsole/qtconsole/comms.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions external-deps/spyder-kernels-server/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions installers/Windows/req-extras-pull-request.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,5 @@ spyder-terminal>=1.2.2

# Spyder external dependencies (spyder-kernels and qdarkstyle)
./external-deps/spyder-kernels
./external-deps/spyder-kernels-server
./external-deps/qdarkstyle
16 changes: 12 additions & 4 deletions spyder/plugins/ipythonconsole/widgets/mixins.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
IPython Console mixins.
"""
import zmq
import sys

from qtpy.QtCore import QProcess

# Local imports
from spyder.plugins.ipythonconsole.utils.kernel_handler import KernelHandler
Expand All @@ -17,23 +20,29 @@ class KernelConnectorMixin:
"""Needs https://github.com/jupyter/jupyter_client/pull/835"""
def __init__(self):
super().__init__()
self.hostname = None
self.sshkey = None
self.password = None
self.start_local_server()
self.port = "5556"
self.context = zmq.Context()
self.socket = self.context.socket(zmq.REQ)
self.socket.connect("tcp://localhost:%s" % self.port)

def start_local_server(self):
self.server = QProcess(self)
self.server.start(sys.executable, ["-m", "spyder_kernels_server"])

def new_kernel(self, kernel_spec):
"""Get a new kernel"""
self.socket.send_pyobj(["open_kernel", kernel_spec])
cmd, connection_file, connection_info = self.socket.recv_pyobj()
if connection_file == "error":
raise connection_info

hostname, sshkey, password = None, None, None

kernel_handler = KernelHandler.new_from_spec(
kernel_spec, connection_file, connection_info,
hostname, sshkey, password
self.hostname, self.sshkey, self.password
)

kernel_handler.sig_request_close.connect(self.close_kernel)
Expand All @@ -45,7 +54,6 @@ def close_kernel(self, connection_file):
self.socket.recv_pyobj()



class CachedKernelMixin:
"""Cached kernel mixin."""
def __init__(self):
Expand Down

0 comments on commit 18d090a

Please sign in to comment.