spyder-ide / spyder-kernels

Jupyter Kernels for the Spyder console
MIT License
38 stars 40 forks source link

Automate remote ssh kernel setup and connection #358

Open jacksund opened 2 years ago

jacksund commented 2 years ago

Hello! This is a feature-request, but I hope opening an issue is fine.

EDIT: The original issue has been rewritten for clarity

Current implementation

Users must follow along with the remote kernel tutorial. This involves...

  1. manually signing in to a remote cluster (ssh)
  2. starting a kernel with python -m spyder_kernels.console
  3. starting a separate terminal / file-transfer window to find the connection json file
  4. copying the connection_info json file to local computer
  5. use Spyder's remote kernel dialog to (a) give the file and (b) rewrite ssh info.

Problem

The steps above can be very tedious because it involves multiple terminal and file transfers. In most cases, I'll just stick with ipython on the remote cluster, rather than using Spyder.

Possible Solutions

  1. (partial solution) Have python -m spyder_kernels.console print out the connection json, which can be copied directly into the Spyder dialog. It'd be an alternative to selecting a file here: image

  2. From the spyder dialog, pass the SSH connection information to fabric. Then use fabric to run python -m spyder_kernels.console and grab the connection info. Spyder then starts a new console using this connection info and the original SSH connection.

For solution 1 --> Based on the ipython recipe, it might be possible by having spyder call %connect_info as soon as the kernal is started. I know very little about kernels though.

jacksund commented 2 years ago

As an update, I wrote a simple class based on fabric to make this process easier for me. The code might be useful if your team decides to implement these features. You can find that code here.

EDIT: switched reference code to an older version that doesn't use a jobqueue

ccordoba12 commented 2 years ago

This is a very interesting idea and would simplify the process to connect to remote kernels a lot. Thanks for the suggestion!

We'll try to implement it in a future release.

matifali commented 2 years ago

Any updates?

ccordoba12 commented 2 years ago

No, sorry. We've been asking for funding to work on this for the last two years but we haven't gotten it yet.

matifali commented 2 years ago

Now, most IDEs provide a direct and simpler way to connect to a remote server over ssh,

  1. VS code through remote VS code extension

  2. JetBrains through Gateway

  3. Spyder is the only one missing.

dhirschfeld commented 2 years ago

3. Spyder is the only one missing

https://opencollective.com/spyder