Metadata-Version: 2.1
Name: purerpc
Version: 0.1.6
Summary: Asynchronous pure python gRPC server and client implementation using curio and hyper-h2.
Home-page: https://github.com/standy66/purerpc
Author: Andrew Stepanov
License: Apache License Version 2.0
Description: # purerpc
        
        [![Build Status](https://travis-ci.org/standy66/purerpc.png?branch=master)](https://travis-ci.org/standy66/purerpc)
        
        Asynchronous pure Python gRPC server and client implementation using
        [curio](https://github.com/dabeaz/curio) and [hyper-h2](https://github.com/python-hyper/hyper-h2)
        
        ## Requirements
        
        * CPython >= 3.6
        * PyPy >= 3.6
        
        ## Installation
        
        Latest PyPI version:
        
        ```bash
        pip install purerpc
        ```
        
        Latest development version:
        
        ```bash
        pip install git+https://github.com/standy66/purerpc.git
        ```
        
        ## protoc plugin
        
        purerpc adds `protoc-gen-purerpc` plugin for `protoc` to your `PATH` enviroment variable
        so you can use it to generate service definition and stubs: 
        
        ```bash
        protoc --purerpc_out=. --python_out=. -I. greeter.proto
        ```
        
        or, if you installed `grpcio_tools` Python package:
        
        ```bash
        python -m grpc_tools.protoc --purerpc_out=. --python_out=. -I. greeter.proto
        ```
        
        ## Usage
        
        NOTE: `greeter_grpc` module is generated by purerpc's `protoc-gen-purerpc` plugin
        
        ### Server
        
        ```python
        from greeter_pb2 import HelloRequest, HelloReply
        from greeter_grpc import GreeterServicer
        from purerpc import Server
        
        
        class Greeter(GreeterServicer):
            async def SayHello(self, message):
                return HelloReply(message="Hello, " + message.name)
        
            async def SayHelloToMany(self, input_messages):
                async for message in input_messages:
                    yield HelloReply(message=f"Hello, {message.name}")
        
        
        server = Server(50055)
        server.add_service(Greeter().service)
        server.serve()
        ```
        
        ### Client
        
        ```python
        import curio
        from greeter_pb2 import HelloRequest, HelloReply
        from greeter_grpc import GreeterStub
        from purerpc import Channel
        
        
        async def gen():
            for i in range(5):
                yield HelloRequest(name=str(i))
        
        
        async def main():
            channel = Channel("localhost", 50055)
            # This is optional, will be run automatically on the first request
            await channel.connect()
            stub = GreeterStub(channel)
        
            reply = await stub.SayHello(HelloRequest(name="World"))
            print(reply.message)
        
            async for reply in stub.SayHelloToMany(gen()):
                print(reply.message)
        
        
        if __name__ == "__main__":
            curio.run(main)
        ```
        
        You can mix server and client code, for example make a server that requests something using purerpc from another server, etc.
        
        More examples in `misc/` folder
        ## Release 0.1.6
        
        * Allow passing request headers to method handlers in request argument
        * Allow passing custom metadata to method stub calls (in metadata optional keyword argument)
        
        ## Release 0.1.5
        
        * Enforce SO_KEEPALIVE with small timeouts
        * Expose PureRPCTestCase in purerpc API for unit testing purerpc services
        
        ## Release 0.1.4
        
        * Speed up protoc plugin
        
        ## Release 0.1.3 [PyPI only]
        
        * Fix long description on PyPI
        
        ## Release 0.1.2
        
        * Fix unit tests on Python 3.7
        
        ## Release 0.1.0
        
        * Implement immediate mode
        
        ## Release 0.0.1
        
        * Initial release
        
Keywords: async,await,grpc,pure-python,pypy,network,rpc,http2
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: MacOS :: MacOS X
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Internet
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: System :: Networking
Requires-Python: >=3.6.0
Description-Content-Type: text/markdown
