Emit structured benchmark records from your training and experiment scripts.
Project description
benchpress-sdk
Emit structured benchmark records from your training and experiment scripts.
benchpress-sdk is a tiny, dependency-free logging shim. You call a few
functions — start_run, log_metrics, log_device, log_artifact,
end_run — and it writes structured records to stdout, one per line, in a
simple [BENCH:<KIND>] <json> format. A runner that launches your script reads
those lines back. Because everything crosses the process boundary as text on
stdout, your script needs nothing from the runner and stays decoupled from it.
- Zero required dependencies — pure standard library at import time.
- Python 3.6+ — works in older training environments.
- Framework-agnostic — metric values from torch / numpy / plain floats are coerced for you.
Install
pip install benchpress-sdk
import benchpress
The distribution is named benchpress-sdk; you import it as benchpress.
Quickstart
import benchpress
params = benchpress.start_run(run_name="demo", params={"lr": 0.01, "epochs": 3})
benchpress.log_device("cpu")
for step in range(params["epochs"]):
loss = 1.0 / (step + 1)
benchpress.log_metrics({"loss": loss}, step=step)
benchpress.end_run("FINISHED")
Run it and the records appear on stdout:
[BENCH:START] {"run_id": "...", "run_name": "demo", ...}
[BENCH:DEVICE] {"device": "cpu", ...}
[BENCH:METRICS] {"step": 0, "metrics": {"loss": 1.0}, ...}
...
[BENCH:END] {"status": "success", "duration": ...}
Declaring inputs
A runner can inject --key=value flags. Declare each one inline, next to the
code that uses it:
from benchpress.sdk import DeclareArg
data_path = DeclareArg("data_path", str, "./data.csv", "Path to the input file")
Run standalone and the default is used; run under a runner and the injected value is picked up.
Saving synthetic arrays (optional)
save_synthetic writes an array as .npy plus a flat .csv. It needs numpy +
pandas, kept as an optional extra so the base install stays dependency-free:
pip install "benchpress-sdk[sdk]"
The wire format
One record per line on stdout:
[BENCH:<KIND>] <single-line-json>
<KIND> is one of START, DEVICE, METRICS, ARTIFACT, TAG, END.
Lines that don't match are treated as ordinary log output and passed through
untouched. Each record is flushed immediately, so a reader sees it in real
time — even across a pipe into WSL or a container.
License
Apache-2.0 — see LICENSE and NOTICE.
Learn more at benchpress.run.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file benchpress_sdk-0.1.0.tar.gz.
File metadata
- Download URL: benchpress_sdk-0.1.0.tar.gz
- Upload date:
- Size: 15.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
db8625d045afb2f74e09d7ecf4d6243df233f71b7ee67a6bf153502c86db1bef
|
|
| MD5 |
10907809298aa00f3581d5589b65f8bd
|
|
| BLAKE2b-256 |
b704c2c6ef899b45450b641a20c79766bf45029aa1d83f1faff473cc304152e4
|
Provenance
The following attestation bundles were made for benchpress_sdk-0.1.0.tar.gz:
Publisher:
release.yml on benchpress-run/benchpress-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
benchpress_sdk-0.1.0.tar.gz -
Subject digest:
db8625d045afb2f74e09d7ecf4d6243df233f71b7ee67a6bf153502c86db1bef - Sigstore transparency entry: 1734517062
- Sigstore integration time:
-
Permalink:
benchpress-run/benchpress-sdk@489f1712d2650965ce783994fc35b7f7fe4369b4 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/benchpress-run
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@489f1712d2650965ce783994fc35b7f7fe4369b4 -
Trigger Event:
push
-
Statement type:
File details
Details for the file benchpress_sdk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: benchpress_sdk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 16.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
751fe1ed0bce427192120e2f93407aefe97da218ace030baaca38e0b59c23223
|
|
| MD5 |
386a8dddf3c93a2450b0870ae140dab0
|
|
| BLAKE2b-256 |
ec9fb266604285acd351805061ad3064c96a7533e871fb24bee98d03c9c8befd
|
Provenance
The following attestation bundles were made for benchpress_sdk-0.1.0-py3-none-any.whl:
Publisher:
release.yml on benchpress-run/benchpress-sdk
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
benchpress_sdk-0.1.0-py3-none-any.whl -
Subject digest:
751fe1ed0bce427192120e2f93407aefe97da218ace030baaca38e0b59c23223 - Sigstore transparency entry: 1734517302
- Sigstore integration time:
-
Permalink:
benchpress-run/benchpress-sdk@489f1712d2650965ce783994fc35b7f7fe4369b4 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/benchpress-run
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@489f1712d2650965ce783994fc35b7f7fe4369b4 -
Trigger Event:
push
-
Statement type: