# 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:
```bash
pip install bored-charts uvicorn
```
### Create your app
```python
# main.py
from pathlib import Path
import plotly.express as px
import plotly.graph_objects as go
from boredcharts import FigureRouter, boredcharts
figures = FigureRouter()
@figures.chart("population")
async def population(country: str) -> go.Figure:
df = px.data.gapminder().query(f"country=='{country}'")
fig = px.bar(df, x="year", y="pop")
return fig
app = boredcharts(pages=Path(__file__).parent, figures=figures)
```
### Write a markdown report
```md
<!-- populations.md -->
## Populations
USA's population has been growing linearly for the last 70 years:
{{ figure("population", country="United States") }}
```
### Run your app
```bash
uvicorn main:app --reload
```
🎉Now you can view your reports at [http://localhost:8000](http://localhost:8000)!
## Going further
A more full project structure might look like this
(see the [full example here](https://github.com/oliverlambson/bored-charts/tree/main/examples/full)):
```
my-reports
├── analysis <-- do your analysis and define your figures
│  ├── __init__.py
│  ├── figures.py
│  └── ...
├── pages <-- write your markdown reports
│  ├── example.md
│  └── ...
├── app.py <-- spin up the bored-charts app
├── pyproject.toml
└── README.md
```
## Supported charting libraries
- [matplotlib](https://matplotlib.org/)
- [plotly](https://plotly.com/python/)
- [vega-altair](https://altair-viz.github.io/)
- [seaborn](https://seaborn.pydata.org/)
## 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
with existing solutions (e.g., adding authentication).
## Roadmap
See the [Github repo](https://github.com/oliverlambson/bored-charts)
Raw data
{
"_id": null,
"home_page": null,
"name": "bored-charts",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.12",
"maintainer_email": null,
"keywords": "PDF, boredcharts, chart, dashboard, graph, plotly, visualization",
"author": null,
"author_email": "Oliver Lambson <oliverlambson@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/ae/2f/dbf3690fdc4e3f41074224b3db3a6ef9035086b14255dc1a8e297c6645fd/bored_charts-0.13.1.tar.gz",
"platform": null,
"description": "# bored-charts\n\nBuild easy, minimal, PDF-able data reports with markdown and python.\n\nThe idea is you do your analysis in Python, as you normally would, and dumping your\nfigures into a nice report written in markdown is now super low-effort: you decorate\nthe function to generate the figure (that you already wrote when doing your analysis)\nand it becomes available to bored-charts so you can present your findings clearly.\n\n## Minimal example\n\nInstall bored-charts and uvicorn:\n\n```bash\npip install bored-charts uvicorn\n```\n\n### Create your app\n\n```python\n# main.py\n\nfrom pathlib import Path\n\nimport plotly.express as px\nimport plotly.graph_objects as go\nfrom boredcharts import FigureRouter, boredcharts\n\nfigures = FigureRouter()\n\n\n@figures.chart(\"population\")\nasync def population(country: str) -> go.Figure:\n df = px.data.gapminder().query(f\"country=='{country}'\")\n fig = px.bar(df, x=\"year\", y=\"pop\")\n return fig\n\n\napp = boredcharts(pages=Path(__file__).parent, figures=figures)\n```\n\n### Write a markdown report\n\n```md\n<!-- populations.md -->\n\n## Populations\n\nUSA's population has been growing linearly for the last 70 years:\n\n{{ figure(\"population\", country=\"United States\") }}\n```\n\n### Run your app\n\n```bash\nuvicorn main:app --reload\n```\n\n\ud83c\udf89Now you can view your reports at [http://localhost:8000](http://localhost:8000)!\n\n## Going further\n\nA more full project structure might look like this\n(see the [full example here](https://github.com/oliverlambson/bored-charts/tree/main/examples/full)):\n\n```\nmy-reports\n\u251c\u2500\u2500 analysis <-- do your analysis and define your figures\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 __init__.py\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 figures.py\n\u2502\u00a0\u00a0 \u2514\u2500\u2500 ...\n\u251c\u2500\u2500 pages <-- write your markdown reports\n\u2502\u00a0\u00a0 \u251c\u2500\u2500 example.md\n\u2502\u00a0\u00a0 \u2514\u2500\u2500 ...\n\u251c\u2500\u2500 app.py <-- spin up the bored-charts app\n\u251c\u2500\u2500 pyproject.toml\n\u2514\u2500\u2500 README.md\n```\n\n## Supported charting libraries\n\n- [matplotlib](https://matplotlib.org/)\n- [plotly](https://plotly.com/python/)\n- [vega-altair](https://altair-viz.github.io/)\n- [seaborn](https://seaborn.pydata.org/)\n\n## Extensibility\n\nThe bored-charts app is just a FastAPI (ASGI) app,\nso you can integrate it into your existing projects or extend it as needed\nwith existing solutions (e.g., adding authentication).\n\n## Roadmap\n\nSee the [Github repo](https://github.com/oliverlambson/bored-charts)\n",
"bugtrack_url": null,
"license": null,
"summary": "Easy, minimal, PDF-able data reports with python and markdown.",
"version": "0.13.1",
"project_urls": {
"Issues": "https://github.com/oliverlambson/bored-charts/issues",
"Repository": "https://github.com/oliverlambson/bored-charts.git"
},
"split_keywords": [
"pdf",
" boredcharts",
" chart",
" dashboard",
" graph",
" plotly",
" visualization"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "ba06e640404ff9b452a06a0d1691900e0c41365fac3c41c982f2b9d6ac647ded",
"md5": "54d99a33a403b24f2c7fc33d0030d411",
"sha256": "585c8daadd12ca8c5809a7f88fa1cc1b4cf0039231d7b6d398b969ed2a10e6f8"
},
"downloads": -1,
"filename": "bored_charts-0.13.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "54d99a33a403b24f2c7fc33d0030d411",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.12",
"size": 165252,
"upload_time": "2024-08-26T02:51:25",
"upload_time_iso_8601": "2024-08-26T02:51:25.477973Z",
"url": "https://files.pythonhosted.org/packages/ba/06/e640404ff9b452a06a0d1691900e0c41365fac3c41c982f2b9d6ac647ded/bored_charts-0.13.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "ae2fdbf3690fdc4e3f41074224b3db3a6ef9035086b14255dc1a8e297c6645fd",
"md5": "2a9ca734efd8090b11eb623793d1ee3d",
"sha256": "e129458a7f68fcd10dd5e9b498e9484db45c6c18d1084c879d27f5dce3d77bbb"
},
"downloads": -1,
"filename": "bored_charts-0.13.1.tar.gz",
"has_sig": false,
"md5_digest": "2a9ca734efd8090b11eb623793d1ee3d",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.12",
"size": 161701,
"upload_time": "2024-08-26T02:51:27",
"upload_time_iso_8601": "2024-08-26T02:51:27.324146Z",
"url": "https://files.pythonhosted.org/packages/ae/2f/dbf3690fdc4e3f41074224b3db3a6ef9035086b14255dc1a8e297c6645fd/bored_charts-0.13.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-26 02:51:27",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "oliverlambson",
"github_project": "bored-charts",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "bored-charts"
}