🇧🇷 Português Brasileiro
Nós temos um resumo completo e guia de início rápido em Português Brasileiro disponível!
pyreps¶
Python report generation — CSV, XLSX, and PDF with Rust performance. :zap:
-
High Performance
Streaming pipeline with constant memory. XLSX via Rust, JSON via orjson. 500K rows using < 1 MB of RAM.
-
Easy Integration
Supports
list[dict], JSON, SQL. Optional declarative types. Ready for Django, FastAPI, Celery. -
3 Formats
CSV, XLSX, and PDF with a single API. Switch formats by changing a parameter.
-
Lightweight & No Bloat
3 runtime dependencies. No pandas, no numpy. Install and use in seconds.
Installation¶
Or with uv:
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"),
ColumnSpec(label="Customer", source="customer.name"),
ColumnSpec(label="Total", source="total", type="float",
formatter=lambda v: f"$ {v:.2f}"),
],
)
generate_report(data_source=data, spec=spec, destination="sales.csv")
Next step
Check the Quickstart for full examples for each format.
Architecture¶
graph LR
A[Data Source] --> B[InputAdapter]
B --> C[Mapping + Coercion]
C --> D[Renderer]
D --> E[CSV / XLSX / PDF]
style A fill:#e3f2fd
style E fill:#e8f5e9 The pipeline is 100% streaming for CSV and XLSX — each record is processed and discarded without accumulating in memory. PDF uses chunked streaming (O(chunk_size)); see Performance for details.