Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 5 additions & 17 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ on:
paths:
- '**.yml'
- '**.toml'
- '**.ini'
- '**.py'
- '**.json'
- '**.csv'
Expand All @@ -14,7 +13,6 @@ on:
paths:
- '**.yml'
- '**.toml'
- '**.ini'
- '**.py'
- '**.json'
- '**.csv'
Expand All @@ -33,24 +31,14 @@ jobs:
uses: actions/checkout@v4
with:
persist-credentials: false
- name: Setup Miniconda using Python ${{ matrix.python-version }}
uses: conda-incubator/setup-miniconda@v3
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
miniconda-version: "latest"
auto-update-conda: true
activate-environment: ogcore-dev
environment-file: environment.yml
python-version: ${{ matrix.python-version }}
auto-activate-base: false
- name: Build
shell: bash -l {0}
run: |
pip install -e .
- name: Install package and dependencies
run: uv sync --extra dev
- name: Test
shell: bash -l {0}
working-directory: ./
run: |
python -m pytest -m "not local and not benchmark" --cov=./ --cov-report=xml
run: uv run python -m pytest -m "not local and not benchmark" --cov=./ --cov-report=xml
- name: Upload coverage to Codecov
if: matrix.os == 'ubuntu-latest' && contains(github.repository, 'PSLmodels/OG-Core')
uses: codecov/codecov-action@v4
Expand Down
15 changes: 0 additions & 15 deletions .github/workflows/check_black.yml

This file was deleted.

14 changes: 14 additions & 0 deletions .github/workflows/check_ruff.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: Check Ruff formatting and linting

on: [push, pull_request]

jobs:
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: astral-sh/setup-uv@v4
- name: Check formatting with Ruff
run: uvx ruff format --check .
- name: Check linting with Ruff
run: uvx ruff check .
16 changes: 6 additions & 10 deletions .github/workflows/deploy_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,17 @@ jobs:
with:
persist-credentials: false

- name: Setup Miniconda
uses: conda-incubator/setup-miniconda@v3
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
miniconda-version: "latest"
activate-environment: ogcore-dev
environment-file: environment.yml
python-version: "3.13"
auto-activate-base: false

- name: Install package and dependencies
run: uv sync --extra dev --extra docs

- name: Build # Build Jupyter Book
shell: bash -l {0}
run: |
pip install -e .
python -m ipykernel install --user --name=ogcore-dev
make build-docs
uv run make documentation

- name: Deploy
uses: JamesIves/github-pages-deploy-action@v4
Expand Down
16 changes: 6 additions & 10 deletions .github/workflows/docs_check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,14 @@ jobs:
with:
persist-credentials: false

- name: Setup Miniconda
uses: conda-incubator/setup-miniconda@v3
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
miniconda-version: "latest"
activate-environment: ogcore-dev
environment-file: environment.yml
python-version: "3.13"
auto-activate-base: false

- name: Install package and dependencies
run: uv sync --extra dev --extra docs

- name: Build # Build Jupyter Book
shell: bash -l {0}
run: |
pip install -e .
python -m ipykernel install --user --name=ogcore-dev
make build-docs
uv run make documentation
6 changes: 3 additions & 3 deletions .github/workflows/publish_to_pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,12 @@ jobs:
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v5
- name: Install uv
uses: astral-sh/setup-uv@v4
with:
python-version: "3.13"
- name: Build package
run: make pip-package
run: uv build
- name: Publish a Python distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.15.6] - 2026-04-15 16:00:00

### Added

