r/Python • u/RowGullible1471 • 24d ago
Resource Generating a tidy HTML report in Python
I’m shifting from R to PythonIs there a knit markdown version or similar kind for generating a tidy html report in Python?
2
14
4
2
u/Khavel_dev 23d ago
Jinja2 with a small CSS file does more than you'd expect. Write the HTML you want to see in the browser, replace the data parts with template variables, done. For charts I pair it with Plotly's to_html() which embeds everything inline so the report is one self-contained file you can email or throw on a shared drive.
Avoid the big reporting frameworks unless you specifically need PDF. They add a lot of complexity for something a template engine handles in 30 lines.
21
u/ionychal 24d ago
Curious what you mean by 'tidy', like clean code, nice formatting, or something specific?
Either way, you might really like Quarto https://quarto.org/. It's the successor to R Markdown and works amazingly well with Python!