Skip to content

Commit c24e756

Browse files
authored
Merge pull request #1093 from jdebacker/uv
Merging
2 parents 85733bb + b8d5c65 commit c24e756

46 files changed

Lines changed: 3616 additions & 393 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build_and_test.yml

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ on:
44
paths:
55
- '**.yml'
66
- '**.toml'
7-
- '**.ini'
87
- '**.py'
98
- '**.json'
109
- '**.csv'
@@ -14,7 +13,6 @@ on:
1413
paths:
1514
- '**.yml'
1615
- '**.toml'
17-
- '**.ini'
1816
- '**.py'
1917
- '**.json'
2018
- '**.csv'
@@ -33,24 +31,14 @@ jobs:
3331
uses: actions/checkout@v4
3432
with:
3533
persist-credentials: false
36-
- name: Setup Miniconda using Python ${{ matrix.python-version }}
37-
uses: conda-incubator/setup-miniconda@v3
34+
- name: Install uv
35+
uses: astral-sh/setup-uv@v4
3836
with:
39-
miniconda-version: "latest"
40-
auto-update-conda: true
41-
activate-environment: ogcore-dev
42-
environment-file: environment.yml
4337
python-version: ${{ matrix.python-version }}
44-
auto-activate-base: false
45-
- name: Build
46-
shell: bash -l {0}
47-
run: |
48-
pip install -e .
38+
- name: Install package and dependencies
39+
run: uv sync --extra dev
4940
- name: Test
50-
shell: bash -l {0}
51-
working-directory: ./
52-
run: |
53-
python -m pytest -m "not local and not benchmark" --cov=./ --cov-report=xml
41+
run: uv run python -m pytest -m "not local and not benchmark" --cov=./ --cov-report=xml
5442
- name: Upload coverage to Codecov
5543
if: matrix.os == 'ubuntu-latest' && contains(github.repository, 'PSLmodels/OG-Core')
5644
uses: codecov/codecov-action@v4

.github/workflows/check_black.yml

Lines changed: 0 additions & 15 deletions
This file was deleted.

.github/workflows/check_ruff.yml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Check Ruff formatting and linting
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
lint:
7+
runs-on: ubuntu-latest
8+
steps:
9+
- uses: actions/checkout@v4
10+
- uses: astral-sh/setup-uv@v4
11+
- name: Check formatting with Ruff
12+
run: uvx ruff format --check .
13+
- name: Check linting with Ruff
14+
run: uvx ruff check .

.github/workflows/deploy_docs.yml

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,21 +21,17 @@ jobs:
2121
with:
2222
persist-credentials: false
2323

24-
- name: Setup Miniconda
25-
uses: conda-incubator/setup-miniconda@v3
24+
- name: Install uv
25+
uses: astral-sh/setup-uv@v4
2626
with:
27-
miniconda-version: "latest"
28-
activate-environment: ogcore-dev
29-
environment-file: environment.yml
3027
python-version: "3.13"
31-
auto-activate-base: false
28+
29+
- name: Install package and dependencies
30+
run: uv sync --extra dev --extra docs
3231

3332
- name: Build # Build Jupyter Book
34-
shell: bash -l {0}
3533
run: |
36-
pip install -e .
37-
python -m ipykernel install --user --name=ogcore-dev
38-
make build-docs
34+
uv run make documentation
3935
4036
- name: Deploy
4137
uses: JamesIves/github-pages-deploy-action@v4

.github/workflows/docs_check.yml

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,14 @@ jobs:
1919
with:
2020
persist-credentials: false
2121

22-
- name: Setup Miniconda
23-
uses: conda-incubator/setup-miniconda@v3
22+
- name: Install uv
23+
uses: astral-sh/setup-uv@v4
2424
with:
25-
miniconda-version: "latest"
26-
activate-environment: ogcore-dev
27-
environment-file: environment.yml
2825
python-version: "3.13"
29-
auto-activate-base: false
26+
27+
- name: Install package and dependencies
28+
run: uv sync --extra dev --extra docs
3029

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

.github/workflows/publish_to_pypi.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ jobs:
1313
steps:
1414
- name: Checkout repo
1515
uses: actions/checkout@v4
16-
- name: Setup Python
17-
uses: actions/setup-python@v5
16+
- name: Install uv
17+
uses: astral-sh/setup-uv@v4
1818
with:
1919
python-version: "3.13"
2020
- name: Build package
21-
run: make pip-package
21+
run: uv build
2222
- name: Publish a Python distribution to PyPI
2323
uses: pypa/gh-action-pypi-publish@release/v1
2424
with:

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [0.15.6] - 2026-04-15 16:00:00
9+
10+
### Added
11+
12+
- Changes to package files to use `uv` for packaging and running commands. See PR [#1093](https://github.com/PSLmodels/OG-Core/pull/1093)
13+
814
## [0.15.5] - 2026-01-27 12:00:00
915

1016
### Added

Makefile

Lines changed: 19 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,26 @@ help:
1010
@echo "USAGE: make [TARGET]"
1111
@echo "TARGETS:"
1212
@echo "help : show help message"
13-
@echo "clean : remove .pyc files and local ccc package"
14-
@echo "package : build and install local package"
13+
@echo "clean : remove .pyc files and local ogcore package"
14+
@echo "install : build and install local package"
1515
@echo "pytest : generate report for and cleanup after"
1616
@echo " pytest -W ignore -m ''"
1717
@echo "cstest : generate coding-style errors using the"
1818
@echo " pycodestyle (nee pep8) tool"
1919
@echo "coverage : generate test coverage report"
2020
@echo "git-sync : synchronize local, origin, and upstream Git repos"
2121
@echo "git-pr N=n : create local pr-n branch containing upstream PR"
22-
@echo "make-docs : build new Jupyter Book documentation files"
22+
@echo "documentation : build new Jupyter Book documentation files"
2323

2424
.PHONY=clean
2525
clean:
2626
@find . -name *pyc -exec rm {} \;
2727
@find . -name *cache -maxdepth 1 -exec rm -r {} \;
28-
@conda uninstall ccc --yes --quiet 2>&1 > /dev/null
28+
@conda uninstall ogcore --yes --quiet 2>&1 > /dev/null
29+
30+
.PHONY=install
31+
install:
32+
pip install -e .[dev]
2933

3034
.PHONY=pytest
3135
pytest:
@@ -58,23 +62,18 @@ else
5862
endif
5963
@$(pytest-cleanup)
6064

61-
.PHONY=git-sync
62-
git-sync:
63-
@./gitsync
64-
65-
.PHONY=git-pr
66-
git-pr:
67-
@./gitpr $(N)
68-
69-
.PHONY=build-docs
70-
build-docs:
71-
@cd ./docs ; python make_params.py; python make_vars.py; jb build ./book
65+
.PHONY=documentation
66+
documentation:
67+
uv run python -m ipykernel install --user --name=ogcore-dev
68+
uv run jb clean docs
69+
uv run python ./docs/make_params.py
70+
uv run python ./docs/make_vars.py
71+
uv run jb build ./docs/book
7272

7373
format:
74-
black . -l 79
75-
linecheck . --fix
74+
uv run ruff format .
75+
uv run ruff check . --fix
76+
uv run linecheck . --fix
7677

7778
pip-package:
78-
pip install wheel
79-
pip install setuptools
80-
python setup.py sdist bdist_wheel
79+
uv build

README.md

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
| | |
44
| --- | --- |
55
| 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/) |
6-
| 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) |
7-
| 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) |
6+
| 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) |
7+
| 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) |
88

99

1010
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).
@@ -24,13 +24,12 @@ The model is constantly under development, and model components could change sig
2424

2525
## Using/contributing to OG-Core
2626

27-
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.
27+
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.
2828

2929

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

