grimoireplot 0.0.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- grimoireplot/__init__.py +5 -0
- grimoireplot/client.py +166 -0
- grimoireplot/common.py +32 -0
- grimoireplot/create_some_plots.py +352 -0
- grimoireplot/main.py +284 -0
- grimoireplot/models.py +210 -0
- grimoireplot/server.py +90 -0
- grimoireplot/ui.py +200 -0
- grimoireplot/ui_elements.py +772 -0
- grimoireplot-0.0.1.dist-info/METADATA +217 -0
- grimoireplot-0.0.1.dist-info/RECORD +13 -0
- grimoireplot-0.0.1.dist-info/WHEEL +4 -0
- grimoireplot-0.0.1.dist-info/entry_points.txt +3 -0
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
|
+
Name: grimoireplot
|
|
3
|
+
Version: 0.0.1
|
|
4
|
+
Summary: GrimoirePlot is a live dashboard of plotly-compatible plots of remote data
|
|
5
|
+
Author: William Droz
|
|
6
|
+
Author-email: William Droz <william.droz@idiap.ch>
|
|
7
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
8
|
+
Requires-Dist: aiohttp[speedups]>=3.13.3
|
|
9
|
+
Requires-Dist: loguru>=0.7.3
|
|
10
|
+
Requires-Dist: nicegui>=3.5.0,<4
|
|
11
|
+
Requires-Dist: plotly>=6.5.2
|
|
12
|
+
Requires-Dist: python-dotenv>=1.2.1
|
|
13
|
+
Requires-Dist: requests>=2.32.5
|
|
14
|
+
Requires-Dist: sqlmodel>=0.0.31
|
|
15
|
+
Requires-Dist: pytest>=8.0 ; extra == 'dev'
|
|
16
|
+
Requires-Python: >=3.11
|
|
17
|
+
Project-URL: Home, https://github.com/idiap/GrimoirePlot
|
|
18
|
+
Provides-Extra: dev
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
|
|
21
|
+
# GrimoirePlot
|
|
22
|
+
|
|
23
|
+
*GrimoirePlot is a live dashboard of plotly-compatible plots of remote data*
|
|
24
|
+
|
|
25
|
+

