Skip to main content

A python package for reports generation.

Project description

Report Generators

Version Python License

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

report_generators-0.1.3.tar.gz (10.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

report_generators-0.1.3-py3-none-any.whl (8.9 kB view details)

Uploaded Python 3

File details

Details for the file report_generators-0.1.3.tar.gz.

File metadata

  • Download URL: report_generators-0.1.3.tar.gz
  • Upload date:
  • Size: 10.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.10.16

File hashes

Hashes for report_generators-0.1.3.tar.gz
Algorithm Hash digest
SHA256 f632421488489163eb2a59d0eb338e7bcd182b141363d161dc8229c237eb42bc
MD5 285cec62b589a6e1f6cec087d19ad45a
BLAKE2b-256 a8e0f2eb32c1932e7a4bed13e91e9d4d843bbeedaa3ade0261d4cb222c3687b4

See more details on using hashes here.

File details

Details for the file report_generators-0.1.3-py3-none-any.whl.

File metadata

File hashes

Hashes for report_generators-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 8a071a0c742222741ab2ec9e2117d4813b101798585bb0eba3bca16daac45fa7
MD5 555b0eb9b19135b1056969d3512ff792
BLAKE2b-256 1caf93d1653606b5924921477c68903bd9327b3bb6786fe551fce277dcb58a95

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page