rmote

rmote runs Python functions through SSH, docker exec, kubectl exec, a local Python process, or another bidirectional stream connected to Python. See Transports for the common model, including prepared nc relays. Built-in tools manage files, commands, packages, services, and users. You can also define your own tools and return Python values from them.

Install rmote locally with Python 3.11 or newer:

python -m pip install rmote

The target needs Python 3.11 or newer but no rmote installation. rmote sends tool code over the connection when it is first used. Package and service tools require their system commands and sufficient permissions on the target.

To operate without an agent, rmote runs standard python3 -qui on the target:

  • -q (quiet): suppresses Python’s startup banner and copyright notices.

  • -u (unbuffered): forces unbuffered stdout/stderr streams for instant packet delivery.

  • -i (interactive): reads and executes statements from stdin even without a TTY.

A free-threaded interpreter works on both sides. rmote has no compiled extension, and it guards the state it shares between threads with its own locks. The tests cover 3.13t and 3.14t on Linux and macOS.

Start with a Deployment

Follow the Quickstart to deploy a Redis cache in a disposable Docker container. You will install a package, render a systemd unit, start the service, and check that it works. The deployment code also works over SSH by replacing the connector.

Choose a Guide

Task

Guide

Connect through SSH, containers, local Python or another byte stream

Transports

Write a remote operation and return Python data

Writing Tools

Explore a host from a Python console

Python REPL

Collect and cache host state

Facts

Apply an operation to several hosts

Work with Multiple Hosts

Synchronize file contents in either direction

FileSync

Synchronize files or trees from the command line

File and directory synchronization

Render a configuration file

Templating

Write and transfer a custom template filter

Writing template filters

Find a built-in operation

Built-in Tools

Configure synchronous connections and deadlines

Synchronous Connection

Use connections from an async application

Protocol and Tool Support

Understand code transfer, state, and cancellation

Concepts

Use rmote.sync.Connection for synchronous scripts and rmote.protocol.Protocol for async applications. Both clients call the same tools. Use rmote only with trusted hosts and tool code: the target executes transferred Python, and the client unpickles returned data.

User Guide

Releases