grafanalib
Library for building Grafana dashboards
What it is and what it does
grafanalib is a Python library that generates Grafana dashboard JSON from code, letting you define monitoring dashboards as Python objects instead of through Grafana's UI. It depends only on attrs and installs as a pure Python wheel with low friction. The library is designed for teams that want to version-control dashboards, reuse common patterns across multiple dashboards, and automate dashboard creation as part of infrastructure-as-code workflows.
The package is in alpha status and has been maintained since 2016, though recent activity has slowed—the last release was over a year ago and the maintainers acknowledge reduced availability. It supports Python 3.7 through 3.11 and works by letting you write Python scripts that describe dashboard structure, then using the generate-dashboard command to output JSON ready for Grafana provisioning.
Use it for:
- Version-control Grafana dashboards in Git alongside infrastructure code and application monitoring definitions
- Build reusable dashboard templates and patterns to standardize monitoring across multiple services or teams
- Automate dashboard creation in CI/CD pipelines when spinning up new environments or services
- Reduce repetition by factoring out common graph, alert, and panel configurations into Python functions
- Generate dashboards programmatically from metrics metadata or service inventory
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Generates Grafana dashboards from Python code, letting you version-control, template, and programmatically build monitoring configurations instead of editing them through the UI.
Yes, if you need to version-control and template Grafana dashboards. The low install friction, permissive license, and established community make it a solid choice for infrastructure-as-code workflows. However, be aware that maintenance is aging—last release was over a year ago and maintainers have reduced availability. Check that the library supports your Grafana version and required dashboard features before committing to it in a production pipeline.
Install
grafanalib on PyPI
pip
pip install grafanalibuv
uv add grafanalibpoetry
poetry add grafanalibInstalling grafanalib
Before you install
Low install friction with a single runtime dependency (attrs). Maintenance status is aging—last release was over a year ago and maintainers note reduced availability, though the repository remains active and the project has moderate community adoption.
License in practice
Apache License (permissive) places no restrictions on use, modification, or distribution for commercial or private projects.
Quickstart
pip install grafanalib
from grafanalib.core import Dashboard, Row, Graph
dash = Dashboard(title="My Dashboard", rows=[Row(panels=[...])])
generate-dashboard -o dashboard.json example.dashboard.py
Verify before relying
- Whether the library supports all current Grafana dashboard features and API versions
- Maintenance timeline and whether critical bugs or Grafana compatibility issues are addressed promptly
- Python 3.12+ support status (classifiers list up to 3.11)
Package facts
| License | Apache (permissive) |
| Python support | not specified |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — attrs |
| Maintenance | aging — 945 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 393,287/month — #6,999 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: grafanalib-0.7.1-py3-none-any.whl
Tags
More Monitoring packages
Wraps any iterable to display a real-time…
copyleft · top 100 on PyPI
opentelemetry-semantic-conventionsProvides generated Python code for…
permissive · top 100 on PyPI
opentelemetry-sdkProvides the reference implementation of the…
permissive · top 100 on PyPI
opentelemetry-apiProvides the abstract API and interfaces for…
permissive · top 100 on PyPI
opentelemetry-exporter-otlp-proto-httpExports OpenTelemetry observability data to an…
permissive · top 1,000 on PyPI
opentelemetry-instrumentationProvides automatic instrumentation commands and…
permissive · top 1,000 on PyPI
grafana-foundation-sdkProvides Python types, builders, and tools for…
permissive · top 15,000 on PyPI
grafana-clientA Python client library for the Grafana HTTP…
permissive · top 15,000 on PyPI
mcp-grafanaAn MCP server that exposes Grafana dashboards,…
permissive · top 15,000 on PyPI
pulumiverse-grafanaA Pulumi resource provider that lets you create…
permissive · top 15,000 on PyPI
mypy-boto3-grafanaProvides type annotations and IDE…
permissive · top 15,000 on PyPI
python-logging-lokiA Python logging handler that sends log records…
permissive · top 5,000 on PyPI
google-cloud-monitoring-dashboardsPython client library for Google Cloud…
permissive · top 15,000 on PyPI
dash-daqProvides interactive data acquisition and…
permissive · top 15,000 on PyPI
wandb-workspacesProgrammatically create and manage Weights &…
permissive · top 15,000 on PyPI
locust-pluginsExtends Locust with plugins for load testing…
permissive · top 5,000 on PyPI