| Crates.io | dbgbb |
| lib.rs | dbgbb |
| version | 0.3.3 |
| created_at | 2024-10-13 21:31:46.144147+00 |
| updated_at | 2026-01-16 15:10:50.369902+00 |
| description | A framework for analyzing debugging data in a Mathematica/Jupyter notebook |
| homepage | |
| repository | https://github.com/YShoji-HEP/dbgbb |
| max_upload_size | |
| id | 1407700 |
| size | 49,841 |
dbgbb is a robust framework for analyzing debugging data within Mathematica and Jupyter notebooks.
Related projects: ArrayObject, BulletinBoard.
BulletinBoard for reading test data and sending debug data using concise macros.Vec<_>, [T;N], ndarray, nalgebra).sequenceDiagram
Program->>BulletinBoard: Debugging data
BulletinBoard->>Program: Test data
Program->>BulletinBoard: Debugging data
Notebook->>BulletinBoard: Request
BulletinBoard->>Notebook: Response
Program->>BulletinBoard: Debugging data
Program->>BulletinBoard: Debugging data
BulletinBoard and dbgbb is maintained for matching minor version numbers.Before using dbgbb, set up a BulletinBoard server and configure the server address via an environment variable. For Rust projects, one may add the following to .cargo/config.toml:
[env]
BB_ADDR = "ADDRESS:PORT"
Send data to the server with minimal code:
use dbgbb::dbgbb;
fn main() {
let test = vec![1f64, 2., 3.];
dbgbb!(test);
}
For nested arrays (Vec<Vec<...>>), see dbgbb_flatten!(...), dbgbb_concat!(...), and dbgbb_index!(...).
Accumulate data before transmission. Arrays must have consistent shapes.
use dbgbb::dbgbb_acc;
fn inner(i: usize) {
let some_calc = i * 2;
dbgbb_acc!("label", some_calc);
}
fn main() {
for i in 0..10 {
inner(i);
}
dbgbb_acc!("label" => post);
}
Control data acquisition frequency with oneshot or every. Rename variables with .rename(...). To reduce TCP transactions, enable buffering:
use dbgbb::*;
fn main() {
let _buf = Buffer::on(); // Buffering is active until _buf is dropped.
for i in 0..10 {
dbgbb!(oneshot => 5, i.rename("five")); // Captures data at the fifth iteration.
dbgbb!(every => 2, i.rename("zero, two, four, six, eight")); // Captures data every two iterations.
}
}
Note: Use let _buf = ... to keep the buffer active. Using let _ = ... will immediately drop the buffer.
Retrieve data from the server:
use dbgbb::dbgbb_read;
fn main() {
let test: Vec<f64> = dbgbb_read!("title");
dbg!(test);
}
| Variable | Default | Description |
|---|---|---|
| BB_ADDR | "127.0.0.1:7578" or "/tmp/bb.sock" | Address of the BulletinBoard server. Use [IP address]:[port], [hostname]:[port], or a Unix socket path. |
| BB_INTERVAL | "1000" | Minimum interval (ms) for buffered sender to transmit data. |
| BB_TIMEOUT | "3000" | Timeout (ms) for buffered sender to wait for data (for infrequent cases). |
| Feature | Description |
|---|---|
unix |
Enables Unix socket support (Unix-like OS only). |
no_compression |
Disables compression for improved performance with random floating-point data. |
ndarray_15 |
Enables support for ndarray version 0.15.x. |
ndarray_16 |
Enables support for ndarray version 0.16.x. |
ndarray_17 |
Enables support for ndarray version 0.17.x. |
nalgebra_33 |
Enables support for nalgebra version 0.33.x. |
nalgebra_34 |
Enables support for nalgebra version 0.34.x. |