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
Release files for alicorn 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| alicorn-0.0.3.tar.gz | 16.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| alicorn-0.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 40.7 kB
Release files / alicorn-0.0.3.tar.gz
| Download URL | alicorn-0.0.3.tar.gz |
|---|---|
| Size | 16.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
17729af14f5ff38bb7bc30e3856d656f1c6eb53ade4d3e376fc0ba9cc8fe392d
|
|
BLAKE2b-256 checksum How to use checksums |
25209c0d1f7beb7225aee22f07bb60174d3c2cd8c030b83c169f8e329d272c7b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.5
|
Release files / alicorn-0.0.3-py3-none-any.whl
| Download URL | alicorn-0.0.3-py3-none-any.whl |
|---|---|
| Size | 23.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6cea38a068e4ea79e9f3ea56303d9adbd12979376bd686e8e7c177b0ffa4107b
|
|
BLAKE2b-256 checksum How to use checksums |
287bdb3201e0ced9ddb7a06aa51da81cd788daf83d0ec677dd270f2bcf205da1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.1.1 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.9.1 tqdm/4.46.1 CPython/3.8.5
|