{"library":"rpyc","title":"RPyC (Remote Python Call)","description":"RPyC (Remote Python Call) is a transparent and symmetric distributed computing library for Python. It allows remote objects to be manipulated as if they were local, making it a powerful tool for building distributed systems and remote execution. The library is actively maintained, with frequent releases addressing bug fixes, performance improvements, and security enhancements. The current version is 6.0.2.","language":"python","status":"active","last_verified":"Fri May 15","install":{"commands":["pip install rpyc"],"cli":null},"imports":["import rpyc","from rpyc.utils.server import ThreadedServer","import rpyc\n\nclass MyService(rpyc.Service):\n    # ...\n","import rpyc\n\nconn = rpyc.classic.connect('localhost', 18812)"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"# server.py\nimport rpyc\nfrom rpyc.utils.server import ThreadedServer\n\nclass MathService(rpyc.Service):\n    def on_connect(self, conn):\n        print(\"Client connected!\")\n\n    def on_disconnect(self, conn):\n        print(\"Client disconnected!\")\n\n    def exposed_fib(self, n):\n        \"\"\"Calculates the Fibonacci sequence up to n.\"\"\"\n        seq = []\n        a, b = 0, 1\n        while a < n:\n            seq.append(a)\n            a, b = b, a + b\n        return seq\n\nif __name__ == '__main__':\n    # Using a fixed port for demonstration\n    port = 18812\n    print(f\"Starting MathService on port {port}...\")\n    ts = ThreadedServer(MathService, port=port)\n    ts.start()\n\n# --- Save the above as server.py and run: python server.py ---\n\n# client.py\nimport rpyc\nimport time\n\ndef run_client():\n    host = \"localhost\" # Replace with your server's address if remote\n    port = 18812\n    try:\n        conn = rpyc.connect(host, port)\n        print(f\"Connected to RPyC server at {host}:{port}\")\n\n        # Access an exposed method on the root object\n        result = conn.root.fib(1000)\n        print(f\"Fibonacci sequence up to 1000: {result}\")\n\n        # Example of accessing a remote module (classic RPyC behavior)\n        remote_sys_version = conn.modules.sys.version\n        print(f\"Remote Python version: {remote_sys_version.splitlines()[0]}\")\n\n        conn.close()\n        print(\"Connection closed.\")\n    except ConnectionRefusedError:\n        print(f\"Error: Connection refused. Is the server running on {host}:{port}?\")\n    except Exception as e:\n        print(f\"An error occurred: {e}\")\n\nif __name__ == '__main__':\n    # Optional: Give the server a moment to start if run immediately after\n    # time.sleep(1)\n    run_client()\n","lang":"python","description":"This quickstart demonstrates a simple RPyC client-server interaction. First, save the server code as `server.py` and run it in a terminal. Then, save the client code as `client.py` and run it in another terminal to connect to the server, call a remote method, and access a remote module.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":{"tag":null,"tag_description":null,"last_tested":"2026-05-15","installed_version":"6.0.2","pypi_latest":"6.0.2","is_stale":false,"summary":{"python_range":"3.10–3.9","success_rate":100,"avg_install_s":1.7,"avg_import_s":0.12,"wheel_type":"wheel"},"results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"rpyc","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.09,"mem_mb":3.7,"disk_size":"19.4M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"rpyc","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.6,"import_time_s":0.06,"mem_mb":3.7,"disk_size":"20M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"rpyc","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.15,"mem_mb":4.2,"disk_size":"21.6M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"rpyc","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.8,"import_time_s":0.13,"mem_mb":4.2,"disk_size":"22M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"rpyc","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.14,"mem_mb":4.2,"disk_size":"13.4M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"rpyc","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.7,"import_time_s":0.15,"mem_mb":4.2,"disk_size":"14M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"rpyc","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.14,"mem_mb":5,"disk_size":"13.1M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"rpyc","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.6,"import_time_s":0.17,"mem_mb":5,"disk_size":"14M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"rpyc","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.09,"mem_mb":4,"disk_size":"18.9M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"rpyc","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.8,"import_time_s":0.08,"mem_mb":4,"disk_size":"19M"}]}}