Skip to content

Commit

Permalink
Merge pull request #2740 from martinholmer/add-tmd
Browse files Browse the repository at this point in the history
Add capability to handle tmd input
  • Loading branch information
jdebacker committed May 7, 2024
2 parents 1426cd1 + 6a869c6 commit e899e7a
Show file tree
Hide file tree
Showing 28 changed files with 167 additions and 166 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.

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
16 changes: 8 additions & 8 deletions conda.recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ build:

requirements:
build:
- "python<3.12"
- "numpy>=1.14"
- "pandas>=1.2.0"
- "bokeh>=1.4.0, <3.0.0"
- "python>=3.9, <3.12"
- "numpy>=1.20, <2.0"
- "pandas>=2.0, <3.0"
- "bokeh>=1.4, <3.0"
- requests
- numba
- "paramtools>=0.18.0"
Expand All @@ -21,10 +21,10 @@ requirements:
- openpyxl

run:
- "python<3.12"
- "numpy>=1.14"
- "pandas>=1.2.0"
- "bokeh>=1.4.0, <3.0.0"
- "python>=3.9, <3.12"
- "numpy>=1.20, <2.0"
- "pandas>=2.0, <3.0"
- "bokeh>=1.4, <3.0"
- requests
- numba
- "paramtools>=0.18.0"
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
16 changes: 7 additions & 9 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,23 @@ 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"
- "python>=3.9, <3.12"
- "numpy>=1.20, <2.0"
- "pandas>=2.0, <3.0"
- "bokeh>=1.4, <3.0"
- requests
- aiohttp
- numba
- "paramtools>=0.18.0"
- "fsspec<=0.8.7"
- aiohttp
- 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
1 change: 1 addition & 0 deletions taxcalc.egg-info/SOURCES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ taxcalc/puf_weights.csv.gz
taxcalc/records.py
taxcalc/records_variables.json
taxcalc/taxcalcio.py
taxcalc/tmd_weights.csv.gz
taxcalc/utils.py
taxcalc/utilsprvt.py
taxcalc.egg-info/PKG-INFO
Expand Down
6 changes: 5 additions & 1 deletion taxcalc/cli/tc.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,11 @@ def cli_tc_main():
sys.stderr.write(tcio.errmsg)
sys.stderr.write('USAGE: tc --help\n')
return 1
aging = inputfn.endswith('puf.csv') or inputfn.endswith('cps.csv')
aging = (
inputfn.endswith('puf.csv') or
inputfn.endswith('cps.csv') or
inputfn.endswith('tmd.csv')
)
tcio.init(input_data=inputfn, tax_year=taxyear,
baseline=args.baseline,
reform=args.reform, assump=args.assump,
Expand Down
2 changes: 1 addition & 1 deletion taxcalc/consumption.json
Original file line number Diff line number Diff line change
Expand Up @@ -282,4 +282,4 @@
}
}
}
}
}
2 changes: 1 addition & 1 deletion taxcalc/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,6 @@ def _read_weights(self, weights):

def _extrapolate(self, year):
"""
Apply to dats variables the growth factor values for specified year.
Apply to data variables the growth factor values for specified year.
"""
# Override this empty method in subclass
2 changes: 1 addition & 1 deletion taxcalc/growdiff.json
Original file line number Diff line number Diff line change
Expand Up @@ -500,4 +500,4 @@
}
}
}
}
}
12 changes: 9 additions & 3 deletions taxcalc/growdiff.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import os
import numpy as np
from taxcalc.parameters import Parameters
from taxcalc.policy import Policy
from taxcalc.growfactors import GrowFactors


Expand All @@ -26,8 +27,8 @@ class GrowDiff(Parameters):
class instance: GrowDiff
"""

JSON_START_YEAR = 2013 # must be same as Policy.JSON_START_YEAR
DEFAULT_NUM_YEARS = 22 # must be same as Policy.DEFAULT_NUM_YEARS
JSON_START_YEAR = Policy.JSON_START_YEAR
DEFAULT_NUM_YEARS = Policy.DEFAULT_NUM_YEARS
DEFAULTS_FILE_NAME = 'growdiff.json'
DEFAULTS_FILE_PATH = os.path.abspath(os.path.dirname(__file__))

Expand Down Expand Up @@ -75,8 +76,13 @@ def apply_to(self, growfactors):
"""
assert isinstance(growfactors, GrowFactors)
for gfvn in GrowFactors.VALID_NAMES:
_gfvn = '_{}'.format(gfvn)
_gfvn = f'_{gfvn}'
for i in range(0, self.num_years):
cyr = i + self.start_year
diff_array = getattr(self, _gfvn)
growfactors.update(gfvn, cyr, diff_array[i])

def set_rates(self):
"""
Unimplemented base class method that is not used here.
"""

0 comments on commit e899e7a

Please sign in to comment.