# 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/1f/69/7dc77ca11f5b850c748a519b7373ea1e78ba62ff92ed0447f6733df20a8f/pyproforma-0.1.2.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.2",
"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": "6e77f765eb70f0379eeb97d53fcddec61f1ca1748cebafd6b89692dcb9299101",
"md5": "2049c5d74eed8295bd6723fc98bc0976",
"sha256": "e0846fd348141ac632b7cf3bb561fcb0a573ca0ffe6e2739dbd81c843261188e"
},
"downloads": -1,
"filename": "pyproforma-0.1.2-py3-none-any.whl",
"has_sig": false,
"md5_digest": "2049c5d74eed8295bd6723fc98bc0976",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 53973,
"upload_time": "2025-07-23T06:07:13",
"upload_time_iso_8601": "2025-07-23T06:07:13.523632Z",
"url": "https://files.pythonhosted.org/packages/6e/77/f765eb70f0379eeb97d53fcddec61f1ca1748cebafd6b89692dcb9299101/pyproforma-0.1.2-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "1f697dc77ca11f5b850c748a519b7373ea1e78ba62ff92ed0447f6733df20a8f",
"md5": "0a9a25b1e906c7ea1ef36c089fe9dc6c",
"sha256": "d03cd2bd16873a04e9cd220e8835d11b6b60f77b0b498f4fc96d85e2129fe7cb"
},
"downloads": -1,
"filename": "pyproforma-0.1.2.tar.gz",
"has_sig": false,
"md5_digest": "0a9a25b1e906c7ea1ef36c089fe9dc6c",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 45489,
"upload_time": "2025-07-23T06:07:15",
"upload_time_iso_8601": "2025-07-23T06:07:15.447378Z",
"url": "https://files.pythonhosted.org/packages/1f/69/7dc77ca11f5b850c748a519b7373ea1e78ba62ff92ed0447f6733df20a8f/pyproforma-0.1.2.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-23 06:07:15",
"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"
}