From ff1ebc76f6d98c6a2e807d9604f67e471ea4cf8a Mon Sep 17 00:00:00 2001 From: Thykof Date: Mon, 13 Jul 2026 20:09:56 +0200 Subject: [PATCH] force Agg matplotlib backend + miner-facing polish - backtest.py: charts render in worker threads; the default GUI backend on macOS can only run on the main thread, so every chart failed there. Force the non-interactive Agg backend before importing pyplot. - pyproject: fill the placeholder description. - README: back-link to the synth-subnet miner tutorial (the repo is now linked from the miner getting-started docs and synthdata.co/miners). Co-Authored-By: Claude Fable 5 --- README.md | 2 ++ pyproject.toml | 2 +- synth_lib/backtester/backtest.py | 6 ++++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 078af27..85459f7 100644 --- a/README.md +++ b/README.md @@ -3,6 +3,8 @@ Tools for downloading minute-level market data and backtesting miners against [Synth Subnet](https://github.com/synthdataco/synth-subnet) scoring. +New to mining on SN50? Start with the [miner tutorial](https://github.com/synthdataco/synth-subnet/blob/main/docs/miner_tutorial.md) — backtesting is step 2.3 of that journey. + The library is organised into two pieces: - [synth_lib/preparation/market_data.py](synth_lib/preparation/market_data.py) — downloads diff --git a/pyproject.toml b/pyproject.toml index 496a7e0..cceb5b6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -9,7 +9,7 @@ packages = ["synth_lib"] [project] name = "synth-lib" version = "0.1.0" -description = "Add your description here" +description = "Market-data preparation and validator-faithful backtesting for Synth Subnet miners" readme = "README.md" requires-python = ">=3.12" dependencies = [ diff --git a/synth_lib/backtester/backtest.py b/synth_lib/backtester/backtest.py index 3207e37..bff8762 100644 --- a/synth_lib/backtester/backtest.py +++ b/synth_lib/backtester/backtest.py @@ -19,6 +19,12 @@ from pathlib import Path from typing import Any +import matplotlib + +# Charts are rendered inside worker threads; GUI backends (the macOS default) +# can only run on the main thread, so force the non-interactive Agg backend. +matplotlib.use("Agg") + import matplotlib.pyplot as plt import numpy as np import pandas as pd