32-
* 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`.
33-
* Install the [`ogcore`](https://pypi.org/project/ogcore/) package from the Python Package Index by typing `pip install ogcore`.
32+
* Open your terminal and install the [`ogcore`](https://pypi.org/project/ogcore/) package from the Python Package Index by typing `pip install ogcore`.
3433
* Navigate to a folder `./YourFolderName/` where you want to save scripts to run OG-Core and output from the simulations in those scripts.
3534
* 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`.
3635
* Run the model with an example reform from terminal/command prompt by typing `python run_ogcore_example.py`
@@ -60,13 +59,11 @@ The CSV output file `./ogcore_example_output.csv` can be compared to the [`./run
6059

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

63-
* Install the [Anaconda distribution](https://www.anaconda.com/distribution/) of Python
62+
* 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`)
6463
* Clone this repository to a directory on your computer
65-
* 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`
66-
* Then, `conda activate ogcore-dev`
67-
* Then install by `pip install -e .`
64+
* 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
6865
* Navigate to `./run_examples`
69-
* Run the model with an example reform from terminal/command prompt by typing `python run_ogcore_example.py`
66+
* Run the model with an example reform from terminal/command prompt by typing `uv run python run_ogcore_example.py`
7067
* You can adjust the `./run_examples/run_ogcore_example.py` script by modifying model parameters specified in the `og_spec` dictionary.
7168
* Model outputs will be saved in the following files:
7269
* `./run_examples/run_example_plots`

docs/book/content/intro/parameters.md

Lines changed: 33 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,8 @@ _Out-of-Range Action:_ error
434434

435435

436436
#### `infra_investment_leakage_rate`
437-
_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.
437+
_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.
438+
_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.
438439
_Value Type:_ float
439440
_Valid Range:_ min = 0.0 and max = 1.0
440441
_Out-of-Range Action:_ error
@@ -651,6 +652,22 @@ _Valid Range:_ min = 0.0 and max = 1.0
651652
_Out-of-Range Action:_ error
652653

653654

655+
#### `income_tax_filer`
656+
_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.
657+
_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.
658+
_Value Type:_ float
659+
_Valid Range:_ min = 0.0 and max = 1.0
660+
_Out-of-Range Action:_ error
661+
662+
663+
#### `wealth_tax_filer`
664+
_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.
665+
_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.
666+
_Value Type:_ float
667+
_Valid Range:_ min = 0.0 and max = 1.0
668+
_Out-of-Range Action:_ error
669+
670+
654671
#### `etr_params`
655672
_Description:_ Effective tax rate function parameters.
656673
_Value Type:_ float
@@ -709,6 +726,20 @@ _Valid Range:_ min = -0.3 and max = 0.3
709726
_Out-of-Range Action:_ error
710727

711728

729+
#### `r_gov_DY`
730+
_Description:_ Parameter summarizing the linear effect of the debt to GDP ratio on the government interest rate.
731+
_Value Type:_ float
732+
_Valid Range:_ min = -0.3 and max = 0.3
733+
_Out-of-Range Action:_ error
734+
735+
736+
#### `r_gov_DY2`
737+
_Description:_ Parameter summarizing the quadratic effect of the debt to GDP ratio on the government interest rate.
738+
_Value Type:_ float
739+
_Valid Range:_ min = -0.3 and max = 0.3
740+
_Out-of-Range Action:_ error
741+
742+
712743
## Open Economy Parameters
713744

714745
#### `world_int_rate_annual`
@@ -744,7 +775,7 @@ _Out-of-Range Action:_ error
744775
## Economic Assumptions
745776

746777
#### `g_y_annual`
747-
_Description:_ Growth rate of labor augmenting technological change.
778+
_Description:_ Annual growth rate of labor augmenting technological change.
748779
_Value Type:_ float
749780
_Valid Range:_ min = -0.01 and max = 0.08
750781
_Out-of-Range Action:_ error

0 commit comments

Comments
 (0)