Registry / devops / dockerflow

dockerflow

JSON →
library2026.3.4pypypi✓ verified 85d ago

Python tools and helpers for implementing Mozilla's Dockerflow standards, providing health check endpoints (__version__, __heartbeat__, __lbheartbeat__), structured logging (MozLog), and framework integrations for Django, Flask, FastAPI, Sanic, and others. Current version: 2026.3.4. Active development with monthly/quarterly releases.

pip install dockerflow
INSTALL
IMPORT
SIG · DOCKERFLOW
D
dockerflow
devopspythonv2026.3.4
Install
2.8s avg
Import
210ms
Disk
66MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2026.3.4 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.222s · 66.6MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 2.8s · import 0.199s · 67MB
66MB installed
● package 66MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

checks
from dockerflow import checks
from dockerflow.checks import *
Import the module, not individual check functions; use register_check instead.
Django
from dockerflow.django import DockerflowMiddleware, dockerflow_view
from dockerflow import DjangoDockerflow
The Django integration uses a specific middleware and view; no class named DjangoDockerflow.
FastAPI
from dockerflow.fastapi import router
from dockerflow import FastAPIRouter
FastAPI integration provides a router object, not a class.
Flask
from dockerflow.flask import Dockerflow
Used as an extension: Dockerflow(app). No common wrong import known.

Minimal Flask app with dockerflow endpoints (__version__, __heartbeat__, __lbheartbeat__) and a custom check.

from dockerflow import checks from dockerflow.flask import Dockerflow from flask import Flask app = Flask(__name__) dockerflow = Dockerflow(app) @checks.register('storage') def storage_check(config): if not some_storage_available(): return [checks.Error('storage unavailable')] return [] @app.route('/') def index(): return 'OK' if __name__ == '__main__': app.run()
Debug
Known issues
gotchaHeartbeat returns 200 even when checks issue warnings (only 5xx for errors). Reading docstrings incorrectly can lead to expecting 5xx on warnings.
fix
Treat warning results as 200 OK; only error results cause 5xx. See https://github.com/mozilla-services/python-dockerflow/issues/110
affects: all
gotchaIn Django, you must add 'dockerflow.django.middleware.DockerflowMiddleware' to MIDDLEWARE and mount the view yourself. The old `urlpatterns += [path(...)]` pattern is outdated in some docs.
fix
Add middleware and define the view URL pattern explicitly: path('__version__', dockerflow_view, name='dockerflow-version')
affects: >=2024.1.0
deprecatedThe `default_app_config` in Django apps is removed in django>3.2 and not needed for dockerflow.
fix
Remove `default_app_config` from any Django app config; it has no effect and may cause deprecation warnings.
affects: >=2022.7.0
gotchaWhen using FastAPI, the dockerflow router must be included with prefix='', or endpoints will be duplicated. Incorrect prefix leads to 404 on heartbeat endpoints.
fix
Include router as `app.include_router(router)` without prefix (defaults to '').
affects: >=2024.2.0
Errors
Common errors & fixes
ImportError: cannot import name 'DjangoDockerflow' from 'dockerflow'
Old documentation or code snippets refer to a non-existent class.
fix
Use `from dockerflow.django import DockerflowMiddleware, dockerflow_view` instead.
AttributeError: module 'dockerflow' has no attribute 'checks'
Importing the top-level package without importing the submodule.
fix
Explicitly import `from dockerflow import checks`.
RuntimeError: Unable to find a DockerflowView: No view named 'dockerflow'
Django project missing the dockerflow view URL configuration.
fix
Add URL pattern: `path('__version__', dockerflow_view, name='dockerflow-version')` and ensure middleware is added.
fastapi.exceptions.FastAPIError: Invalid args for response status code
Using FastAPI router with a prefix like '/dockerflow' which conflicts with the pre-defined endpoint paths.
fix
Include router with `prefix=''` or no prefix: `app.include_router(router)`.
Upgrade
Version history
2026.3.4latest on PyPI · released Mar 4, 2026
Audit
Dependencies

No dependency data recorded yet.

Agent activity
19 hits · last 30 days
node
16
OpenAI (training)
2
Resources
dockerflow — pip install dockerflow · libregistry