skillfed

grafanalib

Library for building Grafana dashboards

grafanalib v0.7.1 393.3K downloads/30d#6,999 on PyPI1,971
Permissive license Apache AGING released

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 grafanalib

uv

uv add grafanalib

poetry

poetry add grafanalib

Installing 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

Development Status :: 3 - AlphaEnvironment :: ConsoleIntended Audience :: DevelopersIntended Audience :: System AdministratorsLicense :: OSI Approved :: Apache Software LicenseProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.7Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: System :: Monitoring

Tags

grafana dashboard as codepython grafana automationversion control dashboardsgrafana json generationinfrastructure monitoring templatesdashboard configuration pythongrafana provisioning library
infrastructure-as-codegrafana-automationdashboard-templating

More Monitoring packages

tqdm

Wraps any iterable to display a real-time…

copyleft · top 100 on PyPI

opentelemetry-semantic-conventions

Provides generated Python code for…

permissive · top 100 on PyPI

opentelemetry-sdk

Provides the reference implementation of the…

permissive · top 100 on PyPI

opentelemetry-api

Provides the abstract API and interfaces for…

permissive · top 100 on PyPI

opentelemetry-exporter-otlp-proto-http

Exports OpenTelemetry observability data to an…

permissive · top 1,000 on PyPI

opentelemetry-instrumentation

Provides automatic instrumentation commands and…

permissive · top 1,000 on PyPI

grafana-foundation-sdk

Provides Python types, builders, and tools for…

permissive · top 15,000 on PyPI

grafana-client

A Python client library for the Grafana HTTP…

permissive · top 15,000 on PyPI

mcp-grafana

An MCP server that exposes Grafana dashboards,…

permissive · top 15,000 on PyPI

pulumiverse-grafana

A Pulumi resource provider that lets you create…

permissive · top 15,000 on PyPI

mypy-boto3-grafana

Provides type annotations and IDE…

permissive · top 15,000 on PyPI

python-logging-loki

A Python logging handler that sends log records…

permissive · top 5,000 on PyPI

google-cloud-monitoring-dashboards

Python client library for Google Cloud…

permissive · top 15,000 on PyPI

dash-daq

Provides interactive data acquisition and…

permissive · top 15,000 on PyPI

wandb-workspaces

Programmatically create and manage Weights &…

permissive · top 15,000 on PyPI

locust-plugins

Extends Locust with plugins for load testing…

permissive · top 5,000 on PyPI