Skip to main content

GrimoirePlot is a live dashboard of plotly-compatible plots of remote data

Project description

GrimoirePlot

GrimoirePlot is a live dashboard of plotly-compatible plots of remote data

demo

Installation

uv pip install grimoireplot  # not yet on pypi, will setup ci/cd on github later on

Or install from source:

# git clone the repo
cd grimoireplot
uv sync --extra dev

Installation as a tool

uv tool install grimoireplot  # not yet on pypi, will setup ci/cd on github later on

Quick Start

1. Start the Server

grimoireplot serve --host localhost --port 8080

Then open your browser at http://localhost:8080 to see the dashboard.

2. Push Sample Plots (Test the Server)

In another terminal, push some sample plots to verify everything works:

grimoireplot push-samples --host localhost --port 8080

CLI Reference

grimoireplot serve

Start the GrimoirePlot dashboard server.

grimoireplot serve [--host HOST] [--port PORT]
Option Default Description
--host localhost Host to bind the server
--port 8080 Port to bind the server

grimoireplot push-samples

Push sample plots to test the server.

grimoireplot push-samples [--host HOST] [--port PORT] [--secret SECRET] [--grimoire-name NAME]
Option Default Description
--host localhost Server host
--port 8080 Server port
--secret IDidntSetASecret Authentication secret
--grimoire-name test_grimoire Name of the grimoire to create

grimoireplot live-test

Test live plot updates by continuously adding datapoints to a line plot.

grimoireplot live-test [--host HOST] [--port PORT] [--secret SECRET] [--grimoire-name NAME] [--interval SECONDS] [--max-points N]
Option Default Description
--host localhost Server host
--port 8080 Server port
--secret IDidntSetASecret Authentication secret
--grimoire-name live_test Name of the grimoire to create
--interval 0.2 Interval between datapoints in seconds
--max-points 0 Maximum number of points (0 = unlimited)

Programmatic Usage

Sending Plots from Python

GrimoirePlot organizes plots in a hierarchy: GrimoireChapterPlot

Synchronous API

import plotly.graph_objects as go
from grimoireplot.client import push_plot_sync

# Create a Plotly figure
fig = go.Figure()
fig.add_trace(go.Scatter(x=[1, 2, 3, 4], y=[10, 11, 12, 13], mode='lines+markers'))
fig.update_layout(title='My Plot')

# Push to the server
response = push_plot_sync(
    grimoire_name="my_experiment",
    chapter_name="training_metrics",
    plot_name="loss_curve",
    fig=fig,
    grimoire_server="http://localhost:8080",
    grimoire_secret="your-secret",
)

Asynchronous API

import asyncio
import plotly.graph_objects as go
from grimoireplot.client import push_plot

async def main():
    fig = go.Figure()
    fig.add_trace(go.Bar(x=['A', 'B', 'C'], y=[20, 14, 23]))
    fig.update_layout(title='Async Plot')

    response = await push_plot(
        grimoire_name="my_experiment",
        chapter_name="results",
        plot_name="bar_chart",
        fig=fig,
        grimoire_server="http://localhost:8080",
        grimoire_secret="your-secret",
    )

asyncio.run(main())

Integration Example: Training Loop

import plotly.graph_objects as go
from grimoireplot.client import push_plot_sync

losses = []

for epoch in range(100):
    loss = train_one_epoch()  # Your training code
    losses.append(loss)

    # Update the plot every 10 epochs
    if epoch % 10 == 0:
        fig = go.Figure()
        fig.add_trace(go.Scatter(y=losses, mode='lines', name='Training Loss'))
        fig.update_layout(title=f'Training Progress (Epoch {epoch})',
                          xaxis_title='Epoch', yaxis_title='Loss')

        push_plot_sync(
            grimoire_name="experiment_001",
            chapter_name="training",
            plot_name="loss",
            fig=fig,
        )

Configuration

GrimoirePlot can be configured via environment variables:

Variable Default Description
GRIMOIRE_SERVER http://localhost:8080 Default server URL
GRIMOIRE_SECRET IDidntSetASecret Authentication secret

You can also use a .env file in your project directory.

Testing

# you need to install with --extra dev
GRIMOIRE_TEST=true uv run pytest

Concepts

  • Grimoire: A collection of related visualizations (e.g., an experiment)
  • Chapter: A group of plots within a grimoire (e.g., training metrics, evaluation results)
  • Plot: A single Plotly figure

Acknowledgments

GrimoirePlot is inspired by visdom

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

grimoireplot-0.0.1.tar.gz (15.9 kB view details)

Uploaded Source

Built Distribution

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

grimoireplot-0.0.1-py3-none-any.whl (20.2 kB view details)

Uploaded Python 3

File details

Details for the file grimoireplot-0.0.1.tar.gz.

File metadata

  • Download URL: grimoireplot-0.0.1.tar.gz
  • Upload date:
  • Size: 15.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for grimoireplot-0.0.1.tar.gz
Algorithm Hash digest
SHA256 6cd2f97f8b5838b9389314b5c8d250b1cb275ce4b6a6ebc69b4ac0d2fcf36f34
MD5 5c1657b86e8e0a00310c0622135da2ac
BLAKE2b-256 939a040962b7a0c34c13c0a299829d72630a95b05805c68360eb77978adede84

See more details on using hashes here.

File details

Details for the file grimoireplot-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: grimoireplot-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 20.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.4 {"installer":{"name":"uv","version":"0.10.4","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for grimoireplot-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d961c936167355df06819b056e2f023e8c31f383b7ea60a1aecc621a54eadc0c
MD5 bd7dedfb6c0f45a5289d8704e569fa8d
BLAKE2b-256 f28f4c2d9ffaddc6304419d38550347b980ae258679415400694ce429bc95433

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