execnet: Distributed Python Deployment and Communication

2.1.2 · maintenance · verified Sat Mar 28

execnet is a Python library that provides carefully tested means to ad-hoc interact with Python interpreters across different versions, platforms, and network barriers. It offers a minimal and fast API for distributing tasks to local or remote processes, writing hybrid multi-process applications, and administering multiple hosts. The project is currently in maintenance-only mode, with a focus on bug fixes, and is not recommended for new projects. The current stable version is 2.1.2, with releases driven by bug fixes and Python version compatibility updates.

Warnings

Install

Imports

Quickstart

This quickstart demonstrates creating a local subprocess gateway, executing code on it, and establishing bidirectional communication using a channel. The remote code sends a message, which is received locally, and then a message is sent back to the remote before closing the connection.

import execnet

gateway = execnet.makegateway()
channel = gateway.remote_exec("channel.send('hello from remote!')")
message = channel.receive()
print(f"Received from remote: {message}")
channel.send('hello from local!')
channel.waitclose()
gateway.exit()

view raw JSON →