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.
Minimal example
Install bored-charts and uvicorn:
pip install bored-charts uvicorn
Create your app:
# app.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:
<!-- pages/populations.md -->
## Populations
USA's population has been growing linearly for the last 70 years:
{{ figure("usa_population") }}
Run your app:
uvicorn app:app --reload
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
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
bored_charts-0.1.1.tar.gz
(158.1 kB
view hashes)
Built Distribution
bored_charts-0.1.1-py3-none-any.whl
(160.8 kB
view hashes)
Close
Hashes for bored_charts-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2b173cd8624e012810dcdf5bc889979451296f8523dc0fb86cf4491c80bbeeec |
|
MD5 | 378af0f7d5cc86e8d78485b2c055ae4b |
|
BLAKE2b-256 | 6253b2503258fece1dfd46de2cf577221ff0fa944efdf398663646ab403a779d |