Skip to content

Commit

Permalink
Merge pull request #797 from rickecon/pip
Browse files Browse the repository at this point in the history
Some PyPI packaging updates and other cleanup
  • Loading branch information
jdebacker authored Apr 1, 2022
2 parents 4b24e2e + a45debb commit 0f34bc2
Show file tree
Hide file tree
Showing 9 changed files with 105 additions and 63 deletions.
4 changes: 0 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ clean:
@find . -name *cache -maxdepth 1 -exec rm -r {} \;
@conda uninstall ccc --yes --quiet 2>&1 > /dev/null

.PHONY=package
package:
@pbrelease OG-Core ogcore 0.0.0 --local

.PHONY=pytest
pytest:
@cd ogcore ; pytest -W ignore
Expand Down
10 changes: 5 additions & 5 deletions PSL_catalog.json
Original file line number Diff line number Diff line change
Expand Up @@ -135,22 +135,22 @@
"core_maintainers": {
"start_header": null,
"end_header": null,
"data": "<ul><li><a href=\"https://sites.google.com/site/rickecon/\">Richard Evans</a></li><li><a href=\"http://jasondebacker.com\">Jason DeBacker</a></li></ul>",
"data": "<ul><li><a href=\"https://sites.google.com/site/rickecon/\">Richard W. Evans</a></li><li><a href=\"http://jasondebacker.com\">Jason DeBacker</a></li></ul>",
"source": null,
"type": "html"
},
"unit_test": {
"start_header": null,
"end_header": null,
"data": "<a href=\"https://github.com/PSLmodels/OG-Core/tree/master/ogusa/tests\">https://github.com/PSLmodels/OG-Core/tree/master/ogusa/tests</a>",
"source": "https://github.com/PSLmodels/OG-Core/tree/master/ogusa/tests",
"data": "<a href=\"https://github.com/PSLmodels/OG-Core/tree/master/tests\">https://github.com/PSLmodels/OG-Core/tree/master/tests</a>",
"source": "https://github.com/PSLmodels/OG-Core/tree/master/tests",
"type": "html"
},
"integration_test": {
"start_header": null,
"end_header": null,
"data": "<a href=\"https://github.com/PSLmodels/OG-Core/tree/master/ogusa/tests\">https://github.com/PSLmodels/OG-Core/tree/master/ogusa/tests</a>",
"source": "https://github.com/PSLmodels/OG-Core/tree/master/ogusa/tests",
"data": "<a href=\"https://github.com/PSLmodels/OG-Core/tree/master/tests\">https://github.com/PSLmodels/OG-Core/tree/master/tests</a>",
"source": "https://github.com/PSLmodels/OG-Core/tree/master/tests",
"type": "html"
}
}
42 changes: 39 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,55 @@ OG-Core is an overlapping-generations (OG) model core theory, logic, and solutio

## Disclaimer

The model is currently under development. Users should be forewarned that the model components could change significantly. Therefore, there is NO GUARANTEE OF ACCURACY. THE CODE SHOULD NOT CURRENTLY BE USED FOR PUBLICATIONS, JOURNAL ARTICLES, OR RESEARCH PURPOSES. Essentially, you should assume the calculations are unreliable until we finish the code re-architecture and have checked the results against other existing implementations of the tax code. The package will have released versions, which will be checked against existing code prior to release. Stay tuned for an upcoming release!
The model is constantly under development, and model components could change significantly. The package will have released versions, which will be checked against existing code prior to release. Stay tuned for an upcoming release!


## 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.


### 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`.
* 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`
* You can adjust the `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_example_plots`
* This folder will contain a number of plots generated from OG-Core to help you visualize the output from your run
* `./ogcore_example_output.csv`
* This is a summary of the percentage changes in macro variables over the first ten years and in the steady-state.
* `./OUTPUT_BASELINE/model_params.pkl`
* Model parameters used in the baseline run
* See [`execute.py`](https://github.com/PSLmodels/OG-Core/blob/master/ogcore/execute.py) in the OG-Core repository for items in the dictionary object in this pickle file
* `./OUTPUT_BASELINE/SS/SS_vars.pkl`
* Outputs from the model steady state solution under the baseline policy
* See [`SS.py`](https://github.com/PSLmodels/OG-Core/blob/master/ogcore/SS.py) in the OG-Core repository for what is in the dictionary object in this pickle file
* `./OUTPUT_BASELINE/TPI/TPI_vars.pkl`
* Outputs from the model timepath solution under the baseline policy
* See [`TPI.py`](https://github.com/PSLmodels/OG-Core/blob/master/ogcore/TPI.py) in the OG-Core repository for what is in the dictionary object in this pickle file
* An analogous set of files in the `./OUTPUT_REFORM` directory, which represent objects from the simulation of the reform policy

Note that, depending on your machine, a full model run (solving for the full time path equilibrium for the baseline and reform policies) can take more than two hours of compute time.

If you run into errors running the example script, please open a new issue in the OG-Core repo with a description of the issue and any relevant tracebacks you receive.

The CSV output file `./ogcore_example_output.csv` can be compared to the [`./run_examples/expected_ogcore_example_output.csv`](https://github.com/PSLmodels/OG-Core/blob/master/run_examples/expected_ogcore_example_output.csv) file in the OG-Core repository to confirm that you are generating the expected output. The easiest way to do this is to copy the [`example-diffs`](https://github.com/PSLmodels/OG-Core/blob/master/run_examples/example-diffs) and [`example-diffs.bat`](https://github.com/PSLmodels/OG-Core/blob/master/run_examples/example-diffs.bat) files from the OG-Core repository and use the `sh example-diffs` command (or `example-diffs` on Windows) from the `run_examples` directory. If you run into errors running the example script, please open a new issue in the OG-Core repo with a description of the issue and any relevant tracebacks you receive.


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

* Install the [Anaconda distribution](https://www.anaconda.com/distribution/) of Python
* 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 .`
* Navigate to `./run_examples`
* Run the model with an example reform from terminal/command prompt by typing `python run_ogcore_example.py`
* You can adjust the `./run_examples/run_ogcore_example.py` by modifying model parameters specified in the `og_spec` dictionary.
* 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`
* This folder will contain a number of plots generated from OG-Core to help you visualize the output from your run
Expand Down Expand Up @@ -55,4 +91,4 @@ The core maintainers of the OG-Core repository are:

## Citing OG-Core

OG-Core (Version 0.0.0)[Source code], https://github.com/PSLmodels/OG-Core
OG-Core (Version #.#.#)[Source code], https://github.com/PSLmodels/OG-Core
2 changes: 1 addition & 1 deletion codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,6 @@ ignore:
- "setup.py"
- "./ogcore/_version.py"
- "./cs-config/**/*" # ignore folders and all its contents
- "./tests/" # ignore folders and all its contents
- "./ogcore/tests/" # ignore folders and all its contents
- "./regression/**/*" # ignore folders and all its contents

2 changes: 1 addition & 1 deletion docs/book/content/intro/intro.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
The model is continuously under development. Users will be notified through [closed PR threads](https://github.com/PSLmodels/OG-Core/pulls?q=is%3Apr+is%3Aclosed) and through the [release notes](https://github.com/PSLmodels/OG-Core/releases) what changes have been implemented. The package will have released versions, which will be checked against existing code prior to release. Stay tuned for an upcoming release!


(Sec_CitingOGUSA)=
(Sec_CitingOGCore)=
## Citing OG-Core

`OG-Core` (Version #.#.#)[Source code], https://github.com/PSLmodels/OG-Core
3 changes: 1 addition & 2 deletions docs/book/content/theory/government.md
Original file line number Diff line number Diff line change
Expand Up @@ -296,5 +296,4 @@ And finally, in closure rules {eq}`EqUnbalGBCclosure_Gt` and {eq}`EqUnbalGBCclos
(SecUBIfootnotes)=
## Footnotes


[^GrowthAdj_note]: We impose this requirement of `ubi_growthadj = False` when `g_y_annual < 0` in the [`ogusa_default_parameters.json`](https://github.com/PSLmodels/OG-USA/blob/master/ogusa/ogusa_default_parameters.json) "validators" specification of the parameter.
[^GrowthAdj_note]: We impose this requirement of `ubi_growthadj = False` when `g_y_annual < 0` in the [`default_parameters.json`](https://github.com/PSLmodels/OG-Core/blob/master/ogcore/default_parameters.json) "validators" specification of the parameter.
2 changes: 1 addition & 1 deletion ogcore/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@
from ogcore.txfunc import *
from ogcore.utils import *

__version__ = '0.0.0'
__version__ = '0.8.1'
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[build-system]
requires = ["setuptools>=42"]
build-backend = "setuptools.build_meta"
100 changes: 54 additions & 46 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,48 +1,56 @@
try:
from setuptools import setup
except ImportError:
from distutils.core import setup
import setuptools

with open('README.md') as f:
longdesc = f.read()
with open("README.md", "r", encoding="utf-8") as fh:
longdesc = fh.read()

version = '0.8.0'

config = {
'description': 'A general equilibribum overlapping generations model for fiscal policy analysis',
'long_description_content_type': 'text/markdown',
'long_description': longdesc,
'url': 'https://github.com/PSLmodels/OG-Core/',
'download_url': 'https://github.com/PLSmodels/OG-Core/',
'version': version,
'license': 'CC0 1.0 Universal (CC0 1.0) Public Domain Dedication',
'packages': ['ogcore'],
'include_package_data': True,
'name': 'ogcore',
'install_requires': [
'mkl', 'psutil', 'scipy', 'pandas', 'matplotlib', 'dask',
'distributed', 'paramtools'],
'package_data': {
'ogcore': [
'default_parameters.json',
'data/ability/*',
'data/demographic/*',
'data/labor/*',
'data/wealth/*']
},
'classifiers': [
'Development Status :: 2 - Pre-Alpha',
'Intended Audience :: Developers',
'Natural Language :: English',
'License :: CC0 1.0 Universal (CC0 1.0) Public Domain Dedication',
'Operating System :: OS Independent',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.7',
'Programming Language :: Python :: 3.8',
'Programming Language :: Python :: 3.9',
'Topic :: Software Development :: Libraries :: Python Modules'],
'tests_require': ['pytest']
}

setup(**config)
setuptools.setup(
name="ogcore",
version="0.8.1",
author="Jason DeBacker and Richard W. Evans",
license="CC0 1.0 Universal (CC0 1.0) Public Domain Dedication",
description="A general equilibribum overlapping generations model for fiscal policy analysis",
long_description_content_type="text/markdown",
long_description=longdesc,
url="https://github.com/PSLmodels/OG-Core/",
download_url="https://github.com/PLSmodels/OG-Core/",
project_urls={
"Issue Tracker": "https://github.com/PSLmodels/OG-Core/issues",
},
packages=["ogcore"],
package_data={
"ogcore": [
"default_parameters.json",
"data/ability/*",
"data/demographic/*",
"data/labor/*",
"data/wealth/*"
]
},
include_packages=True,
python_requires=">=3.7.7",
install_requires=[
"mkl>=2021.4.0",
"psutil",
"scipy>=1.7.1",
"pandas>=1.2.5",
"matplotlib",
"dask>=2.30.0",
"distributed>=2.30.1",
"paramtools>=0.15.0",
"requests"
],
classifiers=[
"Development Status :: 2 - Pre-Alpha",
"Intended Audience :: Developers",
"Natural Language :: English",
"License :: CC0 1.0 Universal (CC0 1.0) Public Domain Dedication",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Topic :: Software Development :: Libraries :: Python Modules"
],
tests_require=["pytest"]
)

0 comments on commit 0f34bc2

Please sign in to comment.