Skip to main content

Produce self-contained HTML reports from Python

Project description

Report Creator

License PyPI Version Python Versions

Library to assemble reports in HTML from various components using python

Features

  • Good pandas/dataframe/table support
  • Look modern
  • Allows markdown as input for text blocks
  • Allows html as input
  • A few simple components for things like metrics ("Accuracy: 87%") from a triple of key, value
  • Support for plotting figures, interactive plotly and matplotlib
  • images (styled by the library)
  • json/yaml/python code blocks with color syntax highlighting
  • Support tabs
  • Add support for any Jupyter widget, any object that renders in a notebook should render to a report
  • Add built-in easy plotting that looks stylistically consistent with the report
  • Add bookmark anchors to blocks
  • Add a Table of Contents option based on labels of top-level-blocks
  • Youtube embeds rc.Video(url: str, label: str)
  • File attachments (downloadable from page)

Example

import report_creator as rc

with rc.ReportCreator("My Report") as report:

    view = rc.Block(
        rc.Text("""It was the best of times, it was the worst of times, it was the age of wisdom, it was the age of foolishness, it was the epoch of belief, it was the epoch of incredulity, it was the season of light, it was the season of darkness, it was the spring of hope, it was the winter of despair.""", 
        label="Charles Dickens, A Tale of Two Cities"),
        rc.Group(
            rc.Metric(
                heading="Answer to Life, The Universe, and Everything",
                value="42",
            ),
            rc.Metric(
                heading="Author",
                value="Douglas Adams",
            ),   
        ),
        rc.Bar(
                px.data.medals_long(),
                x="nation",
                y="count",
                dimension="medal",
                label="Bar Chart - Olympic Medals",
        ),
        rc.Scatter(
            df=px.data.iris(),
            x="sepal_width",
            y="sepal_length",
            dimension="species",
            marginal="histogram",
            label="Scatter Plot - Iris",
        ),
    )

    report.save(view, "report.html") 

Development

conda create --name rc python=3.9
conda activate rc
pip install -r requirements.txt -U

# optionally for pretty html generation
pip install beautifulsoup4 lxml

# recommended installs for code hygiene
pip install ruff

# build "kitchen_sink" example
make

Dev Notes

  • 4/18/24 - no breaking changes, all changes should go through standard deprecation policies
  • The Blocks/Groups use css flex.
    • Blocks flow vertically (columns)
  • Groups flow horizontal (row).
  • To render math you'll need to pip install md4mathjax

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_creator-1.0.4.tar.gz (18.3 kB view details)

Uploaded Source

Built Distribution

report_creator-1.0.4-py3-none-any.whl (13.4 kB view details)

Uploaded Python 3

File details

Details for the file report_creator-1.0.4.tar.gz.

File metadata

  • Download URL: report_creator-1.0.4.tar.gz
  • Upload date:
  • Size: 18.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.11.7

File hashes

Hashes for report_creator-1.0.4.tar.gz
Algorithm Hash digest
SHA256 237a2628e67359ce290dfece984eb35e75184b6227e1d764f6561cb50794d0e6
MD5 97c18b30a56b7ffef1ea42df4d2f384e
BLAKE2b-256 e78e9a008e8d06d2325eaa58303e4aa4fb9ddec6d7f11d99e6a3affa2cd43727

See more details on using hashes here.

File details

Details for the file report_creator-1.0.4-py3-none-any.whl.

File metadata

File hashes

Hashes for report_creator-1.0.4-py3-none-any.whl
Algorithm Hash digest
SHA256 ff4001f883ff403de0bba7fe0dd8af0d1f3fa4b6c10db1940772832d43edcc8e
MD5 5153f1c570881625c4578c270ba9f3a9
BLAKE2b-256 ea24c2f07bec33bff4bf2af6b187ac670df9aac5cee7279c328e2b0dc908d613

See more details on using hashes here.

Supported by

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