|
|
26
|
+
|
|
27
|
+
## Installation
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
uv pip install grimoireplot # not yet on pypi, will setup ci/cd on github later on
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
Or install from source:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
# git clone the repo
|
|
37
|
+
cd grimoireplot
|
|
38
|
+
uv sync --extra dev
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### Installation as a tool
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
uv tool install grimoireplot # not yet on pypi, will setup ci/cd on github later on
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Quick Start
|
|
48
|
+
|
|
49
|
+
### 1. Start the Server
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
grimoireplot serve --host localhost --port 8080
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Then open your browser at `http://localhost:8080` to see the dashboard.
|
|
56
|
+
|
|
57
|
+
### 2. Push Sample Plots (Test the Server)
|
|
58
|
+
|
|
59
|
+
In another terminal, push some sample plots to verify everything works:
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
grimoireplot push-samples --host localhost --port 8080
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## CLI Reference
|
|
66
|
+
|
|
67
|
+
### `grimoireplot serve`
|
|
68
|
+
|
|
69
|
+
Start the GrimoirePlot dashboard server.
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
grimoireplot serve [--host HOST] [--port PORT]
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
| Option | Default | Description |
|
|
76
|
+
|--------|---------|-------------|
|
|
77
|
+
| `--host` | `localhost` | Host to bind the server |
|
|
78
|
+
| `--port` | `8080` | Port to bind the server |
|
|
79
|
+
|
|
80
|
+
### `grimoireplot push-samples`
|
|
81
|
+
|
|
82
|
+
Push sample plots to test the server.
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
grimoireplot push-samples [--host HOST] [--port PORT] [--secret SECRET] [--grimoire-name NAME]
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
| Option | Default | Description |
|
|
89
|
+
|--------|---------|-------------|
|
|
90
|
+
| `--host` | `localhost` | Server host |
|
|
91
|
+
| `--port` | `8080` | Server port |
|
|
92
|
+
| `--secret` | `IDidntSetASecret` | Authentication secret |
|
|
93
|
+
| `--grimoire-name` | `test_grimoire` | Name of the grimoire to create |
|
|
94
|
+
|
|
95
|
+
### `grimoireplot live-test`
|
|
96
|
+
|
|
97
|
+
Test live plot updates by continuously adding datapoints to a line plot.
|
|
98
|
+
|
|
99
|
+
```bash
|
|
100
|
+
grimoireplot live-test [--host HOST] [--port PORT] [--secret SECRET] [--grimoire-name NAME] [--interval SECONDS] [--max-points N]
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
| Option | Default | Description |
|
|
104
|
+
|--------|---------|-------------|
|
|
105
|
+
| `--host` | `localhost` | Server host |
|
|
106
|
+
| `--port` | `8080` | Server port |
|
|
107
|
+
| `--secret` | `IDidntSetASecret` | Authentication secret |
|
|
108
|
+
| `--grimoire-name` | `live_test` | Name of the grimoire to create |
|
|
109
|
+
| `--interval` | `0.2` | Interval between datapoints in seconds |
|
|
110
|
+
| `--max-points` | `0` | Maximum number of points (0 = unlimited) |
|
|
111
|
+
|
|
112
|
+
## Programmatic Usage
|
|
113
|
+
|
|
114
|
+
### Sending Plots from Python
|
|
115
|
+
|
|
116
|
+
GrimoirePlot organizes plots in a hierarchy: **Grimoire** → **Chapter** → **Plot**
|
|
117
|
+
|
|
118
|
+
#### Synchronous API
|
|
119
|
+
|
|
120
|
+
```python
|
|
121
|
+
import plotly.graph_objects as go
|
|
122
|
+
from grimoireplot.client import push_plot_sync
|
|
123
|
+
|
|
124
|
+
# Create a Plotly figure
|
|
125
|
+
fig = go.Figure()
|
|
126
|
+
fig.add_trace(go.Scatter(x=[1, 2, 3, 4], y=[10, 11, 12, 13], mode='lines+markers'))
|
|
127
|
+
fig.update_layout(title='My Plot')
|
|
128
|
+
|
|
129
|
+
# Push to the server
|
|
130
|
+
response = push_plot_sync(
|
|
131
|
+
grimoire_name="my_experiment",
|
|
132
|
+
chapter_name="training_metrics",
|
|
133
|
+
plot_name="loss_curve",
|
|
134
|
+
fig=fig,
|
|
135
|
+
grimoire_server="http://localhost:8080",
|
|
136
|
+
grimoire_secret="your-secret",
|
|
137
|
+
)
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
#### Asynchronous API
|
|
141
|
+
|
|
142
|
+
```python
|
|
143
|
+
import asyncio
|
|
144
|
+
import plotly.graph_objects as go
|
|
145
|
+
from grimoireplot.client import push_plot
|
|
146
|
+
|
|
147
|
+
async def main():
|
|
148
|
+
fig = go.Figure()
|
|
149
|
+
fig.add_trace(go.Bar(x=['A', 'B', 'C'], y=[20, 14, 23]))
|
|
150
|
+
fig.update_layout(title='Async Plot')
|
|
151
|
+
|
|
152
|
+
response = await push_plot(
|
|
153
|
+
grimoire_name="my_experiment",
|
|
154
|
+
chapter_name="results",
|
|
155
|
+
plot_name="bar_chart",
|
|
156
|
+
fig=fig,
|
|
157
|
+
grimoire_server="http://localhost:8080",
|
|
158
|
+
grimoire_secret="your-secret",
|
|
159
|
+
)
|
|
160
|
+
|
|
161
|
+
asyncio.run(main())
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
### Integration Example: Training Loop
|
|
165
|
+
|
|
166
|
+
```python
|
|
167
|
+
import plotly.graph_objects as go
|
|
168
|
+
from grimoireplot.client import push_plot_sync
|
|
169
|
+
|
|
170
|
+
losses = []
|
|
171
|
+
|
|
172
|
+
for epoch in range(100):
|
|
173
|
+
loss = train_one_epoch() # Your training code
|
|
174
|
+
losses.append(loss)
|
|
175
|
+
|
|
176
|
+
# Update the plot every 10 epochs
|
|
177
|
+
if epoch % 10 == 0:
|
|
178
|
+
fig = go.Figure()
|
|
179
|
+
fig.add_trace(go.Scatter(y=losses, mode='lines', name='Training Loss'))
|
|
180
|
+
fig.update_layout(title=f'Training Progress (Epoch {epoch})',
|
|
181
|
+
xaxis_title='Epoch', yaxis_title='Loss')
|
|
182
|
+
|
|
183
|
+
push_plot_sync(
|
|
184
|
+
grimoire_name="experiment_001",
|
|
185
|
+
chapter_name="training",
|
|
186
|
+
plot_name="loss",
|
|
187
|
+
fig=fig,
|
|
188
|
+
)
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
## Configuration
|
|
192
|
+
|
|
193
|
+
GrimoirePlot can be configured via environment variables:
|
|
194
|
+
|
|
195
|
+
| Variable | Default | Description |
|
|
196
|
+
|----------|---------|-------------|
|
|
197
|
+
| `GRIMOIRE_SERVER` | `http://localhost:8080` | Default server URL |
|
|
198
|
+
| `GRIMOIRE_SECRET` | `IDidntSetASecret` | Authentication secret |
|
|
199
|
+
|
|
200
|
+
You can also use a `.env` file in your project directory.
|
|
201
|
+
|
|
202
|
+
## Testing
|
|
203
|
+
|
|
204
|
+
```bash
|
|
205
|
+
# you need to install with --extra dev
|
|
206
|
+
GRIMOIRE_TEST=true uv run pytest
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
## Concepts
|
|
210
|
+
|
|
211
|
+
- **Grimoire**: A collection of related visualizations (e.g., an experiment)
|
|
212
|
+
- **Chapter**: A group of plots within a grimoire (e.g., training metrics, evaluation results)
|
|
213
|
+
- **Plot**: A single Plotly figure
|
|
214
|
+
|
|
215
|
+
## Acknowledgments
|
|
216
|
+
|
|
217
|
+
GrimoirePlot is inspired by [visdom](https://github.com/fossasia/visdom)
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
grimoireplot/__init__.py,sha256=A8n_3m9PiKDm1skNrlZiCojtL9fxKGAL7UoZ8uT9hGc,211
|
|
2
|
+
grimoireplot/client.py,sha256=07bo7ATQyaEEOKfqnXqLUJDNP5j3N4TzgtQmpkFpLZg,5209
|
|
3
|
+
grimoireplot/common.py,sha256=3X2gWQfBTNnKbGW5AXOCg39y0570kB7wYt245mrsL4o,872
|
|
4
|
+
grimoireplot/create_some_plots.py,sha256=XUxwsI_w7UVydDSnFSEVdGbZXAaofL6cX7pR17hJ0qU,11296
|
|
5
|
+
grimoireplot/main.py,sha256=F2F_8jEFDWJ6Isc1H-ExlF2ohFBXYIEFmEV3ojhSx_o,8718
|
|
6
|
+
grimoireplot/models.py,sha256=yPO-EX48HaInBaMYp5GNDtV_O2U0pGLEk0iD1bcrTXw,6721
|
|
7
|
+
grimoireplot/server.py,sha256=iqvLucYOgerTTCNJy6KEMoXIdGeWQ0WPdfG5j__unmI,3296
|
|
8
|
+
grimoireplot/ui.py,sha256=3CmWHqCWjCVGrrU8P_oN25hlhNTrP04YnTPkQ7OtbBg,6678
|
|
9
|
+
grimoireplot/ui_elements.py,sha256=ujfQrSpICNpwlSFWwHQy61F3-O-GpqjFaxJ6N-PD-C8,20797
|
|
10
|
+
grimoireplot-0.0.1.dist-info/WHEEL,sha256=o6xtdofIa8Zz80kUveEHMWeAWtEyZSzYS1bbyKDCgzA,80
|
|
11
|
+
grimoireplot-0.0.1.dist-info/entry_points.txt,sha256=jV8dHTRX96m_Z4J7892Dtl4mfAj9m3QhYFl-UKtrmrs,57
|
|
12
|
+
grimoireplot-0.0.1.dist-info/METADATA,sha256=wNKwhybEkNVHvm0TZtv7Q2Em9iS0VsmrNrtkzhdKEDs,5629
|
|
13
|
+
grimoireplot-0.0.1.dist-info/RECORD,,
|