Easy, minimal, PDF-able data reports with python and markdown.
Project description
bored-charts
Build easy, minimal, PDF-able data reports with markdown and python.
The idea is you do your analysis in Python, as you normally would, and dumping your figures into a nice report written in markdown is now super low-effort: you decorate the function to generate the figure (that you already wrote when doing your analysis) and it becomes available to bored-charts so you can present your findings clearly.
Minimal example
Install bored-charts and uvicorn:
pip install bored-charts uvicorn
Create your app
# main.py
from pathlib import Path
import plotly.express as px
from boredcharts import boredcharts
from boredcharts.jinja import to_html
from fastapi import APIRouter
from fastapi.responses import HTMLResponse
pages = Path(__file__).parent.absolute() / "pages"
figure_router = APIRouter()
@figure_router.get("/report/{report_name}/figure/usa_population", name="usa_population")
async def usa_population(report_name: str) -> HTMLResponse:
df = px.data.gapminder().query("country=='United States'")
fig = px.bar(df, x="year", y="pop")
return HTMLResponse(to_html(fig))
app = boredcharts(
pages=pages,
figure_router=figure_router,
)
Write a markdown report
## Populations
USA's population has been growing linearly for the last 70 years:
{{ figure("usa_population") }}
Run your app
uvicorn main:app --reload
🎉Now you can view your reports at http://localhost:8000!
Going further
A more full project structure might look like this:
my-reports
├── myreports
│ ├── pages <-- put your markdown reports here
│ │ └── example.md
│ ├── __init__.py
│ ├── app.py <-- spin up the app here
│ └── figures.py <-- define your figures here
├── README.md
└── pyproject.toml
Extensibility
The bored-charts app is just a FastAPI (ASGI) app, so you can integrate it into your existing projects or extend it as needed.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for bored_charts-0.1.2-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a606e91f04f382ccb112f52617ab3b78b555c902826129a5409844edfbe61765 |
|
MD5 | d8f7132664a9362b19b3d62722fe6b2c |
|
BLAKE2b-256 | 07a89bf749877e8764d9b4b367795d3b3b063e64db9ce51ee86604aa0d5c3ea4 |