A python package for reports generation.
Project description
Report Generators
This Python package provides a flexible and extensible framework for generating reports in multiple formats, including XLSX (Excel), CSV, and PDF.
Features
- Generate tabular reports in XLSX, CSV, and PDF formats
- Easily extendable for new report types and formats
- Utilities for formatting text and converting workbooks to CSV
- Base classes to help you implement custom report generators
Installation
pip install report-generators
Or install from source:
pip install -e .
Usage Example
from report_generators import (
BaseCSVReportsGenerator,
BaseXLSXReportsGenerator,
BasePDFReportsGenerator,
BaseGenerator
)
# Implement your own BaseGenerator subclass for your data
class YourCustomGenerator(BaseGenerator):
def get_columns(self):
return [
("Name", 20),
("Age", 10),
("Email", 30)
]
def generate_row_fn(self, item):
return [item["name"], item["age"], item["email"]]
# Create your data
items = [
{"name": "John Doe", "age": 30, "email": "john@example.com"},
{"name": "Jane Smith", "age": 25, "email": "jane@example.com"}
]
# Initialize your generator
base_generator = YourCustomGenerator()
# Generate an XLSX report
xlsx_gen = BaseXLSXReportsGenerator("Report Title", base_generator)
xlsx_workbook = xlsx_gen.generate(items)
# Generate a CSV report
csv_gen = BaseCSVReportsGenerator("Report Title", base_generator)
csv_buffer = csv_gen.generate(items)
# Generate a PDF report
pdf_gen = BasePDFReportsGenerator("Report Title", base_generator)
pdf_buffer = pdf_gen.generate(items)
Project Structure
report_generators/
├── base_generator.py # Base class for custom report logic
├── xlsx/ # XLSX (Excel) report generator
├── csv/ # CSV report generator (inherits from XLSX)
├── pdf/ # PDF report generator
└── utils/ # Shared utilities
├── text.py # Text formatting
├── types.py # Type definitions
└── workbook_to_csv.py
Dependencies
- openpyxl>=3.1.5
- reportlab>=4.4.1
- Python 3.7+
License
MIT License
Feel free to extend or customize the generators for your own reporting needs!
Project details
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 report_generators-0.1.4.tar.gz.
File metadata
- Download URL: report_generators-0.1.4.tar.gz
- Upload date:
- Size: 315.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f92658b85396116db407210c61da19602ebc9755242e9a7c3f41b5c6e45811b4
|
|
| MD5 |
517b632f1e34758c8549a064cf569148
|
|
| BLAKE2b-256 |
cc51757e6a7c32b48ad9493ee01a5005c2855aa67a2592eaf4670ffb98d7274c
|
File details
Details for the file report_generators-0.1.4-py3-none-any.whl.
File metadata
- Download URL: report_generators-0.1.4-py3-none-any.whl
- Upload date:
- Size: 313.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.10.16
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
032b1846c47b8a25f6257ca1018193474e8fe20cbed48105164654c3e55221b4
|
|
| MD5 |
aac714aacaf4724eefa60719e4d019c8
|
|
| BLAKE2b-256 |
cfc82b93e0927e3a011c47bc3cd04162ddeb155b8fae6e8431a53e233d60c519
|