Package: pybunny
PyBunny - Your SSH-Jupyter Proxy Hop Friend!Bunny is a ssh proxy jumping for jupyter notebooks. If you are in a situation similar to mine where you want to port
forward a jupyter notebook from your mini cluster machine but is not ssh accessible so you need a gateway that is SSH
accessible and you are going to port forward through several machines. Well I wrote a python package for it.HOST A (local machine) -> HOST B (gateway) -> HOST C (execute jupyter)Note: you must have authorized keys in your SSH between every Host added into the Bunny.Quick StartRunning the bunny is pretty easy. To initialize a class you pass thepython_envvariable to dictate which python env
is going to be running the jupyter notebook. Thenotebook_launch_commandis your exact launch command to run the jupyter
notebook - mine is exampled down below and theportyou execute your notebook on.from pybunny.bunny import Bunny
    
    bunny = Bunny(
        python_env='/path/to/env/python',
        notebook_launch_command='jupyter notebook --no-browser --NotebookApp.token=""',
        port='8889'
    )Next add your hops between the bunnies, with the user, hostname, and the name of the gateway. If this is the last server
in your chain to run the notebook then add theproxy_jumpargument ifbunny.add_hop('hop1', hostname='XX.XX.XXX.XXX', user='poor_graduate_student')
    bunny.add_hop('notebook', hostname='fakeemail@someuniversity.edu', user='poor_graduate_student', proxy_jump = True)When your configurations are set then write the SSH Config, this is a localbunny_configfile generated that contains
the bunny configuration.bunny.write()which generates something like this:Host hop1
    
      HostName XX.XXX.XXX.XXX
      User poor_graduate_student
    
    Host notebook
      HostName fakeemail@someuniversity.edu
      User poor_graduate_student
      ProxyJump XX.XX.XXX.XXX
      RequestTTY force
      LocalForward 8889 127.0.0.1:8889
      RemoteCommand /path/to/env/python jupyter notebook --no-browser --NotebookApp.token="" --port=8889The last command will be therun()function which will execute theSSHconnection across your gateways. Under the hood
it runs theSSH -F bunny_config nameso as long as your haveSSHinstalled we should be good and your process will run.bunny.run()If all successful we should be generating something like this:[I 20:46:00.555 NotebookApp] JupyterLab extension loaded from anaconda3/lib/python3.7/site-packages/jupyterlab
[I 20:46:00.555 NotebookApp] JupyterLab application directory is /jupyter/lab
[I 20:46:00.557 NotebookApp] Serving notebooks from local directory: /rotation
[I 20:46:00.557 NotebookApp] The Jupyter Notebook is running at:
[I 20:46:00.557 NotebookApp] http://localhost:8889/
[I 20:46:00.557 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[I 20:46:04.084 NotebookApp] 302 GET / (127.0.0.1) 1.00ms
[E 20:46:04.166 NotebookApp] Could not open static file ''
[W 20:46:04.503 NotebookApp] 404 GET /static/components/react/react-dom.production.min.js (127.0.0.1) 14.90ms referer=http://localhost:8889/tree?AnnouncementsWork has began Jan 9thInstallationBunny is going to be distribute via PyPi and as the content store grows we can expand it to other pieces of software
making it accessible to all regardless of what you use. Alternatively, you could have a glance at the source code and copy/paste
it yourself.To install the readerpython -m pip install bunnyStructure of BunnyCurrently, the main subpackages are:bunny: Bunny Main ClassGenesisBunny was created because I am forced to port forward my jupyter notebooks through a gateway server and there is no way
around it due to bureaucracy.Lead DeveloperSuliman SharifExternal links