Skip to main content

herethere

Project description

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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

herethere-0.2.0.tar.gz (18.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

herethere-0.2.0-py3-none-any.whl (18.5 kB view details)

Uploaded Python 3

File details

Details for the file herethere-0.2.0.tar.gz.

File metadata

  • Download URL: herethere-0.2.0.tar.gz
  • Upload date:
  • Size: 18.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.20

File hashes

Hashes for herethere-0.2.0.tar.gz
Algorithm Hash digest
SHA256 c60019a149d2f84da329616ff34cde2d6473d1f1bce699d3b0e70c80ca27d21c
MD5 5b8ac5236eef6557a1bfd75aa0b01d83
BLAKE2b-256 32f9108a004dc5de67f00cf2e86fa18bb0617852a082bc4c19bee5d8094faaf7

See more details on using hashes here.

File details

Details for the file herethere-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: herethere-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 18.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.20

File hashes

Hashes for herethere-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 62b27942c47785ecb5db8ee7894342ce85aa458ebeb0796eb0f83048f809b29b
MD5 65e009336a3e8f043853b8173bbebf6d
BLAKE2b-256 14d5f35fb06b17575fa61daf9013fe526735c522088cdaa5681c5d0923ea1b3f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page