Panel dashboard for Hledger
|
Faiz Jazadi
b60b688f04
- Interactive financial analytics dashboard using Panel (HoloViz) - Wraps hledger CLI with Python API, outputs Pandas DataFrames - Configurable settings via pydantic-settings (.env support) - Websocket origin and host configuration via CLI or settings - Includes balance sheet, income/expenses, cashflow, fuel/travel views |
||
|---|---|---|
| hledger_panel | Initial commit: hledger-panel financial dashboard | |
| tests | Initial commit: hledger-panel financial dashboard | |
| .env.example | Initial commit: hledger-panel financial dashboard | |
| .gitignore | Initial commit: hledger-panel financial dashboard | |
| AGENTS.md | Initial commit: hledger-panel financial dashboard | |
| pyproject.toml | Initial commit: hledger-panel financial dashboard | |
| README.md | Initial commit: hledger-panel financial dashboard | |
| uv.lock | Initial commit: hledger-panel financial dashboard | |
hledger-panel
Interactive financial dashboard for hledger, a command-line accounting tool.
Features
- Balance Sheet: Historical account balances over time
- Cashflow: Balance changes across accounts
- Income vs. Expenses: Periodic income and expense analysis
- Extensible: Easy to add new dashboard modules
- Responsive: Works on desktop and mobile
Installation
With uv (recommended)
cd /path/to/personal-hledger
uv sync
uv run hledger-panel serve
With pip
cd /path/to/personal-hledger
pip install -e .
hledger-panel serve
Quick Start
-
Set your ledger file (in
.mise.tomlor shell):export LEDGER_FILE=/path/to/ledger -
Start the dashboard:
hledger-panel serve # or: python -m hledger_panel.dashboard.serve -
Open your browser to
http://localhost:5006
Development
Setup
uv sync
Run dashboard
uv run hledger-panel serve
Lint code
uv run ruff check .
uv run ruff format .
Run tests
uv run pytest
Project Structure
hledger_panel/
├── cli/ # CLI entry point
├── core/ # Core ledger API
├── common/ # Shared utilities (widgets, transforms, plots)
├── dashboard/ # Web dashboard (serve, views, template)
└── __init__.py # Package metadata
tests/ # Test suite
Adding New Dashboard Views
- Create a new file in
hledger_panel/dashboard/views/ - Export required variables:
content: Panel object or callablename: (optional) Display namedescription: (optional) Short description
Example:
import shlex
import panel as pn
import hvplot.pandas # noqa: F401
from hledger_panel.core.ledger import HledgerAPI
from hledger_panel.common.widgets import create_query_widget, create_settings_panel
from hledger_panel.common.plots import create_step_plot, wrap_holoviews
from hledger_panel.common.transforms import pivot_balance
name = "My View"
description = "My custom dashboard"
hl = HledgerAPI.from_env()
hlx = pn.rx(hl)
query = create_query_widget()
settings = create_settings_panel(query)
dfx = hlx.balance(query.rx.pipe(lambda q: shlex.split(q)))
pdfx = dfx.pipe(pivot_balance)
plot = create_step_plot(pdfx, x="start_date")
content = pn.Column(settings, wrap_holoviews(plot))
Configuration
Set via environment or .mise.toml:
LEDGER_FILE: Path to hledger ledger file (required)
License
MIT