Skip to main content

Build Status Python Versions License: MIT

rpyc-async

rpyc-async is an asyncio-native fork of RPyC (Remote Python Call), a transparent library for symmetrical remote procedure calls, clustering, and distributed-computing. RPyC makes use of object-proxying, a technique that employs python’s dynamic nature, to overcome the physical boundaries between processes and computers, so that remote objects can be manipulated as if they were local.

This fork adds native async/await support: async services, async clients, and bidirectional async callbacks driven by a persistent event loop.

Relationship to upstream RPyC

Upstream project

RPyC by Tomer Filiba and contributors

Forked at

RPyC 6.0.1

This fork

rpyc-async 1.0.0 (versioned independently)

Distribution name

rpyc-async

Import name

rpyc_async (see note below)

Licence

MIT (both upstream and this fork)

The upstream commit history is preserved in this repository, so authorship and provenance of the original RPyC code remain visible in git log. See LICENSE and CONTRIBUTORS for attribution.

Installation

pip install rpyc-async

Requires Python 3.10+. The fork’s import name is rpyc_async, while upstream RPyC still uses rpyc — the two distributions can be installed side by side in the same environment. If you only need the classic synchronous API, install upstream RPyC (pip install rpyc); if you need the asyncio-native API, install this fork (pip install rpyc-async).

Existing code written for upstream can keep the shorter rpyc. spelling by aliasing the import at the top of each module:

import rpyc_async as rpyc

All examples in this README use that alias.

Platform Support

Server Selection Guide

rpyc-async provides two main server implementations. Choose based on your async requirements:

Server Type

Use When

Limitations

ThreadedServer

  • Synchronous methods

  • Unidirectional async (client→server only)

  • Simple use cases

  • Cannot support bidirectional async (async callbacks)

  • Async methods without persistent event loop will raise error

AsyncioServer

  • Bidirectional async

  • Async callbacks

  • Server calling client async methods

  • Requires asyncio event loop

  • More complex setup

Quick Examples

ThreadedServer (for simple sync/unidirectional async):

from rpyc_async import ThreadedServer, Service

class MyService(Service):
    def exposed_sync_method(self, x):
        return x * 2

server = ThreadedServer(MyService, port=18861)
server.start()

AsyncioServer (for bidirectional async with callbacks):

from rpyc_async import AsyncioServer, Service
import asyncio

class MyService(Service):
    async def exposed_async_with_callback(self, callback, value):
        # Server can call client's async callback
        result = await callback(value * 2)
        return f"Got: {result}"

async def main():
    server = AsyncioServer(MyService, port=18861)
    await server.start()
    # Server runs in background, handle other tasks
    await asyncio.sleep(3600)  # or other async work

asyncio.run(main())

Client for AsyncioServer — use await rpyc.async_connect(...), NOT rpyc.connect():

import rpyc_async as rpyc
import asyncio

async def main():
    conn = await rpyc.async_connect("localhost", 18861)
    try:
        # Native async method — just await.
        result = await conn.root.some_async_method(42)
        # Sync remote method? Wrap with rpyc.async_() to stay event-driven.
        # Keep the wrapper in a variable: it is cached behind a weak ref.
        a_sync = rpyc.async_(conn.root.some_sync_method)
        sync_result = await a_sync(42)
    finally:
        await conn.aclose()   # not conn.close() — that blocks the loop

asyncio.run(main())

rpyc.connect() is synchronous — it blocks socket.connect and every later sync_request on the calling thread. From inside an asyncio event loop it now raises RuntimeError pointing at rpyc.async_connect. See docs/DESIGN_ASYNC_CONNECT_POLICY.md.

For more details on async support, see docs/LIMITATIONS.md.

https://raw.githubusercontent.com/rr-develop/rpyc_async/main/docs/_static/screenshot.png

A screenshot of a remote client connecting to a server.

Note that text written to the server’s stdout is actually printed on the server’s console.

Documentation

Documentation for classic synchronous RPyC lives at https://rpyc.readthedocs.io

Download files

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

Source Distribution

rpyc_async-1.0.0.tar.gz (123.6 kB view details)

Uploaded Source

Built Distribution

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

rpyc_async-1.0.0-py3-none-any.whl (139.5 kB view details)

Uploaded Python 3

File details

Details for the file rpyc_async-1.0.0.tar.gz.

File metadata

  • Download URL: rpyc_async-1.0.0.tar.gz
  • Upload date:
  • Size: 123.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for rpyc_async-1.0.0.tar.gz
Algorithm Hash digest
SHA256 6ad2fe44b3c48f183f306906ef956c724147c0810219cdd83bd11b984d2cb60b
MD5 e3229e629b1fc7bd7e4b86053dda4739
BLAKE2b-256 327cba62b9da3790966de7aa81e098db7d397ea5a62bbc79ac864c0b7949f878

See more details on using hashes here.

Provenance

The following attestation bundles were made for rpyc_async-1.0.0.tar.gz:

Publisher: publish.yml on rr-develop/rpyc_async

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rpyc_async-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: rpyc_async-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 139.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for rpyc_async-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1dc3a8af0c9b927cdf62832a7eda860d55c1f6aecf3c0e88facaa9d0eec64b96
MD5 2deaf5625d9a4fa12625d1fa2839dea9
BLAKE2b-256 7a5369c79c463b6b219f4d697893daf92ea98f1897eab0b5f0b88e717d7501c0

See more details on using hashes here.

Provenance

The following attestation bundles were made for rpyc_async-1.0.0-py3-none-any.whl:

Publisher: publish.yml on rr-develop/rpyc_async

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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