A grpc framework
Project description
Alicorn
Alicorn is a Python grpc framework with built in dependency injection and middleware management.
NB: This project is in alpha status at the moment, some functionality may be missing.
from alicorn import Alicorn, GrpcContext, Depends
from helloworld_pb2 import HelloWorldRequest, HelloWorldResponse
from helloworld_pb2_grpc import HelloWorldServicer
app = Alicorn()
app.debug = True
class Database:
pass
@app.service
class HelloWorld(HelloWorldServicer):
def SayHello(self, request: HelloWorldRequest, context: GrpcContext, *, database: Database = Depends()):
return HelloWorldResponse(message=f"Hello {request.name}")
if __name__ == '__main__':
app.run()
Features
- Dependency Injection
- before_request, after_request, after_request_teardown request handlers
- .proto defined grpc services or python-defined grpc services
- Extension Support
Planned Future Features
- Incoming data validation (using proto rules)
- More internal extensions
- Other grpc server support (besides the Google implementation)
Requirements
- Python 3.7+
- grpcio
To Do
- Finish Documentation
- Command-Line Options
- Release on PyPi
- Better examples
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
alicorn-0.0.1a4.tar.gz
(16.5 kB
view hashes)
Built Distribution
alicorn-0.0.1a4-py3-none-any.whl
(23.5 kB
view hashes)
Close
Hashes for alicorn-0.0.1a4-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f284f16f0ab2e6abae6216d2ec117696b05ff11d55a17c78fa14c0952a0b1eeb |
|
MD5 | c12c7a743c8a315ff2dc8e7d4717d9ca |
|
BLAKE2b-256 | 449d9683cb1b4f4ad16c27c72801524e94f06df81cab3aef29f3ad4cd60d86f5 |