ASGI compliant boilerplate code for a Python web API. By referencing your Python classes, you'll be able to generate an OpenAPI specification automatically.
- CORS support
- OpenAPI specification with a Swagger UI
- Health check endpoint
- Redoc UI
- Docker support
- Helm Chart
- Secure headers on by default
- OpenTelemetry support
- Blueprint support to scale out your endpoints (same as Flask)
- A proper webserver instead of the framework one (which is not scalable or performant)
- Poetry
- Python 3.11+
poetry config virtualenvs.in-project true
poetry install
curl localhost:8000/healthIncluded Helm Chart for CI/CD. Default port is 8000 with hot reloading for DEV environment.
Hit http://localhost:8000/openapi.json for the specification or http://localhost:8000/docs for the Swagger UI or http://localhost:8000/redocs for the Redocs UI
| Variable | Description | Default |
|---|---|---|
| WORK_ENV | DEV, STAGE, TEST, PROD | None -> Defaults to DEV |
poetry run pytest- Generate a requirements.txt from the lock file:
poetry export --without-hashes --format=requirements.txt > requirements.txt- Build the docker image
docker build -t mydomain.com/myimage:latest .- Running
docker run \
-e WORK_ENV="PROD" \
-p 8000:8000 \
mydomain.com/myimage:latest