Skip to main content

Create self-contained HTML reports from Python.

Project description

Report Creator

License PyPI Version Python Versions Python Stats

Logo

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) with an option to fetch at report build time (no fetch on render)
  • json/yaml/python/java 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 option to change the report icon based on a github account avatar
  • Add a metric type for timeseries data which should some aggregate function of the data, and plot over time.
  • Add diagram component with Mermaid JS
  • Write documentation!
  • Add a status metric that supports up to a handful of k/v pairs (k=task, v=status)
  • Add bookmark anchors to blocks
  • Add Footer block
  • Add log file block (https://github.com/jwodder/apachelogs) with analytics
  • Add Radar chart
  • Add choropleth map plot type
  • Youtube embeds rc.Video(url: str, label: str)
  • File attachments (downloadable any data from page)

Example

import report_creator as rc

with rc.ReportCreator(
    title="My Report",
    description="This is a report created with report_creator",
    footer="This is the footer",
) 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(
            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.12
conda activate rc
pip install -r requirements.txt -U

# recommended installs for code hygiene
pip install ruff

# build "kitchen_sink" example
make

# install local package
pip install -e .

# see dependency tree
pipdeptree --exclude pip,pipdeptree,setuptools,wheel,twine

Publish

  • run publish.sh

Dev Notes

  • 4/18/24 - no breaking changes, all changes should go through standard deprecation policies
  • To render math you'll need to pip install md4mathjax

Docs

pip install sphinx sphinx-autodoc-typehints sphinx-book-theme sphinx_copybutton sphinxcontrib-mermaid --upgrade

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.27.tar.gz (23.3 kB view details)

Uploaded Source

Built Distribution

report_creator-1.0.27-py3-none-any.whl (21.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: report_creator-1.0.27.tar.gz
  • Upload date:
  • Size: 23.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.2

File hashes

Hashes for report_creator-1.0.27.tar.gz
Algorithm Hash digest
SHA256 1f5ed168610d67c534b59ba3c07350c563024516399499b53f2f1a0ba53e99f7
MD5 91f9b1ab99fae596a40806cec1030c9f
BLAKE2b-256 410a43fadd2e126c27e5b6aa69d07fc760e6f6fff5114d7f4876b2231c459e7d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for report_creator-1.0.27-py3-none-any.whl
Algorithm Hash digest
SHA256 4d4ae362032c9169607a39bfa1240d6e63e46dbac3d1380ae3c1b5492fcbdcc1
MD5 fb4673f015042630cd561506b79b375e
BLAKE2b-256 18c6b34abb2829167c787b580338854ab9858fa6debb687e366e7770ab52cd13

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