Skip to content

b3b/herethere

Repository files navigation

herethere

Latest version on PyPI Supported Python versions CI Status Code coverage status

Run Python interactively inside live apps and devices.

herethere starts a small SSH-backed server inside a Python process, then lets you connect from another Python session or Jupyter notebook to inspect, modify, and interact with a namespace in that running process.

It was created for workflows where Python is running inside an app, device, or environment that is awkward to interact with directly. The same idea is useful for Raspberry Pi and robotics projects, Kivy/mobile apps, containers, long-running experiments, server-side apps, and other cases where logs or a separate remote shell are not enough.

herethere is based on the AsyncSSH library. AsyncSSH provides the SSH toolkit; herethere adds a small Python and Jupyter workflow layer on top.

Code repository:https://github.com/b3b/herethere
Documentation:https://herethere.me/library

Installation

Install herethere in the Python environment that will start the server:

pip install herethere

If you want to connect from Jupyter using the IPython magics, install the magic extra in the notebook/client environment:

pip install "herethere[magic]"

Quickstart

Target process

Start herethere inside the Python process you want to interact with.

from herethere.here import ServerConfig, start_server

state = {"speed": 1}

await start_server(ServerConfig.load(prefix="here"), namespace=globals())

Jupyter notebook / client

Connect from your local Jupyter notebook:

%load_ext herethere.magic
%connect-there

Use the %%there cell magic to inspect variables, call functions, or update state while the target process keeps running:

%%there

print(state)
state["speed"] = 3
print(state)

Trust model

A connected client can execute Python code inside the target process. Treat access to herethere like access to a Python REPL running inside your app.

Use it only for development workflows where you control both sides of the connection. Do not expose it publicly or give access to untrusted users.

Related resources

  • PythonHere: an application that uses the herethere library
  • Kivy Remote Shell: a remote SSH + Python interactive shell application using Twisted
  • Twisted Manhole: interactive interpreter and direct manipulation support for Twisted

Packages

 
 
 

Contributors