Drop-in Flask health blueprint: /healthz + /readyz, ready for Huginn / UptimeRobot-style monitoring.
Project description
🩺 flask-vitals
A drop-in Flask health blueprint — /healthz (liveness) + /readyz (readiness) in two lines.
Every service needs the same two endpoints — "are you alive?" and "can you serve?" — yet everyone re-writes them, slightly differently, in every app. flask-vitals is the boring, correct version you register once:
from flask_vitals import vitals
app.register_blueprint(vitals())
…and now GET /healthz and GET /readyz answer exactly the way orchestrators
(Kubernetes), load balancers, and external monitors
(Huginn, UptimeRobot, Uptime Kuma) expect.
✨ Features
- Liveness vs. readiness, done right —
/healthzsays the process is up;/readyzsays it can actually serve (its dependencies are reachable). - Injected checks — readiness probes your DB / cache / queue via callables you provide; the library never reaches into your stack.
- Honest status codes —
/readyzreturns503with a per-check breakdown when something is down, so "up but broken" is caught. - Zero config to start, fully tunable — custom paths, an optional version string, any number of named checks.
- Tiny & typed — one module, no dependency beyond Flask,
mypy --strict, 100 % tested. MIT-licensed.
📦 Install
uv add "git+https://github.com/ClaraVnk/flask-vitals"
# or
pip install "git+https://github.com/ClaraVnk/flask-vitals"
🚀 Quickstart
from flask import Flask
from sqlalchemy import text
from flask_vitals import vitals
app = Flask(__name__)
def db_ok() -> None:
db.session.execute(text("SELECT 1")) # raises → not ready
app.register_blueprint(vitals(checks={"db": db_ok}, version="1.4.2"))
| Request | Response | Code |
|---|---|---|
GET /healthz |
{"status": "ok", "version": "1.4.2"} |
200 |
GET /readyz |
{"ready": true, "checks": {"db": true}} |
200 |
GET /readyz |
{"ready": false, "checks": {"db": false}} (db unreachable) |
503 |
A check passes unless it returns False or raises — so a one-liner like
lambda: cache.ping() is a valid check.
Options
| Argument | Default | Purpose |
|---|---|---|
checks |
{} |
{name: callable} readiness probes |
version |
None |
echoed by /healthz when set |
liveness_path |
/healthz |
liveness route |
readiness_path |
/readyz |
readiness route |
name |
"vitals" |
blueprint name (change if registered twice) |
📡 Monitoring it (e.g. with Huginn)
Point an uptime monitor at each app:
- an HTTP monitor on
…/healthz— expected status200→ is it alive? - a keyword monitor on
…/readyzcontaining"ready": true→ is it serving?
That's the UptimeRobot/Uptime-Kuma experience for any Flask app, with no bespoke health code per service.
🛠️ Develop
uv sync
uv run ruff format --check .
uv run ruff check .
uv run mypy
uv run pytest
🧱 Architecture
One module, flask_vitals.blueprint, exposing vitals(...) -> flask.Blueprint.
No global state, no dependency beyond Flask; readiness checks are injected by the
host app, so the library stays decoupled from your stack and trivially testable.
🤝 Contributing
Issues and PRs are welcome! Keep it small and tested:
uv sync- Make your change with a test.
uv run ruff format . && uv run ruff check . && uv run mypy && uv run pytest- Open a PR.
📄 License
MIT © Clara Vanacker
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 flask_vitals-0.1.0.tar.gz.
File metadata
- Download URL: flask_vitals-0.1.0.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fdec312119c0fa7442a5ba6bdd76d729c031163a35447e7f80291782ad43ae48
|
|
| MD5 |
c5cb586a294954d6efdd02e6a7b4d786
|
|
| BLAKE2b-256 |
eb5a62d7c6061d9b9fdaf18775f23a23fa0679c268eff16d0c1a62e22f8610ee
|
Provenance
The following attestation bundles were made for flask_vitals-0.1.0.tar.gz:
Publisher:
workflow.yml on ClaraVnk/flask-vitals
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
flask_vitals-0.1.0.tar.gz -
Subject digest:
fdec312119c0fa7442a5ba6bdd76d729c031163a35447e7f80291782ad43ae48 - Sigstore transparency entry: 2019077482
- Sigstore integration time:
-
Permalink:
ClaraVnk/flask-vitals@fa8edf902b452234349de168dc7c3ac9caa2a1ce -
Branch / Tag:
refs/heads/main - Owner: https://github.com/ClaraVnk
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@fa8edf902b452234349de168dc7c3ac9caa2a1ce -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file flask_vitals-0.1.0-py3-none-any.whl.
File metadata
- Download URL: flask_vitals-0.1.0-py3-none-any.whl
- Upload date:
- Size: 6.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4aea3408642c8ae63c47b94f6e2046cd86f9d849dcc2ad2eef325eb48bd2b3e2
|
|
| MD5 |
583f98baae3756faf7af26b75f6afd29
|
|
| BLAKE2b-256 |
578b6ee03f2fbaa2fba3d63d58601460af6fbda599f22f5fb23b85506e839399
|
Provenance
The following attestation bundles were made for flask_vitals-0.1.0-py3-none-any.whl:
Publisher:
workflow.yml on ClaraVnk/flask-vitals
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
flask_vitals-0.1.0-py3-none-any.whl -
Subject digest:
4aea3408642c8ae63c47b94f6e2046cd86f9d849dcc2ad2eef325eb48bd2b3e2 - Sigstore transparency entry: 2019077795
- Sigstore integration time:
-
Permalink:
ClaraVnk/flask-vitals@fa8edf902b452234349de168dc7c3ac9caa2a1ce -
Branch / Tag:
refs/heads/main - Owner: https://github.com/ClaraVnk
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
workflow.yml@fa8edf902b452234349de168dc7c3ac9caa2a1ce -
Trigger Event:
workflow_dispatch
-
Statement type: