Skip to main content

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


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)

Uploaded Source

Built Distribution

bored_charts-0.1.1-py3-none-any.whl (160.8 kB view hashes)

Uploaded Python 3

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