Python report generation — CSV, XLSX, and PDF with Rust performance.
Project description
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
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 pyreps-0.2.0.tar.gz.
File metadata
- Download URL: pyreps-0.2.0.tar.gz
- Upload date:
- Size: 22.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 |
8a9dea3a2d5d929ad3a8c153a1eaa5ece2a4d35f4bb7f6f13feaf1b19b6e1c2b
|
|
| MD5 |
04491ecacd6408a17b4aa06bf497e351
|
|
| BLAKE2b-256 |
a665d5d6f7cc8bbc25af3548c159595145d4f5987b4d874a23bf5c2f2aca9107
|
Provenance
The following attestation bundles were made for pyreps-0.2.0.tar.gz:
Publisher:
publish.yml on JhonatanRian/pyreps
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyreps-0.2.0.tar.gz -
Subject digest:
8a9dea3a2d5d929ad3a8c153a1eaa5ece2a4d35f4bb7f6f13feaf1b19b6e1c2b - Sigstore transparency entry: 1391324832
- Sigstore integration time:
-
Permalink:
JhonatanRian/pyreps@1e435e72be9a9fd66be25fa928d161ff2260e815 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/JhonatanRian
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@1e435e72be9a9fd66be25fa928d161ff2260e815 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pyreps-0.2.0-py3-none-any.whl.
File metadata
- Download URL: pyreps-0.2.0-py3-none-any.whl
- Upload date:
- Size: 29.8 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 |
ec632f66917feacaae5c488a38d2f8aea4e32ad19e72c9c5d9d598af8019fb74
|
|
| MD5 |
5362a632f2ec8013ef91ca518e8db17c
|
|
| BLAKE2b-256 |
b75627905957a9bde5e4e1da4f8525be56f81275bcc77c012791f5e734181b2b
|
Provenance
The following attestation bundles were made for pyreps-0.2.0-py3-none-any.whl:
Publisher:
publish.yml on JhonatanRian/pyreps
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pyreps-0.2.0-py3-none-any.whl -
Subject digest:
ec632f66917feacaae5c488a38d2f8aea4e32ad19e72c9c5d9d598af8019fb74 - Sigstore transparency entry: 1391324888
- Sigstore integration time:
-
Permalink:
JhonatanRian/pyreps@1e435e72be9a9fd66be25fa928d161ff2260e815 -
Branch / Tag:
refs/tags/v0.2.0 - Owner: https://github.com/JhonatanRian
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@1e435e72be9a9fd66be25fa928d161ff2260e815 -
Trigger Event:
push
-
Statement type: