diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index c303a7b..8e3257b 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -1,14 +1,30 @@ -name: Build and test [Python 3.9, 3.10] - -on: [push, pull_request] - +name: Build and test +on: + push: + paths: + - '**.yml' + - '**.toml' + - '**.ini' + - '**.py' + - '**.json' + - '**.csv' + - '**.pkl' + pull_request: + paths: + - '**.yml' + - '**.toml' + - '**.ini' + - '**.py' + - '**.json' + - '**.csv' + - '**.pkl' jobs: build: runs-on: ${{ matrix.os }} strategy: matrix: - os: [ubuntu-latest, macos-latest] - python-version: ["3.9", "3.10", "3.11"] + os: [ubuntu-latest, macos-latest, windows-latest] + python-version: ["3.10", "3.11"] steps: - name: Checkout @@ -30,13 +46,11 @@ jobs: shell: bash -l {0} run: | pip install -e . - pip install pytest-cov - pip install pytest-pycodestyle - name: Test shell: bash -l {0} working-directory: ./ run: | - pytest -m 'not local' --cov=./ --cov-report=xml + python -m pytest -m 'not local' --cov=./ --cov-report=xml - name: Upload coverage to Codecov if: matrix.os == 'ubuntu-latest' && contains(github.repository, 'EAPD-DRB/OG-ZAF') uses: codecov/codecov-action@v4 diff --git a/.github/workflows/deploy_docs.yml b/.github/workflows/deploy_docs.yml index d8c2b7e..1f15f17 100644 --- a/.github/workflows/deploy_docs.yml +++ b/.github/workflows/deploy_docs.yml @@ -3,6 +3,15 @@ on: push: branches: - main + paths: + - './docs/**.png' + - './docs/book/content/calibration/images/**.png' + - './docs/README.md' + - './docs/book/**.yml' + - './docs/book/**.bib' + - '**.md' + - './docs/book/content/api/**.rst' + - './ogzaf/**.py' jobs: build-and-deploy: if: github.repository == 'EAPD-DRB/OG-ZAF' @@ -14,12 +23,12 @@ jobs: persist-credentials: false - name: Setup Miniconda - uses: conda-incubator/setup-miniconda@v2 + uses: conda-incubator/setup-miniconda@v3 with: miniforge-variant: Mambaforge activate-environment: ogzaf-dev environment-file: environment.yml - python-version: "3.10" + python-version: "3.11" auto-activate-base: false - name: Build # Build Jupyter Book diff --git a/.github/workflows/docs_check.yml b/.github/workflows/docs_check.yml index 77b245f..eb71523 100644 --- a/.github/workflows/docs_check.yml +++ b/.github/workflows/docs_check.yml @@ -1,5 +1,15 @@ name: Check that docs build -on: [push, pull_request] +on: + pull_request: + paths: + - './docs/**.png' + - './docs/book/content/calibration/images/**.png' + - './docs/README.md' + - './docs/book/**.yml' + - './docs/book/**.bib' + - '**.md' + - './docs/book/content/api/**.rst' + - './ogzaf/**.py' jobs: build: @@ -11,12 +21,12 @@ jobs: persist-credentials: false - name: Setup Miniconda - uses: conda-incubator/setup-miniconda@v2 + uses: conda-incubator/setup-miniconda@v3 with: miniforge-variant: Mambaforge activate-environment: ogzaf-dev environment-file: environment.yml - python-version: "3.10" + python-version: "3.11" auto-activate-base: false - name: Build # Build Jupyter Book diff --git a/.github/workflows/publish_to_pypi.yml b/.github/workflows/publish_to_pypi.yml index 3afbe4f..7a306f8 100644 --- a/.github/workflows/publish_to_pypi.yml +++ b/.github/workflows/publish_to_pypi.yml @@ -16,7 +16,7 @@ jobs: - name: Setup Python uses: actions/setup-python@v4 with: - python-version: "3.10" + python-version: "3.11" - name: Build package shell: bash -l {0} run: | diff --git a/CHANGELOG.md b/CHANGELOG.md index dd14ec0..f29ed3a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,11 +5,11 @@ 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.0.2] - 2024-06-12 8:00:00 +## [0.0.2] - 2024-06-18 12:00:00 ### Added -- Updates to `Calibration` to work with OG-Core 0.11.9 +- Updates to `Calibration` to work with OG-Core 0.11.10 - Removal of unused lines of code throughout the package @@ -32,4 +32,5 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 +[0.0.2]: https://github.com/EAPD-DRB/OG-ZAF/compare/v0.0.1...v0.0.2 [0.0.1]: https://github.com/EAPD-DRB/OG-ZAF/compare/v0.0.0...v0.0.1 diff --git a/Makefile b/Makefile index 53b8343..c94c54d 100644 --- a/Makefile +++ b/Makefile @@ -5,8 +5,6 @@ format: install: pip install -e . test: - pip install pytest-cov - pip install pytest-pycodestyle pytest -m 'not local' --cov=./ --cov-report=xml documentation: jupyter-book clean docs/book diff --git a/README.md b/README.md index 19edd99..c4a6ccc 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ | | | | --- | --- | | Org | [![United Nations DESA](https://img.shields.io/badge/United%20Nations%20DESA-blue)](https://www.un.org/en/desa) [![PSL cataloged](https://img.shields.io/badge/PSL-cataloged-a0a0a0.svg)](https://www.PSLmodels.org) [![OS License: CC0-1.0](https://img.shields.io/badge/OS%20License-CC0%201.0-yellow)](https://github.com/EAPD-DRB/OG-ZAF/blob/main/LICENSE) | -| Package | [![Python 3.9](https://img.shields.io/badge/python-3.9-blue.svg)](https://www.python.org/downloads/release/python-3917/) [![Python 3.10](https://img.shields.io/badge/python-3.10-blue.svg)](https://www.python.org/downloads/release/python-31013/) [![Python 3.11](https://img.shields.io/badge/python-3.11-blue.svg)](https://www.python.org/downloads/release/python-3116/) [![PyPI Latest Release](https://img.shields.io/pypi/v/ogzaf.svg)](https://pypi.org/project/ogzaf/) [![PyPI Downloads](https://img.shields.io/pypi/dm/ogzaf.svg?label=PyPI%20downloads)](https://pypi.org/project/ogzaf/) | +| Package | [![Python 3.10](https://img.shields.io/badge/python-3.10-blue.svg)](https://www.python.org/downloads/release/python-31013/) [![Python 3.11](https://img.shields.io/badge/python-3.11-blue.svg)](https://www.python.org/downloads/release/python-3116/) [![PyPI Latest Release](https://img.shields.io/pypi/v/ogzaf.svg)](https://pypi.org/project/ogzaf/) [![PyPI Downloads](https://img.shields.io/pypi/dm/ogzaf.svg?label=PyPI%20downloads)](https://pypi.org/project/ogzaf/) | | Testing | ![example event parameter](https://github.com/EAPD-DRB/OG-ZAF/actions/workflows/build_and_test.yml/badge.svg?branch=main) ![example event parameter](https://github.com/EAPD-DRB/OG-ZAF/actions/workflows/deploy_docs.yml/badge.svg?branch=main) ![example event parameter](https://github.com/EAPD-DRB/OG-ZAF/actions/workflows/check_format.yml/badge.svg?branch=main) [![Codecov](https://codecov.io/gh/EAPD-DRB/OG-ZAF/branch/main/graph/badge.svg)](https://codecov.io/gh/EAPD-DRB/OG-ZAF) | OG-ZAF is an overlapping-generations (OG) model that allows for dynamic general equilibrium analysis of fiscal policy for South Africa. OG-ZAF is built on the OG-Core framework. 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 at https://pslmodels.github.io/OG-Core and documentation of the specific South African calibration of the model will be available soon. diff --git a/docs/book/content/intro/intro.md b/docs/book/content/intro/intro.md index 15b9f78..93464fe 100644 --- a/docs/book/content/intro/intro.md +++ b/docs/book/content/intro/intro.md @@ -1,6 +1,12 @@ (Chap_Intro)= # OG-ZAF +| | | +| --- | --- | +| Org | [![United Nations DESA](https://img.shields.io/badge/United%20Nations%20DESA-blue)](https://www.un.org/en/desa) [![PSL cataloged](https://img.shields.io/badge/PSL-cataloged-a0a0a0.svg)](https://www.PSLmodels.org) [![OS License: CC0-1.0](https://img.shields.io/badge/OS%20License-CC0%201.0-yellow)](https://github.com/EAPD-DRB/OG-ZAF/blob/main/LICENSE) | +| Package | [![Python 3.10](https://img.shields.io/badge/python-3.10-blue.svg)](https://www.python.org/downloads/release/python-31013/) [![Python 3.11](https://img.shields.io/badge/python-3.11-blue.svg)](https://www.python.org/downloads/release/python-3116/) [![PyPI Latest Release](https://img.shields.io/pypi/v/ogzaf.svg)](https://pypi.org/project/ogzaf/) [![PyPI Downloads](https://img.shields.io/pypi/dm/ogzaf.svg?label=PyPI%20downloads)](https://pypi.org/project/ogzaf/) | +| Testing | ![example event parameter](https://github.com/EAPD-DRB/OG-ZAF/actions/workflows/build_and_test.yml/badge.svg?branch=main) ![example event parameter](https://github.com/EAPD-DRB/OG-ZAF/actions/workflows/deploy_docs.yml/badge.svg?branch=main) ![example event parameter](https://github.com/EAPD-DRB/OG-ZAF/actions/workflows/check_format.yml/badge.svg?branch=main) [![Codecov](https://codecov.io/gh/EAPD-DRB/OG-ZAF/branch/main/graph/badge.svg)](https://codecov.io/gh/EAPD-DRB/OG-ZAF) | + [`OG-ZAF`](https://github.com/EAPD-DRB/OG-ZAF) is a package that provides code and data to calibrate an overlapping-generations (OG) model to the economy of South Africa (ZAF), the code of which is hosted on GitHub at https://github.com/EAPD-DRB/OG-ZAF. `OG-ZAF` uses as a dependency the [`OG-Core`](https://pslmodels.github.io/OG-Core/) package, which contains the core theory and logic of a general OG model. The `OG-ZAF` calibration package and the `OG-Core` theory and logic make the model that allows for dynamic general equilibrium analysis of federal fiscal policy in South Africa. The model output focuses on changes in macroeconomic aggregates (GDP, investment, consumption), wages, interest rates, and the stream of tax revenues over time. This documentation of the `OG-ZAF` package contains the following major sections, which are regularly updated. * Contributing to `OG-ZAF` diff --git a/environment.yml b/environment.yml index 0a81fbf..be660a0 100644 --- a/environment.yml +++ b/environment.yml @@ -4,6 +4,8 @@ channels: dependencies: - python>=3.7.7, <3.12 - numpy +- setuptools +- wheel - numba>=0.54 - scipy>=1.7.1 - pandas>=1.2.5 @@ -14,11 +16,10 @@ dependencies: - paramtools>=0.15.0 - sphinx>=3.5.4 - sphinx-book-theme>=0.1.3 -- pip +- jupyter-book>=0.11.3 - pytest>=6.0 -- pytest-pep8 +- pytest-cov - pytest-xdist -- pycodestyle - pylint - coverage - requests @@ -28,9 +29,8 @@ dependencies: - black - jupyter - ipython -- setuptools +- pip - pip: - - jupyter-book>=0.9.1 - openpyxl>=3.1.2 - pandas-datareader - linecheck diff --git a/ogzaf/__init__.py b/ogzaf/__init__.py new file mode 100644 index 0000000..75d83a6 --- /dev/null +++ b/ogzaf/__init__.py @@ -0,0 +1,11 @@ +""" +Specify what is available to import from the ogzaf package. +""" + +from ogzaf.calibrate import * +from ogzaf.income import * +from ogzaf.input_output import * +from ogzaf.macro_params import * +from ogzaf.utils import * + +__version__ = "0.0.2" diff --git a/setup.py b/setup.py index 8f8da6f..80f8331 100644 --- a/setup.py +++ b/setup.py @@ -1,41 +1,26 @@ -"""This file contains the OG-ZAF package's metadata and dependencies.""" - -from setuptools import find_packages, setup +import setuptools with open("README.md", "r") as readme_file: - readme = readme_file.read() + longdesc = readme_file.read() -setup( +setuptools.setup( name="ogzaf", version="0.0.2", author="Marcelo LaFleur, Richard W. Evans, and Jason DeBacker", license="CC0 1.0 Universal (CC0 1.0) Public Domain Dedication", description="South Africa Calibration for OG-Core", - long_description=readme, long_description_content_type="text/markdown", - classifiers=[ - "Development Status :: 5 - Production/Stable", - "Intended Audience :: Developers", - "Natural Language :: English", - "License :: OSI Approved :: Common Public License", - "Operating System :: POSIX", - "Programming Language :: Python", - "Programming Language :: Python :: 3.9", - "Programming Language :: Python :: 3.10", - "Programming Language :: Python :: 3.11", - "Topic :: Scientific/Engineering :: Information Analysis", - "Topic :: Software Development :: Libraries :: Python Modules", - ], - keywords="South Africa calibration of large scale overlapping generations model of fiscal policy", + long_description=longdesc, + keywords="ZAF South Africa calibration of large scale overlapping generations model of fiscal policy", url="https://github.com/EAPD-DRB/OG-ZAF/", download_url="https://github.com/EAPD-DRB/OG-ZAF/", project_urls={ "Issue Tracker": "https://github.com/EAPD-DRB/OG-ZAF/issues", }, packages=["ogzaf"], - package_data={"ogzaf": ["ogusa_default_parameters.json", "data/*"]}, + package_data={"ogzaf": ["ogzaf_default_parameters.json", "data/*"]}, include_packages=True, - python_requires=">=3.7.7", + python_requires=">=3.7.7, <3.12", install_requires=[ "numpy", "psutil", @@ -51,9 +36,22 @@ "openpyxl>=3.1.2", "statsmodels", "linearmodels", + "wheel", "black", "linecheck", "ogcore", ], + classifiers=[ + "Development Status :: 5 - Production/Stable", + "Intended Audience :: Developers", + "Natural Language :: English", + "License :: OSI Approved :: Common Public License", + "Operating System :: POSIX", + "Programming Language :: Python", + "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", + "Topic :: Scientific/Engineering :: Information Analysis", + "Topic :: Software Development :: Libraries :: Python Modules", + ], tests_require=["pytest"], )