diff --git a/Makefile b/Makefile index 06e4eee07..303a3a0d6 100644 --- a/Makefile +++ b/Makefile @@ -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 diff --git a/PSL_catalog.json b/PSL_catalog.json index d81db79b7..8e4207b0c 100644 --- a/PSL_catalog.json +++ b/PSL_catalog.json @@ -135,22 +135,22 @@ "core_maintainers": { "start_header": null, "end_header": null, - "data": "", + "data": "", "source": null, "type": "html" }, "unit_test": { "start_header": null, "end_header": null, - "data": "https://github.com/PSLmodels/OG-Core/tree/master/ogusa/tests", - "source": "https://github.com/PSLmodels/OG-Core/tree/master/ogusa/tests", + "data": "https://github.com/PSLmodels/OG-Core/tree/master/tests", + "source": "https://github.com/PSLmodels/OG-Core/tree/master/tests", "type": "html" }, "integration_test": { "start_header": null, "end_header": null, - "data": "https://github.com/PSLmodels/OG-Core/tree/master/ogusa/tests", - "source": "https://github.com/PSLmodels/OG-Core/tree/master/ogusa/tests", + "data": "https://github.com/PSLmodels/OG-Core/tree/master/tests", + "source": "https://github.com/PSLmodels/OG-Core/tree/master/tests", "type": "html" } } diff --git a/README.md b/README.md index 91a5a7c1e..d67243f9e 100644 --- a/README.md +++ b/README.md @@ -9,11 +9,47 @@ 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` @@ -21,7 +57,7 @@ The model is currently under development. Users should be forewarned that the mo * 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 @@ -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 diff --git a/codecov.yml b/codecov.yml index 3d35e1838..f72701275 100644 --- a/codecov.yml +++ b/codecov.yml @@ -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 - diff --git a/docs/book/content/intro/intro.md b/docs/book/content/intro/intro.md index 798fa5e59..71cbdc902 100644 --- a/docs/book/content/intro/intro.md +++ b/docs/book/content/intro/intro.md @@ -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 diff --git a/docs/book/content/theory/government.md b/docs/book/content/theory/government.md index 247ac0de7..cd72f5187 100644 --- a/docs/book/content/theory/government.md +++ b/docs/book/content/theory/government.md @@ -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. diff --git a/ogcore/__init__.py b/ogcore/__init__.py index b017efa1a..31aaf681e 100644 --- a/ogcore/__init__.py +++ b/ogcore/__init__.py @@ -19,4 +19,4 @@ from ogcore.txfunc import * from ogcore.utils import * -__version__ = '0.0.0' +__version__ = '0.8.1' diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 000000000..b0f076532 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,3 @@ +[build-system] +requires = ["setuptools>=42"] +build-backend = "setuptools.build_meta" diff --git a/setup.py b/setup.py index 6d56828e2..995d43d25 100755 --- a/setup.py +++ b/setup.py @@ -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"] +)