pyreps
Python report generation — CSV, XLSX, and PDF with Rust performance. ⚡
Documentation · PyPI · Issues
✨ Highlights
- 🚀 High Performance — 100% streaming pipeline. CSV and XLSX use < 1 MB of RAM with 500K+ rows.
- 🦀 Powered by Rust — XLSX via
rustpy-xlsxwriter, JSON viaorjson. - 📄 3 Formats — CSV, XLSX, and PDF with a single API.
- 🔌 Pluggable — Supports
list[dict], JSON, SQL, or any custom source. - 🎯 Declarative Types — Automatic coercion for
int,float,bool,date,datetime. - 🪶 Lightweight — 3 runtime dependencies. No pandas, no numpy.
Installation
pip install pyreps
Quickstart
from pyreps import ColumnSpec, ReportSpec, generate_report
# data sample
data = [
{"id": 1, "customer": {"name": "Ana"}, "total": 100.50},
{"id": 2, "customer": {"name": "Bruno"}, "total": 250.00},
]
spec = ReportSpec(
output_format="csv", # or "xlsx" or "pdf"
columns=[
ColumnSpec(label="ID", source="id", type="int", required=True),
ColumnSpec(label="Customer", source="customer.name"),
ColumnSpec(label="Total", source="total", type="float",
formatter=lambda v: f"$ {v:.2f}"),
],
)
path = generate_report(data_source=data, spec=spec, destination="sales.csv")
Supported Formats
| Format | Renderer | Engine | Streaming |
|---|---|---|---|
| CSV | CsvRenderer |
csv stdlib (C) |
✅ Constant memory |
| XLSX | XlsxRenderer |
rustpy-xlsxwriter (Rust) |
✅ Constant memory |
PdfRenderer |
reportlab (C) |
⚠️ Materializes (layout) |
Data Sources
| Source | Adapter | Detection |
|---|---|---|
list[dict] / generator |
ListDictAdapter |
Automatic |
| JSON string / bytes | JsonAdapter |
Automatic |
dict / Mapping |
JsonAdapter |
Automatic |
| SQL query | SqlAdapter |
Explicit |
| Custom | Implement InputAdapter |
Explicit |
Declarative Types
ColumnSpec(label="Created", source="created_at", type="date")
ColumnSpec(label="Active", source="active", type="bool") # "yes" → True
ColumnSpec(label="Total", source="total", type="float") # "3.14" → 3.14
Types: str, int, float, bool, date, datetime. Optional — type=None maintains pass-through.
XLSX — Column Widths
spec = ReportSpec(
output_format="xlsx",
columns=[...],
metadata={
"xlsx": {
"width_mode": "auto", # "manual" | "auto" | "mixed"
"sheet_name": "Sales",
"columns": {
"ID": {"width": 8.0},
"Description": {"min_width": 20.0, "max_width": 50.0},
},
}
},
)
SQL
from pyreps import SqlAdapter
generate_report(
data_source=None,
spec=spec,
destination="sales.csv",
input_adapter=SqlAdapter(
query="SELECT id, name, total FROM sales",
connection=connection,
),
)
Performance
Benchmark with 6 columns and declarative types:
| Format | 500K rows | Peak RAM | rows/s |
|---|---|---|---|
| CSV | 2.39s | 51.11 MB | ~209K |
| XLSX | 4.37s | 51.11 MB | ~114K |
Memory usage remains stable (approx. 51MB process baseline) regardless of volume due to the 100% streaming pipeline.
Documentation
📖 Complete documentation at JhonatanRian.github.io/pyreps
License
MIT
Metadata
Release files for pyreps 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| pyreps-0.2.0.tar.gz | 22.3 kB | With provenance | Details for pyreps-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| pyreps-0.2.0-py3-none-any.whl | Python 3 | none | any | Details for pyreps-0.2.0-py3-none-any.whl |
Total release size: 52.1 kB
Release files / pyreps-0.2.0.tar.gz
| Download URL | pyreps-0.2.0.tar.gz |
|---|---|
| Size | 22.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8a9dea3a2d5d929ad3a8c153a1eaa5ece2a4d35f4bb7f6f13feaf1b19b6e1c2b
|
|
BLAKE2b-256 checksum How to use checksums |
a665d5d6f7cc8bbc25af3548c159595145d4f5987b4d874a23bf5c2f2aca9107
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 26, 2026.
Transparency logRelease files / pyreps-0.2.0-py3-none-any.whl
| Download URL | pyreps-0.2.0-py3-none-any.whl |
|---|---|
| Size | 29.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ec632f66917feacaae5c488a38d2f8aea4e32ad19e72c9c5d9d598af8019fb74
|
|
BLAKE2b-256 checksum How to use checksums |
b75627905957a9bde5e4e1da4f8525be56f81275bcc77c012791f5e734181b2b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 26, 2026.
Transparency logSecurity for pyreps 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for pyreps-0.2.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 26, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.