Skip to main content

Serve pandas DataFrames as Grafana-compatible JSON APIs

Project description

📊 GrafanaPy

GrafanaPy is a Python package that allows you to seamlessly expose a pandas.DataFrame via a FastAPI server and visualize it in Grafana using the JSON API and ECharts plugins.

Perfect for Python developers and data professionals who want to connect their Python data directly to Grafana dashboards.


✨ Features

  • 📦 Serve Pandas DataFrames as JSON endpoints
  • ⚡ Auto-generate ECharts configs for quick visualizations
  • 🔌 Compatible with Grafana’s JSON API & ECharts plugins
  • 🧪 Easy to test locally, no DB or external API required

📦 Installation

1. Clone or Download the Repo

git clone https://github.com/yourusername/grafanapy.git
cd grafanapy

2.Install Python Dependencies

pip install fastapi uvicorn pandas

3. ▶️ Running the Server

Create a test script like test_grafana_server.py

import pandas as pd
from grafanapy.server import start_server

df = pd.DataFrame({
    "time": pd.date_range(end=pd.Timestamp.now(), periods=10, freq="H"),
    "value": [i**0.5 for i in range(10)]
})

start_server(df)

Then run it:

python test_grafana_server.py

You should see:

Serving Grafana-compatible data at http://localhost:8000/data and /echarts

4. 📥 Install and Set Up Grafana

official instructions

Grafana will run at: http://localhost:3000

(Default login: admin / admin)

4. 🔌 Install Required Grafana Plugins

✅ JSON API Plugin 📊 ECharts Panel Plugin (Optional)

Restart Grafana if needed: sudo systemctl restart grafana-server


5.⚙️ Add JSON API as Data Source

Go to Configuration → Data Sources

Click Add data source

Select JSON API

Configuration:

Name FastAPI Data

URL http://localhost:8000

Access Server (default)

Click Save & Test

You should see: ✅ Data source is working

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

grafanapy-0.2.0.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

grafanapy-0.2.0-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

Details for the file grafanapy-0.2.0.tar.gz.

File metadata

  • Download URL: grafanapy-0.2.0.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.4

File hashes

Hashes for grafanapy-0.2.0.tar.gz
Algorithm Hash digest
SHA256 2b9f3aaf829c1854c3132e3abbb95ba2481727fec7655d3ed24b0ef27007b0f9
MD5 18b9886c6be2e7094c65cb262f76bbd7
BLAKE2b-256 1de2d8e7824480c298a915faecc45f73b56d2ea4b17790adbd6949df711f29a3

See more details on using hashes here.

File details

Details for the file grafanapy-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: grafanapy-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 3.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.4

File hashes

Hashes for grafanapy-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 2b642745f1e2e1bf9e6642121edca7273ed52b0b1e61f48265919e609e03dbd1
MD5 106b2e9cfd15da6d1aa46843444c1928
BLAKE2b-256 2ff9e29112e9cfdfd7b2abc4ac6a736067f0456c229452554797adcfdafff052

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page