Skip to content

Commit

Permalink
merge
Browse files Browse the repository at this point in the history
  • Loading branch information
Bodi Yang committed May 22, 2024
2 parents dae36e2 + dd98341 commit 994eec9
Show file tree
Hide file tree
Showing 42 changed files with 365 additions and 605 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Build Package and Test Source Code [Python 3.9, 3.10, 2.11]
name: Build Package and Test Source Code [Python 3.9, 3.10, 3.11]

on: [push, pull_request]

Expand Down Expand Up @@ -34,7 +34,7 @@ jobs:
shell: bash -l {0}
working-directory: ./
run: |
pytest -m 'not requires_pufcsv and not pre_release and not local' --cov=./ --cov-report=xml
pytest -m 'not requires_pufcsv and not requires_tmdcsv and not pre_release and not local' --cov=./ --cov-report=xml
- name: Upload coverage to Codecov
if: matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@v4
Expand Down
49 changes: 0 additions & 49 deletions .github/workflows/build_new_test_benchmark.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/check_jupyterbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
with:
activate-environment: taxcalc-dev
environment-file: environment.yml
python-version: 3.8
python-version: 3.11
auto-activate-base: false

- name: Build # Build Jupyter Book
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/deploy_jupyterbook.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Build and Deploy Jupyter Book
on:
push:
branches:
branches:
- master
jobs:
build-and-deploy:
Expand All @@ -18,7 +18,7 @@ jobs:
with:
activate-environment: taxcalc-dev
environment-file: environment.yml
python-version: 3.8
python-version: 3.11
auto-activate-base: false

- name: Build # Build Jupyter Book
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy_parameters_docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
with:
activate-environment: taxcalc-dev
environment-file: environment.yml
python-version: 3.9
python-version: 3.11
auto-activate-base: false

- name: Build # Build Jupyter Book
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ read-the-docs/_build/

# IRS-SOI PUF data file
puf.csv
tmd.csv

# Jupyter notebook checkpoints
*.ipynb_checkpoints*
Expand Down
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ include taxcalc/policy_current_law.json
include taxcalc/puf_weights.csv.gz
include taxcalc/puf_ratios.csv
include taxcalc/records_variables.json

include taxcalc/tmd_weights.csv.gz
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,19 @@ endef
.PHONY=pytest-cps
pytest-cps:
@$(pytest-setup)
@cd taxcalc ; pytest -n4 --disable-warnings -m "not requires_pufcsv and not pre_release"
@cd taxcalc ; pytest -n4 --disable-warnings --durations=0 --durations-min=2 -m "not requires_pufcsv and not requires_tmdcsv and not pre_release"
@$(pytest-cleanup)

.PHONY=pytest
pytest:
@$(pytest-setup)
@cd taxcalc ; pytest -n4 -m "not pre_release"
@cd taxcalc ; pytest -n4 --disable-warnings --durations=0 --durations-min=2 -m "not pre_release"
@$(pytest-cleanup)

.PHONY=pytest-all
pytest-all:
@$(pytest-setup)
@cd taxcalc ; pytest -n4 -m ""
@cd taxcalc ; pytest -n4 --disable-warnings --durations=0 --durations-min=2 -m ""
@$(pytest-cleanup)

