Join our webinar on Wednesday, June 26, at 1pm EDTHow Chia Mitigates Risk in the Crypto Industry.Register
Socket
Socket
Sign inDemoInstall

easyrpc

Package Overview
Dependencies
6
Maintainers
1
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    easyrpc

An easy to use rpc framework for enabling fast inter-process, inter-host communication


Maintainers
1

Readme

An easy to use rpc framework for enabling fast inter-process, inter-container, or inter-host communication

Easily share functions between hosts, processes, containers without the complexity of defining non-native python types or proxy modules.

Documentation Status PyPI version

Documentation

easyrpc.readthedocs.io

Key Features

  • No predefined proxy functions at the remote endpoints
  • Easily group and share functons among hosts / processes using Namespaces / Namespace Groups
  • Proxy functions parameters are validated as if defined locally.
  • Optional: pre-flight encyrption
  • No strict RPC message structure / size limit, within json serializable constraints

Quick Start

$ virtualenv -p python3.7 easy-rpc-env

$ source easy-rpc-env/bin/activate

(easy-rpc-env)$ pip install easyrpc

Basic Usage:

# server.py
from fastapi import FastAPI
from easyrpc.server import EasyRpcServer

server = FastAPI()

ws_server_a = EasyRpcServer(server, '/ws/server_a', server_secret='abcd1234')

@ws_server_a.origin(namespace='public')
def good_func_a(a, b, c):
    print(f"good_func_a {a} {b} {c}")
    return {"good_func_a": [a, b, c]}

# client.py
import asyncio
from easyrpc.proxy import EasyRpcProxy

async def main():
    proxy = await EasyRpcProxy.create(
        '0.0.0.0', 
        8090, 
        '/ws/server_a', 
        server_secret='abcd1234',
        'namespace='public'
    )

    good_func_a = proxy['good_func_a']
    result = await good_func_a(1, 5, 7)
    print(result)

asyncio.run(main())

Recipes

See other usage examples in Recipes

Supported Functions Features

  • async def & def
  • async generators & generators
  • *args, **kwargs
  • positional & default parmeters
  • TODO - type annotations

Common Use Cases

  • State sharing among forked workers
  • Shared Database connections / cache
  • Shared Queues
  • Worker Pooling - Easy centralization for workers and distribution of work.
  • Function Chaining

FAQs


Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc