No project description provided
Project description
keda-dispatcher
Local dev setup with FastAPI/Redis/S3-compatible storage.
Built-in routes
create_app always includes the built-in /proc routes (see keda_dispatcher/api/proc.py). Passing extra_routers just adds more routers on top; it does not remove the defaults.
Configuration (env vars)
These map directly to keda_dispatcher.settings.Settings:
| Env | Default | Notes |
|---|---|---|
| APP_TITLE | ProcGate | API title |
| APP_VERSION | package __version__ |
API version |
| ENABLE_DOCS | false | Set to true to show Swagger/Redoc |
| ROOT_PATH | (empty) | Prefix for reverse proxies (e.g. /api) |
| HOST | 0.0.0.0 | Uvicorn host |
| PORT | 8080 | Uvicorn port |
| WORKERS | 1 | Uvicorn workers |
| LOG_LEVEL | info | Uvicorn log level |
| RELOAD | false | Uvicorn reload flag |
| REDIS_URL | redis://localhost:6379/0 | Required |
| QUEUE_KEY | queue:jobs | Redis list key for jobs |
| R2_ENDPOINT_URL | (empty) | Cloudflare R2 endpoint |
| R2_ACCESS_KEY_ID | (empty) | R2 access key |
| R2_SECRET_ACCESS_KEY | (empty) | R2 secret key |
| R2_BUCKET | proc-data | R2 bucket |
| EXTRA_API_MODULES | (empty) | Comma-separated pkg.module:router_or_factory list |
CLI flags (e.g. --host, --port, --workers, --log-level, --reload, --extra-router) override env values at startup.
Adding external APIs (APIRouter)
Pass routers via CLI (no env needed):
poetry run keda-dispatcher \
--extra-router myapp.extra:router \
--extra-router myapp.health:get_router \
--host 0.0.0.0 --port 8080
router_or_factorycan be anAPIRouterinstance or a zero-arg factory returning one.--extra-routeris repeatable; values are passed tocreate_appasextra_routers.
Example: start from an external script __main__
Minimal __main__ that injects extra routers and runs uvicorn:
# myservice/__main__.py
import uvicorn
from keda_dispatcher.settings import Settings
from keda_dispatcher.app_factory import create_app
from myapp.api import router as custom_router
from myapp.health import get_router
def main():
settings = Settings.from_env()
extra = [custom_router, get_router()]
app = create_app(settings, extra_routers=extra)
uvicorn.run(app, host=settings.host, port=settings.port, reload=settings.reload)
if __name__ == "__main__":
main()
Run:
python -m myservice
Quick demo
Run:
bash run_demo.sh
Details and code live in tutorials/external_api.md, tutorials/custom_api.py, tutorials/health.py, and run_demo.sh.
CI/CD
- Tests:
.github/workflows/test.yml(runs onmain/devand PRs, matrix on Python 3.10–3.12, executespoetry run pytest) - Publish:
.github/workflows/publish.yml(runs on GitHub Releases published event;poetry publish --buildto PyPI) - Publishing needs a repo secret
PYPI_API_TOKEN(a PyPI token likepypi-AgENd...). If the token is missing, publish is skipped with a log message.
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file keda_dispatcher-0.1.2b0.tar.gz.
File metadata
- Download URL: keda_dispatcher-0.1.2b0.tar.gz
- Upload date:
- Size: 13.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.14 Linux/6.11.0-1018-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
14682705b6768de78960e2fea0d0c7794fc0aabcd473b25bd83f619fa4b2b8f8
|
|
| MD5 |
e2a874c04fe08bd7748b63c39e3e6c6c
|
|
| BLAKE2b-256 |
e21eb92aafe9d2cc57e8e156f1b6ea766bd9f8b5f706c11936447207babf76ae
|
File details
Details for the file keda_dispatcher-0.1.2b0-py3-none-any.whl.
File metadata
- Download URL: keda_dispatcher-0.1.2b0-py3-none-any.whl
- Upload date:
- Size: 16.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.8.3 CPython/3.11.14 Linux/6.11.0-1018-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c0dc20fa6c96701b2afeb7f1ecc3f2717a996cf0384c310511b0bbd189c6712c
|
|
| MD5 |
8928480621856ca739e200ca39a45e1b
|
|
| BLAKE2b-256 |
4cc1a085ae152093ffab1242e90ff6d4ce1dff96c973487b490172d026601df6
|