Simple HTML and PDF document generator for Python.

GitHub - Docs - PyPI


Sharing reports is a common requirement in data science; analyses and model evaluations often need to be made available to peer reviewers, business stakeholders, and internal compliance and validation functions - among others. There are some excellent frameworks, such as Dash and Bokeh, for creating sophisticated interactive applications but when it comes to producing a self contained static document there is a surprising lack of satisfying alternatives.

This is the motivation behind esparto: a lightweight framework for producing well formatted pages with minimal effort. I like to think of it as a middle-ground between a Jupyter Notebook and a fully featured interactive dashboard.

Esparto provides a streamlined API that lets users define their page in terms of sections, rows, and columns; and an intelligent wrapping system that automatically converts Python objects into content. The grid system and components are borrowed from Bootstrap to ensure documents adapt to viewing devices with a clean and consistent style. At publishing time, the completed document is passed to Jinja2 and fed into an HTML template with all style details and dependencies captured inline. There is also the option to save the page as a PDF file through integration with Weasyprint.

Esparto supports content rendering within Jupyter Notebooks, allowing users to interactively and iteratively build documents without disrupting their workflow.

Please check out the documentation and GitHub repo if you’d like to learn more.

Examples

Iris Report - Data Analysis

Interactive Plots - Bokeh and Plotly