Skip to main content

A rpc framework based on gevent/protobuf

Project description

A handy toolset.


  • low level transport/protocol

  • high level stream/websocket

  • rpc support

  • custom combination of transport and protocol

  • useful ErrorManager

  • useful settings module

  • pluggable extensions, such as MiddlewareManager

  • handy pymaid console script

  • best effort performance

  • keep simple for use


pip install -U pymaid


import pymaid
from import Stream

class Stream(Stream):

    def data_received(self, data):
        # cannot use asynchronous way since this is in io callback

async def main():
    ch = await
        'tcp://', transport_class=Stream
    async with ch:
        await ch.serve_forever()

if __name__ == "__main__":
import pymaid
from import Stream

class Stream(Stream):

    def init(self):
        self.data_size = 0

    def data_received(self, data):
        self.data_size += len(data)

async def wrapper(address, count):
    stream = await, transport_class=Stream)

    for _ in range(count):
        await stream.write(b'a' * 1000)
    await stream.wait_closed()
    assert stream.data_size == 1000 * count, (stream.data_size, 1000 * count)

async def main():
    tasks = []
    address = 'tcp://'
    for x in range(100):
        tasks.append(pymaid.create_task(wrapper(address, 1000)))

    # await pymaid.wait(tasks, timeout=args.timeout)
    await pymaid.gather(*tasks)

if __name__ == "__main__":

Project details

Download files

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

Source Distribution

pymaid-1.0.0a3.tar.gz (78.8 kB view hashes)

Uploaded source

Built Distributions

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page