isis-report-lib (Rust)
A Rust port of isis-report-lib:
tabular reports with hierarchical layouts, rendered to HTML, PDF, XLSX, CSV and
plain text.
The Python library remains the behavioral reference. The scripts in parity/
generate the golden fixtures in crates/isis-report-lib/tests/fixtures/golden/.
Features
| Feature | Enables |
|---|---|
pdf (enabled by cli) |
Chromium/CDP PDF backend (chromiumoxide + Tokio), pooled per process |
xlsx |
Native Excel workbook, charts, data bars and conditional formats |
email |
CSS inlining for email-friendly HTML |
sign |
Ed25519 signatures (HMAC-SHA256 is always available) |
arrow |
from_arrow / from_arrow_batch payload builders |
polars |
from_polars payload builder |
duckdb |
from_duckdb / from_duckdb_connection builders |
sqlite |
from_sqlite / from_sqlite_connection builders |
schema |
Payload JSON Schema (default) |
cli |
isis-report binary and all browser/export features |
weasyprint-cli |
Optional external weasyprint PDF shim |
Usage
use ;
let payload = from_json;
let html = render_html?;
let xlsx = generate_xlsx?;
# Ok::
PDF:
use ;
let pdf = generate_pdf?;
let options = PdfOptions ;
let pdf = generate_pdf_with?;
# Ok::
The sync API starts a private Tokio runtime; async callers should use
generate_pdf_async / generate_pdf_with_async instead. PDF generation uses a
process-wide pool of Chromium workers (one browser per worker), so consecutive
reports avoid a launch. Pages run with JavaScript disabled, service workers
bypassed and outbound HTTP(S) blocked unless allowed_hosts is set. Call
isis_report_lib::shutdown_pdf_pool() to close the workers in a long-lived
process; the CLI does this automatically. ISIS_REPORT_PDF_WORKERS (1-8)
controls the pool size and ISIS_REPORT_PDF_IDLE_SECS (default 300, 0 disables)
closes idle browsers. pdf_pool_stats() reports workers, in-flight jobs,
browser launches, renders and idle closes. Run the pdf_throughput example to
compare cold and warm renders.
debug_dir writes report.html, a full-page report.png and a real Chrome
Trace Format dump (trace.json) from CDP. It may contain report data; protect or
delete it after use.
Examples
Runnable examples are in crates/isis-report-lib/examples:
cargo run -p isis-report-lib --example quickstart
cargo run -p isis-report-lib --example inputs
cargo run -p isis-report-lib --features xlsx --example xlsx
cargo run -p isis-report-lib --example signing
cargo run -p isis-report-lib --features pdf --example pdf_throughput
The crate-level docs also include a compiling quickstart.
Input builders
#
#
from_arrow(&[RecordBatch], meta, layout)/from_arrow_batch(&RecordBatch, ...)from_polars(&DataFrame, meta, layout)from_duckdb(path, Some(query), meta, layout)orfrom_duckdb_connectionfrom_sqlite(path, query, meta, layout)orfrom_sqlite_connectionfrom_rows(columns, rows, meta, layout)for any DB-API-style driver
Dates, datetimes and decimals are kept as native Value variants; NaN is
normalized to Null.
CLI
cargo install isis-report-lib --features cli
isis-report generate report.json -o report.pdf --locale pt-BR
isis-report generate report.json -o report.xlsx
isis-report generate report.json --format csv --bom
isis-report render report.json --format html -o report.html
isis-report schema
isis-report keygen --kind hmac -o key.bin
isis-report sign report.pdf --key-file key.bin -o report.signed.pdf
isis-report verify report.signed.pdf --key-file key.bin --json
PDF flags: --page-format, --header-template, --footer-template,
--allowed-hosts (repeatable), --debug-dir.
Design
- Payload contract:
meta+ optionallayout+data, or composedsections; strict envelope validation (unknown keys fail closed). - Dynamic values: a
Valueenum compatible with JSON, with native date/datetime/decimal variants for database/columnar inputs. - Python semantics: ordering (
Nonelast), equality (10 == 10.0,True == 1),str()/repr(), truthiness andinare isolated inpyops. - Safety: no payload value is echoed in errors/logs; quotas, depth limits, data-URI-only images and strict template autoescape are part of the design.
- Locales: the 13-locale matrix (
pt-BR,en-US,pt-PT,de-DE,fr-FR,es-ES,ja-JP,ar-EG,he-IL,ru-RU,zh-CN,hi-IN,en-GB) matches Babel for numbers, currency and medium dates; locales outside the matrix use ICU4X/CLDR and may differ in edge cases.
Workspace
crates/isis-report-lib # public library + `isis-report` binary + PDF backend
crates/isis-report-pdf # compatibility facade (publish = false)
parity/ # Python fixture generators
crates/isis-report-lib/tests/fixtures/golden # generated golden fixtures
Documentation
- Python-to-Rust migration guide
- Roadmap
- Python parity audit
- Architecture Decision Records
- Release checklist
- Changelog
- Security policy
Testing
cargo test --workspace --all-features
cargo clippy --workspace --all-features --all-targets -- -D warnings
cargo fmt --all -- --check
cargo llvm-cov --workspace --all-features --summary-only -- --include-ignored --test-threads=1
The coverage command also requires Chrome because it includes the PDF e2e tests. PDF browser tests are ignored by default because they require a local Chromium/Chrome:
cargo test -p isis-report-lib --features pdf pdf_backend::tests:: -- --ignored --test-threads=1
CI runs formatting, clippy, the full test suite on Linux, the cli suite and
full Chromium PDF e2e on Windows/macOS, a dedicated Chromium PDF e2e job on
Linux, cargo-deny, and an MSRV check with Rust 1.89.
Fuzzing targets for TOON, payload/layout, HTML rendering and signatures live in
fuzz/ and run on a weekly GitHub Actions schedule.
Benchmarks
Criterion benchmarks cover shaping, HTML rendering, CSV/XLSX export and TOON parsing:
cargo bench -p isis-report-lib --features xlsx --bench pipeline
The PDF benchmark needs a local Chromium/Chrome:
cargo bench -p isis-report-lib --features pdf --bench pdf
Criterion writes HTML reports under target/criterion/. The workload matches
the Python benchmark (5 orders, 300 detail rows) so medians are comparable;
PDF timings include browser-pool warmup and should be compared on the same
machine.
CI also runs a smoke-level performance gate with generous budgets:
cargo run --release -p isis-report-lib --features cli --example perf_check
Use -- --no-pdf to skip the Chromium step locally. Budgets live in
crates/isis-report-lib/benches/budgets.json; the gate catches pathological
regressions, not small drifts.
License
MIT - see LICENSE.