- Changes to package files to use `uv` for packaging and running commands. See PR [#1093](https://github.com/PSLmodels/OG-Core/pull/1093)

## [0.15.5] - 2026-01-27 12:00:00

### Added
Expand Down
39 changes: 19 additions & 20 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,26 @@ help:
@echo "USAGE: make [TARGET]"
@echo "TARGETS:"
@echo "help : show help message"
@echo "clean : remove .pyc files and local ccc package"
@echo "package : build and install local package"
@echo "clean : remove .pyc files and local ogcore package"
@echo "install : build and install local package"
@echo "pytest : generate report for and cleanup after"
@echo " pytest -W ignore -m ''"
@echo "cstest : generate coding-style errors using the"
@echo " pycodestyle (nee pep8) tool"
@echo "coverage : generate test coverage report"
@echo "git-sync : synchronize local, origin, and upstream Git repos"
@echo "git-pr N=n : create local pr-n branch containing upstream PR"
@echo "make-docs : build new Jupyter Book documentation files"
@echo "documentation : build new Jupyter Book documentation files"

.PHONY=clean
clean:
@find . -name *pyc -exec rm {} \;
@find . -name *cache -maxdepth 1 -exec rm -r {} \;
@conda uninstall ccc --yes --quiet 2>&1 > /dev/null
@conda uninstall ogcore --yes --quiet 2>&1 > /dev/null

.PHONY=install
install:
pip install -e .[dev]

.PHONY=pytest
pytest:
Expand Down Expand Up @@ -58,23 +62,18 @@ else
endif
@$(pytest-cleanup)

.PHONY=git-sync
git-sync:
@./gitsync

.PHONY=git-pr
git-pr:
@./gitpr $(N)

.PHONY=build-docs
build-docs:
@cd ./docs ; python make_params.py; python make_vars.py; jb build ./book
.PHONY=documentation
documentation:
uv run python -m ipykernel install --user --name=ogcore-dev
uv run jb clean docs
uv run python ./docs/make_params.py
uv run python ./docs/make_vars.py
uv run jb build ./docs/book

format:
black . -l 79
linecheck . --fix
uv run ruff format .
uv run ruff check . --fix
uv run linecheck . --fix

pip-package:
pip install wheel
pip install setuptools
python setup.py sdist bdist_wheel
uv build
17 changes: 7 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
| | |
| --- | --- |
| Org | [![PSL cataloged](https://img.shields.io/badge/PSL-cataloged-a0a0a0.svg)](https://www.PSLmodels.org) [![OS License: CCO-1.0](https://img.shields.io/badge/OS%20License-CCO%201.0-yellow)](https://github.com/PSLmodels/OG-Core/blob/master/LICENSE) [![Jupyter Book Badge](https://raw.githubusercontent.com/jupyter-book/jupyter-book/next/docs/media/images/badge.svg)](https://pslmodels.github.io/OG-Core/) |
| Package | [![Python 3.12](https://img.shields.io/badge/python-3.12-blue.svg)](https://www.python.org/downloads/release/python-3129/) [![Python 3.13](https://img.shields.io/badge/python-3.13-blue.svg)](https://www.python.org/downloads/release/python-3137/) [![PyPI Latest Release](https://img.shields.io/pypi/v/ogcore.svg)](https://pypi.org/project/ogcore/) [![PyPI Downloads](https://img.shields.io/pypi/dm/ogcore.svg?label=PyPI%20downloads)](https://pypi.org/project/ogcore/) [![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black) |
| Testing | ![example event parameter](https://github.com/PSLmodels/OG-Core/actions/workflows/build_and_test.yml/badge.svg?branch=master) ![example event parameter](https://github.com/PSLmodels/OG-Core/actions/workflows/deploy_docs.yml/badge.svg?branch=master) ![example event parameter](https://github.com/PSLmodels/OG-Core/actions/workflows/check_black.yml/badge.svg?branch=master) [![Codecov](https://codecov.io/gh/PSLmodels/OG-Core/branch/master/graph/badge.svg)](https://codecov.io/gh/PSLmodels/OG-Core) |
| Package | [![Python 3.12](https://img.shields.io/badge/python-3.12-blue.svg)](https://www.python.org/downloads/release/python-3129/) [![Python 3.13](https://img.shields.io/badge/python-3.13-blue.svg)](https://www.python.org/downloads/release/python-3137/) [![PyPI Latest Release](https://img.shields.io/pypi/v/ogcore.svg)](https://pypi.org/project/ogcore/) [![PyPI Downloads](https://img.shields.io/pypi/dm/ogcore.svg?label=PyPI%20downloads)](https://pypi.org/project/ogcore/) [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff) |
| Testing | ![example event parameter](https://github.com/PSLmodels/OG-Core/actions/workflows/build_and_test.yml/badge.svg?branch=master) ![example event parameter](https://github.com/PSLmodels/OG-Core/actions/workflows/deploy_docs.yml/badge.svg?branch=master) ![example event parameter](https://github.com/PSLmodels/OG-Core/actions/workflows/check_ruff.yml/badge.svg?branch=master) [![Codecov](https://codecov.io/gh/PSLmodels/OG-Core/branch/master/graph/badge.svg)](https://codecov.io/gh/PSLmodels/OG-Core) |


OG-Core is an overlapping-generations (OG) model core theory, logic, and solution method algorithms that allow for dynamic general equilibrium analysis of fiscal policy. OG-Core provides a general framework and is a dependency of several country-specific OG model caliibrations, as listed in the table belowsuch as [OG-USA](https://github.com/PSLmodels/OG-USA) and [OG-UK](https://github.com/PSLmodels/OG-UK). The model output includes changes in macroeconomic aggregates (GDP, investment, consumption), wages, interest rates, and the stream of tax revenues over time. Regularly updated documentation of the model theory--its output, and solution method--and the Python API is available [here](https://pslmodels.github.io/OG-Core).
Expand All @@ -24,13 +24,12 @@ The model is constantly under development, and model components could change sig

## Using/contributing to OG-Core

There are two primary methods for installing and running OG-Core on your computer locally. The first and simplest method is to download the most recent `ogcore` Python package from the Python Package Index ([PyPI.org]()). A second option is to fork and clone the most recent version of OG-Core from its GitHub repository and create the conda environment for the `ogcore` package. We detail both of these methods below.
There are two primary methods for installing and running OG-Core on your computer locally. The first and simplest method is to download the most recent `ogcore` Python package from the Python Package Index ([PyPI.org](https://pypi.org/project/ogcore/)). A second option is to fork and clone the most recent version of OG-Core from its GitHub repository and install the `ogcore` package with its development dependencies using `uv`. We detail both of these methods below.


### Installing and Running OG-Core from Python Package Index (PyPI.org)

* Open your terminal (or Conda command prompt), and make sure you have the most recent version of `pip` (the Python Index Package manager) by typing on a Unix/macOS machine `python3 -m pip install --upgrade pip` or on a Windows machine `py -m pip install --upgrade pip`.
* Install the [`ogcore`](https://pypi.org/project/ogcore/) package from the Python Package Index by typing `pip install ogcore`.
* Open your terminal and install the [`ogcore`](https://pypi.org/project/ogcore/) package from the Python Package Index by typing `pip install ogcore`.
* Navigate to a folder `./YourFolderName/` where you want to save scripts to run OG-Core and output from the simulations in those scripts.
* Save the python script [`run_ogcore_example.py`](https://github.com/PSLmodels/OG-Core/blob/master/run_examples/run_ogcore_example.py) from the OG-Core GitHub repository in the folder where you are working on your local machine `./YourFolderName/run_ogcore_example.py`.
* Run the model with an example reform from terminal/command prompt by typing `python run_ogcore_example.py`
Expand Down Expand Up @@ -60,13 +59,11 @@ The CSV output file `./ogcore_example_output.csv` can be compared to the [`./run

### Installing and Running OG-Core from GitHub repository

* Install the [Anaconda distribution](https://www.anaconda.com/distribution/) of Python
* Install [`uv`](https://docs.astral.sh/uv/) by following the [installation instructions](https://docs.astral.sh/uv/getting-started/installation/) for your platform (or simply run `pip install uv`)
* Clone this repository to a directory on your computer
* From the terminal (or Conda command prompt), navigate to the directory to which you cloned this repository and run `conda env create -f environment.yml`
* Then, `conda activate ogcore-dev`
* Then install by `pip install -e .`
* From the terminal, navigate to the directory to which you cloned this repository and run `uv pip install -e ".[dev]"` to install the package and all development dependencies
* Navigate to `./run_examples`
* Run the model with an example reform from terminal/command prompt by typing `python run_ogcore_example.py`
* Run the model with an example reform from terminal/command prompt by typing `uv run python run_ogcore_example.py`
* You can adjust the `./run_examples/run_ogcore_example.py` script by modifying model parameters specified in the `og_spec` dictionary.
* Model outputs will be saved in the following files:
* `./run_examples/run_example_plots`
Expand Down
35 changes: 33 additions & 2 deletions docs/book/content/intro/parameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -434,7 +434,8 @@ _Out-of-Range Action:_ error


#### `infra_investment_leakage_rate`
_Description:_ Fraction of government infrastructure investment lost to leakage (e.g., corruption or other frictions) and treated as deadweight loss. Only $(1 - \phi_g)$ of investment enters the public capital stock.
_Description:_ Fraction of government infrastructure investment lost to leakage (e.g., corruption or other frictions) and treated as deadweight loss. Only (1 - infra_investment_leakage_rate) * I_g enters the public capital stock.
_Notes:_ A value of 0.0 (default) implies no leakage. A value of 0.2 implies 20% of infrastructure spending is lost before entering the public capital stock.
_Value Type:_ float
_Valid Range:_ min = 0.0 and max = 1.0
_Out-of-Range Action:_ error
Expand Down Expand Up @@ -651,6 +652,22 @@ _Valid Range:_ min = 0.0 and max = 1.0
_Out-of-Range Action:_ error


#### `income_tax_filer`
_Description:_ Binary indicator for whether lifetime income type j is subject to income taxes. Non-filers (tax_filer[j]=0) are not subject to income taxes but still pay payroll taxes.
_Notes:_ Specified by time T and lifetime income group J. Defaults to 1.0 (all groups file). Can be set to values between 0 and 1 to represent the share of group j that files.
_Value Type:_ float
_Valid Range:_ min = 0.0 and max = 1.0
_Out-of-Range Action:_ error


#### `wealth_tax_filer`
_Description:_ Binary indicator for whether lifetime income type j is subject to wealth taxes. Non-filers (wealth_tax_filer[j]=0) are not subject to wealth taxes but still pay payroll taxes.
_Notes:_ Specified by time T and lifetime income group J. Defaults to 1.0 (all groups file). Can be set to values between 0 and 1 to represent the share of group j that files.
_Value Type:_ float
_Valid Range:_ min = 0.0 and max = 1.0
_Out-of-Range Action:_ error


#### `etr_params`
_Description:_ Effective tax rate function parameters.
_Value Type:_ float
Expand Down Expand Up @@ -709,6 +726,20 @@ _Valid Range:_ min = -0.3 and max = 0.3
_Out-of-Range Action:_ error


#### `r_gov_DY`
_Description:_ Parameter summarizing the linear effect of the debt to GDP ratio on the government interest rate.
_Value Type:_ float
_Valid Range:_ min = -0.3 and max = 0.3
_Out-of-Range Action:_ error


#### `r_gov_DY2`
_Description:_ Parameter summarizing the quadratic effect of the debt to GDP ratio on the government interest rate.
_Value Type:_ float
_Valid Range:_ min = -0.3 and max = 0.3
_Out-of-Range Action:_ error


## Open Economy Parameters

#### `world_int_rate_annual`
Expand Down Expand Up @@ -744,7 +775,7 @@ _Out-of-Range Action:_ error
## Economic Assumptions

#### `g_y_annual`
_Description:_ Growth rate of labor augmenting technological change.
_Description:_ Annual growth rate of labor augmenting technological change.
_Value Type:_ float
_Valid Range:_ min = -0.01 and max = 0.08
_Out-of-Range Action:_ error
Expand Down
2 changes: 0 additions & 2 deletions docs/book/content/theory/images/SS_images.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@
import os
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.ticker import MultipleLocator
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import cm

"""
Expand Down
1 change: 0 additions & 1 deletion docs/make_params.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import numpy as np
import pandas as pd
from collections import OrderedDict
import ogcore
import os
import sys
Expand Down
1 change: 0 additions & 1 deletion docs/make_vars.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import numpy as np
import pandas as pd
from collections import OrderedDict
import ogcore
import os
import sys
Expand Down
35 changes: 0 additions & 35 deletions environment.yml

This file was deleted.

1 change: 0 additions & 1 deletion examples/multi_industry_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
"""

# import modules
from asyncio import base_events
import multiprocessing
from distributed import Client
import time
Expand Down
Loading
Loading