# Pyproforma
A Python package for financial modeling and reporting that provides a flexible framework for building financial models with line items, formulas, constraints, and rich output formatting.
## Installation
Install from PyPI:
```bash
pip install pyproforma
```
For local development:
```bash
pip install -e .
```
## Quick Start
```python
from pyproforma import Model, LineItem, Category
# Create line items
revenue = LineItem(
name="revenue",
category="income",
label="Total Revenue",
values={2024: 100000, 2025: 120000, 2026: 150000}
)
expenses = LineItem(
name="expenses",
category="income",
label="Total Expenses",
formula="revenue * 0.6" # 60% of revenue
)
# Create a model
model = Model(
line_items=[revenue, expenses],
years=[2024, 2025, 2026]
)
# Calculate results
results = model.calculate()
print(results.to_dataframe())
```
## Key Features
### 📊 **Financial Modeling**
- Create line items with explicit values or formulas
- Organize items into categories with automatic totals
- Support for complex financial calculations using numexpr
### 📈 **Interactive Charts**
- Built-in Plotly integration for data visualization
- Line charts, bar charts, and mixed chart types
- Cumulative change and percent change charts
### 📋 **Flexible Tables**
- Generate formatted tables for financial statements
- Export to Excel with styling and formatting
- Configurable row types and table structures
### 🔧 **Advanced Features**
- Constraint validation for model integrity
- YAML/JSON serialization for model persistence
- Debt and financing generators
- Rich HTML output for Jupyter notebooks
## Usage Examples
### Working with Formulas
```python
# Line items can reference other line items in formulas
profit = LineItem(
name="profit",
category="income",
formula="revenue - expenses"
)
# Support for complex expressions
margin = LineItem(
name="margin",
category="ratios",
formula="profit / revenue",
value_format="percent"
)
```
### Creating Categories
```python
from pyproforma import Category
# Categories automatically calculate totals
revenue_category = Category(
name="revenue",
label="Revenue Sources",
include_total=True
)
model.add.category(revenue_category)
```
### Generating Reports
```python
# Create formatted tables
table = model.tables.generate_table([
{"type": "category", "name": "income"},
{"type": "line_item", "name": "revenue"},
{"type": "line_item", "name": "expenses"},
{"type": "total", "category": "income"}
])
# Export to Excel
table.to_excel("financial_report.xlsx")
# Create interactive charts
chart = model.charts.item("revenue", chart_type="line")
chart.show()
```
### Model Persistence
```python
# Save model to YAML
model.save_yaml("model.yaml")
# Load model from YAML
model = Model.load_yaml("model.yaml")
```
## Development
Install in development mode with testing dependencies:
```bash
pip install -e .[dev]
```
Run tests:
```bash
pytest
```
Run tests with coverage:
```bash
pytest --cov=pyproforma
```
## Requirements
- Python 3.9+
- pandas >= 1.3.0
- openpyxl >= 3.0.0
- numexpr >= 2.7.0
- jinja2 >= 3.0.0
- plotly >= 5.0.0
- PyYAML >= 6.0.0
## License
MIT License - see LICENSE file for details.
Raw data
{
"_id": null,
"home_page": null,
"name": "pyproforma",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": "Robert Hannay <rhannay@gmail.com>",
"keywords": "finance, modeling, reporting, excel, proforma",
"author": null,
"author_email": "Robert Hannay <rhannay@gmail.com>",
"download_url": "https://files.pythonhosted.org/packages/06/d3/b52591262525006d901b8c8d577cd51a3e72c12ae8850041837380c4d63b/pyproforma-0.1.1.tar.gz",
"platform": null,
"description": "# Pyproforma\n\nA Python package for financial modeling and reporting that provides a flexible framework for building financial models with line items, formulas, constraints, and rich output formatting.\n\n## Installation\n\nInstall from PyPI:\n\n```bash\npip install pyproforma\n```\n\nFor local development:\n\n```bash\npip install -e .\n```\n\n## Quick Start\n\n```python\nfrom pyproforma import Model, LineItem, Category\n\n# Create line items\nrevenue = LineItem(\n name=\"revenue\",\n category=\"income\",\n label=\"Total Revenue\",\n values={2024: 100000, 2025: 120000, 2026: 150000}\n)\n\nexpenses = LineItem(\n name=\"expenses\", \n category=\"income\",\n label=\"Total Expenses\",\n formula=\"revenue * 0.6\" # 60% of revenue\n)\n\n# Create a model\nmodel = Model(\n line_items=[revenue, expenses],\n years=[2024, 2025, 2026]\n)\n\n# Calculate results\nresults = model.calculate()\nprint(results.to_dataframe())\n```\n\n## Key Features\n\n### \ud83d\udcca **Financial Modeling**\n- Create line items with explicit values or formulas\n- Organize items into categories with automatic totals\n- Support for complex financial calculations using numexpr\n\n### \ud83d\udcc8 **Interactive Charts**\n- Built-in Plotly integration for data visualization\n- Line charts, bar charts, and mixed chart types\n- Cumulative change and percent change charts\n\n### \ud83d\udccb **Flexible Tables**\n- Generate formatted tables for financial statements\n- Export to Excel with styling and formatting\n- Configurable row types and table structures\n\n### \ud83d\udd27 **Advanced Features**\n- Constraint validation for model integrity\n- YAML/JSON serialization for model persistence\n- Debt and financing generators\n- Rich HTML output for Jupyter notebooks\n\n## Usage Examples\n\n### Working with Formulas\n\n```python\n# Line items can reference other line items in formulas\nprofit = LineItem(\n name=\"profit\",\n category=\"income\", \n formula=\"revenue - expenses\"\n)\n\n# Support for complex expressions\nmargin = LineItem(\n name=\"margin\",\n category=\"ratios\",\n formula=\"profit / revenue\",\n value_format=\"percent\"\n)\n```\n\n### Creating Categories\n\n```python\nfrom pyproforma import Category\n\n# Categories automatically calculate totals\nrevenue_category = Category(\n name=\"revenue\",\n label=\"Revenue Sources\",\n include_total=True\n)\n\nmodel.add.category(revenue_category)\n```\n\n### Generating Reports\n\n```python\n# Create formatted tables\ntable = model.tables.generate_table([\n {\"type\": \"category\", \"name\": \"income\"},\n {\"type\": \"line_item\", \"name\": \"revenue\"},\n {\"type\": \"line_item\", \"name\": \"expenses\"},\n {\"type\": \"total\", \"category\": \"income\"}\n])\n\n# Export to Excel\ntable.to_excel(\"financial_report.xlsx\")\n\n# Create interactive charts\nchart = model.charts.item(\"revenue\", chart_type=\"line\")\nchart.show()\n```\n\n### Model Persistence\n\n```python\n# Save model to YAML\nmodel.save_yaml(\"model.yaml\")\n\n# Load model from YAML\nmodel = Model.load_yaml(\"model.yaml\")\n```\n\n## Development\n\nInstall in development mode with testing dependencies:\n\n```bash\npip install -e .[dev]\n```\n\nRun tests:\n\n```bash\npytest\n```\n\nRun tests with coverage:\n\n```bash\npytest --cov=pyproforma\n```\n\n## Requirements\n\n- Python 3.9+\n- pandas >= 1.3.0\n- openpyxl >= 3.0.0\n- numexpr >= 2.7.0\n- jinja2 >= 3.0.0\n- plotly >= 5.0.0\n- PyYAML >= 6.0.0\n\n## License\n\nMIT License - see LICENSE file for details.\n",
"bugtrack_url": null,
"license": null,
"summary": "A Python package for financial modeling and reporting",
"version": "0.1.1",
"project_urls": {
"Documentation": "https://github.com/rhannay/pyproforma#readme",
"Homepage": "https://github.com/rhannay/pyproforma",
"Issues": "https://github.com/rhannay/pyproforma/issues",
"Repository": "https://github.com/rhannay/pyproforma"
},
"split_keywords": [
"finance",
" modeling",
" reporting",
" excel",
" proforma"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "317c4fb398b8a4af6f082e98a2877f0bb13143f4a3cbe9f0de40e94412550f46",
"md5": "985bbb8ce05cb564061df68c654f2505",
"sha256": "27eff9024764760a66d54bc1419f51b07c69cee7b4709cc8ad556730c5d86ca3"
},
"downloads": -1,
"filename": "pyproforma-0.1.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "985bbb8ce05cb564061df68c654f2505",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 50454,
"upload_time": "2025-07-16T04:19:53",
"upload_time_iso_8601": "2025-07-16T04:19:53.539937Z",
"url": "https://files.pythonhosted.org/packages/31/7c/4fb398b8a4af6f082e98a2877f0bb13143f4a3cbe9f0de40e94412550f46/pyproforma-0.1.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "06d3b52591262525006d901b8c8d577cd51a3e72c12ae8850041837380c4d63b",
"md5": "3132e6172aec9f481d26e54e20e1ccce",
"sha256": "fe63a42aa2e3151a4d1948330704d1f3d76953cd5b3a60b74d7b95e0192a286f"
},
"downloads": -1,
"filename": "pyproforma-0.1.1.tar.gz",
"has_sig": false,
"md5_digest": "3132e6172aec9f481d26e54e20e1ccce",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 42096,
"upload_time": "2025-07-16T04:19:54",
"upload_time_iso_8601": "2025-07-16T04:19:54.484300Z",
"url": "https://files.pythonhosted.org/packages/06/d3/b52591262525006d901b8c8d577cd51a3e72c12ae8850041837380c4d63b/pyproforma-0.1.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-16 04:19:54",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "rhannay",
"github_project": "pyproforma#readme",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "pyproforma"
}