define tctest-cleanup
Expand Down Expand Up @@ -103,7 +103,7 @@ define coverage-cleanup
rm -f .coverage htmlcov/*
endef

COVMARK = "not requires_pufcsv and not pre_release"
COVMARK = "not requires_pufcsv and not requires_tmdcsv and not pre_release"

OS := $(shell uname -s)

Expand Down
28 changes: 12 additions & 16 deletions conda.recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,30 +8,26 @@ build:

requirements:
build:
- "python<3.12"
- "numpy>=1.14"
- "pandas>=1.2.0"
- "bokeh>=1.4.0, <3.0.0"
- requests
- numba
- "python>=3.9, <3.12"
- "numpy>=1.20"
- "pandas>=2.2"
- "bokeh>=2.4"
- "paramtools>=0.18.0"
- behresp
- aiohttp
- numba
- curl
- openpyxl
- behresp

run:
- "python<3.12"
- "numpy>=1.14"
- "pandas>=1.2.0"
- "bokeh>=1.4.0, <3.0.0"
- requests
- numba
- "python>=3.9, <3.12"
- "numpy>=1.20"
- "pandas>=2.2"
- "bokeh>=2.4"
- "paramtools>=0.18.0"
- behresp
- aiohttp
- numba
- curl
- openpyxl
- behresp

test:
commands:
Expand Down
13 changes: 13 additions & 0 deletions docs/about/releases.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,19 @@ Release history
Go [here](https://github.com/PSLmodels/Tax-Calculator/pulls?q=is%3Apr+is%3Aclosed)
for a complete commit history.

2024-05-10 Release 3.6.0
------------------------
(last merged pull request is
[#2743](https://github.com/PSLmodels/Tax-Calculator/pull/2743))

**This is an enhancement release.**

**API Changes**

**New Features**
- Adds capabilites to handle `tmd*` files from the tax-microdata repository [[#2740](https://github.com/PSLmodels/Tax-Calculator/pull/2740) by Martin Holmer]
- Minor updates to documentation, testing, and environment by Martin Holmer and Jason DeBacker in various PRs

2024-04-04 Release 3.5.3
------------------------
(last merged pull request is
Expand Down
2 changes: 1 addition & 1 deletion docs/contributing/dependencies.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Python

Tax-Calculator currently runs on Python 3.7, 3.8, and 3.9.
Tax-Calculator currently runs on Python 3.9, 3.10, and 3.11.
We generally support the three latest major Python releases.

Updating the Python version requires modifying the following files:
Expand Down
2 changes: 1 addition & 1 deletion docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ The cross-model validation work with NBER's TAXSIM-27 model is described

## Latest release

{doc}`3.5.3 (2024-04-04) <about/releases>`
{doc}`3.6.0 (2024-05-10) <about/releases>`

If you are already using Tax-Calculator, upgrade using the following command:

Expand Down
79 changes: 67 additions & 12 deletions docs/usage/data.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,83 @@
Data for Tax-Calculator
=======================

A Tax-Calculator `Records` object is created by passing a Pandas DataFrame or a string that provides the path to a CSV file with data you'd like to use in Tax-Calculator.
A Tax-Calculator `Records` object is created by passing a Pandas
DataFrame or a string that provides the path to a CSV file with data
you'd like to use with Tax-Calculator.


## TaxData
## Using prepared data with Tax-Calculator

To make Tax-Calculator more useful out of the box, it ships with two data options for users, both of which are created by the [TaxData](https://github.com/PSLmodels/TaxData) project. We refer users to that project for more specific documentation of these data, but we provide a brief overview of the two data options provided by TaxData that come with a Tax-Calculator installation.
To make Tax-Calculator more useful out of the box, it includes three
data options for users, two of which (`cps.csv` and `puf.csv`) are
created in the [taxdata
repository](https://github.com/PSLmodels/taxdata), and one of which
(`tmd.csv`) is created in the [tax-microdata
repository](https://github.com/PSLmodels/tax-microdata-benchmarking).
We refer users to those repositories for more specific documentation
of these data, but we provide a brief overview of the three prepared
data options that are compatible with Tax-Calculator.

### Current Population Survey Data
### Current Population Survey data (`cps.csv`)

Using the `Records.cps_constructor()` method to create a `Records` class object, Tax-Calculator users will be loading the `taxdata` Current Population Survey (CPS) data file. This file is based on publicly available survey data, which is then weighted via `taxdata` to hit IRS/SOI targets. The data are then grown out to hit aggregate forecasts through the time horizon available in Tax-Calculator (approximately the next 10 years).
Using the `Records.cps_constructor()` method to create a `Records`
class object, Tax-Calculator users will be loading the `taxdata`
Current Population Survey (CPS) data file. This file is based on
publicly available survey data, which is then weighted in `taxdata` to
hit IRS/SOI targets. The data are then grown out to hit aggregate
forecasts through the time horizon available in Tax-Calculator
(approximately the next 10 years). All the files required to use this
prepared data option are included in the Tax-Calculator package.

Tax-Calculator provides unit tests to ensure that certain totals are hit with the CPS-based file. However, users should note that these tests are simply to ensure **the accuracy of Tax-Calculator's tax logic** and **not the accuracy of the CPS-based data file produced by `taxdata`**. Please see the [TaxData](https://github.com/PSLmodels/TaxData) documentation for any validation of those data.
Tax-Calculator provides unit tests to ensure that certain totals are
hit with the CPS-based file. However, users should note that these
tests are simply to ensure **the accuracy of Tax-Calculator's tax
logic** and **not the accuracy of the CPS-based data file produced by
`taxdata`**. Please see the
[taxdata](https://github.com/PSLmodels/taxdata) documentation for any
validation of those data.

### The IRS Public Use File
### 2011 IRS public use data (`puf.csv`)

The `taxdata` package also produces a weights file and growth factors file for use with the IRS-SOI Public Use File (PUF). A given `taxdata` version typically produces these files for a specific vintage of the PUF. As of `taxdata` v 0.3.1, the 2012 PUF is used.
The taxdata repository also produces a weights file and growth
factors file for use with the 2011 IRS-SOI Public Use File (PUF). For
users who have purchased their own version of the 2011 PUF, the
`puf_weights.csv.gz` and `growfactors.csv` files that are included in
Tax-Calculator can be used along with the `taxdata` generated `puf.csv`
file when using Tax-Calculator.

For users who have purchased their own version of the PUF, the `puf_weights.csv.gz` and `growfactors.csv` files that are included in Tax-Calculator can be used to create a PUF-based dataset suitable for use in Tax-Calculator.
We refer users of the PUF to the IRS limitations on the use of those
data and their distribution. We also refer users of the PUF weights
file and grow factors to the
[taxdata](https://github.com/PSLmodels/taxdata) documentation for
details on how to use these files with the PUF and to see how well the
resulting tax calculations hit aggregate targets published by the IRS.
However, we do note that analysis with a PUF-based data file tends to
be more accurate than the `cps.csv` file and that the validation of
Tax-Calculator with other microsimulation models uses the `puf.csv`
file.

We refer users of the PUF to the IRS limitations on the use of those data and their distribution. We also refer users of the PUF weights file and grow factors to the [TaxData](https://github.com/PSLmodels/TaxData) documentation for details on how to use these files with the PUF and to see how well the resulting tax calculations hit aggregate targets published by the IRS. However, we do note that analysis with a PUF-based data file tends to be the most accurate and validation of Tax-Calculator with other microsimulation models often uses a PUF-based data file.
### 2015 IRS public use data (`tmd.csv`)

## Using other data in Tax-Calculator
The [tax-microdata
repository](https://github.com/PSLmodels/tax-microdata-benchmarking)
produces an input variables file (`tmd.csv`) and a
`tmd_weights.csv.gz` file that is included in the Tax-Calculator
package beginning with the 3.6.0 release. The `tmd.csv` file is
available only to Tax-Calculator users who have purchased their own
version of the 2015 IRS-SOI PUF. For those users, the
`Records.tmd_constructor()` method creates a `Records` class object
containing the `tmd` variables and weights.

Using other data sources in Tax-Calculator is possible. Users can pass any csv file to the `Records` class and, so long as it has the appropriate [input variables](https://taxcalc.pslmodels.org/guide/input_vars.html), one may be able to obtain results. Using Tax-Calculator with custom data takes care and significant understanding of the model and data. Those interested in using their own data in Tax-Calculator might also look to the [Tax-Cruncher](https://github.com/PSLmodels/Tax-Cruncher) project, which is built as an interface between Tax-Calculator and custom datasets.
## Using other data with Tax-Calculator

Using other data sources with Tax-Calculator is possible. Users can
pass any csv file to the `Records` class and, so long as it has the
appropriate [input
variables](https://taxcalc.pslmodels.org/guide/input_vars.html), one
may be able to obtain results. Using Tax-Calculator with custom data
takes care and significant understanding of the model and data. Those
interested in using their own data with Tax-Calculator might also look
to the [Tax-Cruncher](https://github.com/PSLmodels/Tax-Cruncher)
project, which is built as an interface between Tax-Calculator and
custom datasets.
2 changes: 1 addition & 1 deletion docs/usage/starting.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Getting started
===============

Tax-Calculator packages are available for Windows, Mac, and Linux computers
that have the free Anaconda Python 3.7, 3.8, or 3.9 distribution installed.
that have the free Anaconda Python 3.9, 3.10, or 3.11 distribution installed.
You can use Tax-Calculator without doing any Python programming, but the
Anaconda distribution is required for Tax-Calculator to run.
Take the following four steps to get started.
Expand Down
2 changes: 1 addition & 1 deletion docs/usage/tcja_after_2025.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ expire). Compatible input datasets include:
[taxdata](https://github.com/PSLmodels/taxdata) repository and
available only to those with access to the 2011 IRS/SOI PUF

* several newer CSV-formatted input files created in the PSLmodels
* the newer `tmd.csv` file generated in the PSLmodels
[tax-microdata](https://github.com/PSLmodels/tax-microdata-benchmarking)
repository that are based on the 2015 IRS/SOI PUF and on more recent CPS
data, and are available only to those with access to the 2015
Expand Down
17 changes: 6 additions & 11 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,20 @@ name: taxcalc-dev
channels:
- conda-forge
dependencies:
- "python<3.12"
- curl
- "numpy>=1.14"
- "pandas>=1.2.0"
- "bokeh>=1.4.0, <3.0.0"
- requests
- aiohttp
- "python>=3.9, <3.12"
- "numpy>=1.20"
- "pandas>=2.2"
- "bokeh>=2.4"
- "paramtools>=0.18.0"
- numba
- "fsspec<=0.8.7"
- curl
- pytest
- pytest-pep8
- pytest-xdist
- pycodestyle
- pylint
- coverage
- "paramtools>=0.18.0"
- behresp
- openpyxl
- pip
- pip:
- jupyter-book
- pytest_harvest
9 changes: 7 additions & 2 deletions pytest.ini
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,14 @@ testpaths =
taxcalc
markers =
requires_pufcsv
requires_tmdcsv
pre_release
local
compatible_data
local
benefits
itmded_vars
pep8
cpscsv_agg
pufcsv_agg
reforms
rtr
extend_tcja
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
with open("README.md") as f:
longdesc = f.read()

version = "3.5.3"
version = "3.6.0"

config = {
"description": "Tax Calculator",
Expand Down
Loading

0 comments on commit 994eec9

Please sign in to comment.