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
Installation
From PyPi: pip install alicorn
or pipenv install alicorn
To Do
- Finish Documentation
- Command-Line Options
- 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
Built Distribution
alicorn-0.0.1a5-py3-none-any.whl
(23.6 kB
view hashes)
Close
Hashes for alicorn-0.0.1a5.linux-x86_64.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 814a07c80e3ba0d791151aad7ecf8f736356735b646cfe6ff1851f881bde09b9 |
|
MD5 | ef1b033473164d4fbf7654f3ad8ada27 |
|
BLAKE2b-256 | 69f13668b6b9ee7ffe81946243ac7b37bcba5017294bc09aa0ac01d6d6044ab5 |
Close
Hashes for alicorn-0.0.1a5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3f821f72e1889c365934d688f1be5d9376bc7eea6eccb200645cde956da9db5f |
|
MD5 | a317f0e9bf74e921c36a67789003e1c5 |
|
BLAKE2b-256 | b2b1194358bc153bc80bd6f756be3046900c131e13e56cf2ea02cac22a8c69f4 |