Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge #54

Merged
merged 57 commits into from
Oct 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
57 commits
Select commit Hold shift + click to select a range
025d9c2
Add update_pcl.py script
martinholmer Sep 22, 2024
937609b
Add 2023 values to policy_current_law.json
martinholmer Sep 22, 2024
87cc30a
Update some 2023+ values in tests/cpscsv_agg_expect.csv file
martinholmer Sep 22, 2024
33d49bc
Clean up test_policy.py code
martinholmer Sep 22, 2024
6daa066
Rename and update rounding2023.json reform
martinholmer Sep 23, 2024
65aecb3
Update Policy.LAST_KNOWN_YEAR to 2023
martinholmer Sep 23, 2024
4d50a26
Fix poorly designed test in test_policy.py
martinholmer Sep 23, 2024
da18080
Rename rounding reform
martinholmer Sep 23, 2024
15d1de8
Update expected puf-related test results
martinholmer Sep 23, 2024
ab87f00
Fix issue #2798
martinholmer Sep 23, 2024
81c0a3a
Update taxcalc.egg-info/SOURCES.txt file
martinholmer Sep 24, 2024
b0d0358
Generalize Records.tmd_constructor static method
martinholmer Sep 24, 2024
0936659
Merge pull request #2809 from martinholmer/revise-tmd-ctor
martinholmer Sep 24, 2024
f3d06a7
Revise TMD-related taxcalcio.py logic
martinholmer Sep 24, 2024
4d12259
Add checks for TMD weights/gfactors file existence
martinholmer Sep 24, 2024
a421ff4
Remove two tmd_* data files and tmd test
martinholmer Sep 24, 2024
fc222b7
Add type checking to Records.tmd_constructor logic
martinholmer Sep 24, 2024
a3b8402
Streamline tmd logic in taxcalcio.py code
martinholmer Sep 24, 2024
fa2e518
Update docs/usage/data.md document
martinholmer Sep 24, 2024
c698a38
Merge pull request #2810 from martinholmer/revise-taxcalcio-logic
martinholmer Sep 25, 2024
e897b15
Merge in recent changes on master branch
martinholmer Sep 25, 2024
14406e9
Merge in recent changes on master branch
martinholmer Sep 25, 2024
3db9956
Merge pull request #2806 from martinholmer/fix-2805
martinholmer Sep 26, 2024
56dba1b
Merge pull request #2807 from martinholmer/fix-2798
martinholmer Sep 26, 2024
1d1b6e2
Fix CLI tool weights file handling
martinholmer Sep 26, 2024
86b8b74
Move 'pragma: no cover' comment
martinholmer Sep 26, 2024
4471479
Merge pull request #2811 from martinholmer/fix-cli
martinholmer Sep 26, 2024
08a1166
Fix Records.tmd_constructor logic
martinholmer Sep 28, 2024
76ccd83
Merge pull request #2813 from martinholmer/fix-tmd-ctor
martinholmer Sep 28, 2024
cb6c1e8
Add 2024 values to update_pcl.py; use to update policy_current_law.json
martinholmer Sep 28, 2024
2483957
Fix ad hoc FST_AGI_thd_lo and FST_AGI_thd_hi values
martinholmer Sep 28, 2024
ba5a400
Update a few expected test results for 2024+
martinholmer Sep 28, 2024
62a34b8
Update .github/workflows/build_and_test.yml
martinholmer Sep 28, 2024
ed04e7a
Add stded marker in pytest.ini
martinholmer Sep 28, 2024
1fdf79b
Merge pull request #2816 from martinholmer/add-2024-param-vals
martinholmer Sep 28, 2024
c0117b7
Add comment on use of extend_tcja.py script
martinholmer Sep 28, 2024
4f99b63
Update reforms/ext.json using output from extend_tcja.py script
martinholmer Sep 28, 2024
38685ca
Update expected results generated by the ext.json reform
martinholmer Sep 28, 2024
294b6aa
Merge pull request #2817 from martinholmer/update-tcja-ext-reform
martinholmer Sep 28, 2024
ed000d7
Fix policy_current_law.json
martinholmer Sep 29, 2024
461eb71
Fix extend_tcja.py to handle ALD_BusinessLosses_c revert timing
martinholmer Sep 29, 2024
50e4110
Revise reforms/ext.json to handle ALD_BusinessLosses_c revert timing
martinholmer Sep 29, 2024
9eeec8c
Add extend_tcja step to docs/contributing/RELEASING.md
martinholmer Sep 29, 2024
46909c4
Fix typo in extend_tcja.py script
martinholmer Sep 29, 2024
7b16184
Fix typo in ext.json
martinholmer Sep 29, 2024
8a4208d
Update tests/pufcsv_agg_expect.csv results
martinholmer Sep 29, 2024
32530c7
Better handle tailing comma in extend_tcja.py
martinholmer Sep 30, 2024
0b44325
Make the ppp.py script usable
martinholmer Sep 30, 2024
6b6674f
Merge pull request #2818 from martinholmer/fix-bizloss-ald-policy
martinholmer Sep 30, 2024
634735e
Merge in recent changes on master branch
martinholmer Sep 30, 2024
342e2a1
Revise docs/contributing/RELEASING.md
martinholmer Oct 1, 2024
2c8ceb1
FIx typos in ppp.py script
martinholmer Oct 1, 2024
a6251fc
Merge pull request #2819 from martinholmer/enhance-ppp
martinholmer Oct 1, 2024
44b4336
Update version to 4.3.0 and add release details
martinholmer Oct 1, 2024
df98ae5
Finish updating Tax-Calculator to 4.3.0 version
martinholmer Oct 1, 2024
cab20d8
Fix comments in update_pcl.py script
martinholmer Oct 1, 2024
af96206
Merge pull request #2820 from martinholmer/4-3-0
jdebacker Oct 2, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build_and_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
shell: bash -l {0}
working-directory: ./
run: |
pytest -m 'not requires_pufcsv and not requires_tmdcsv and not pre_release and not local' --cov=./ --cov-report=xml
pytest -m 'not requires_pufcsv and not pre_release and not local' --cov=./ --cov-report=xml
- name: Upload coverage to Codecov
if: matrix.os == 'ubuntu-latest' && contains(github.repository, 'PSLmodels/Tax-Calculator')
uses: codecov/codecov-action@v4
Expand Down
2 changes: 0 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,3 @@ 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
include taxcalc/tmd_growfactors.csv
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ help:
@echo "clean : remove .pyc files and local taxcalc package"
@echo "package : build and install local package"
@echo "pytest-cps : generate report for and cleanup after"
@echo " pytest -m 'not requires_pufcsv and not requires_tmdcsv and not pre_release'"
@echo " pytest -m 'not requires_pufcsv and not pre_release'"
@echo "pytest : generate report for and cleanup after"
@echo " pytest -m 'not pre_release'"
@echo "pytest-all : generate report for and cleanup after"
Expand Down Expand Up @@ -51,7 +51,7 @@ endef
.PHONY=pytest-cps
pytest-cps:
@$(pytest-setup)
@cd taxcalc ; pytest -n4 --disable-warnings --durations=0 --durations-min=2 -m "not requires_pufcsv and not requires_tmdcsv and not pre_release"
@cd taxcalc ; pytest -n4 --disable-warnings --durations=0 --durations-min=2 -m "not requires_pufcsv and not pre_release"
@$(pytest-cleanup)

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

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

OS := $(shell uname -s)

Expand Down
1 change: 1 addition & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@ comment:

ignore:
- "setup.py"
- "update_pcl.py"
- "ppp.py"
- "extend_tcja.py"
23 changes: 23 additions & 0 deletions docs/about/releases.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,29 @@ Release history
Go [here](https://github.com/PSLmodels/Tax-Calculator/pulls?q=is%3Apr+is%3Aclosed)
for a complete commit history.


2024-10-02 Release 4.3.0
------------------------
(last merged pull request is
[#2819](https://github.com/PSLmodels/Tax-Calculator/pull/2819))

**This is an enhancement and bug-fix release.**

**API Changes**

**New Features**
- Add known values of inflation-indexed policy parameters for 2023 [[#2806](https://github.com/PSLmodels/Tax-Calculator/pull/2806) by Martin Holmer]
- Enhance `Records.tmd_constructor` static method [[#2809](https://github.com/PSLmodels/Tax-Calculator/pull/2809) by Martin Holmer]
- Remove TMD data files from Tax-Calculator repository [[#2810](https://github.com/PSLmodels/Tax-Calculator/pull/2810) by Martin Holmer]
- Add known values of inflation-indexed policy parameters for 2024 [[#2816](https://github.com/PSLmodels/Tax-Calculator/pull/2816) by Martin Holmer]
- Enhance `extend_tcja.py` and update `reforms/ext.json` [[#2817](https://github.com/PSLmodels/Tax-Calculator/pull/2817) by Martin Holmer]
- Enhance `ppp.py` script [[#2819](https://github.com/PSLmodels/Tax-Calculator/pull/2819) by Martin Holmer]

**Bug Fixes**
- Fix specification of domestic production deduction under TCJA [[#2807](https://github.com/PSLmodels/Tax-Calculator/pull/2807) by Martin Holmer]
- Fix `ALD_BusinessLosses_c` parameter values after 2025 [[#2818](https://github.com/PSLmodels/Tax-Calculator/pull/2818) by Martin Holmer]


2024-09-14 Release 4.2.2
------------------------
(last merged pull request is
Expand Down
12 changes: 10 additions & 2 deletions docs/contributing/RELEASING.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
Releasing Tax-Caclculator Packages
==================================

The following outlines the process to release Tax-Calculator Packages on Conda-Forge and creating a new branch to fix a bug in a previous release.
The following outlines the process to release Tax-Calculator Packages
on Conda-Forge and creating a new branch to fix a bug in a previous
release.

Create new `taxcalc` packages
===========================
=============================
```

--> on branch X-Y-Z, edit docs/about/releases.md to finalize X.Y.Z info
Expand All @@ -13,6 +15,12 @@ Create new `taxcalc` packages

--> merge master branch into X-Y-Z branch

--> run `python update_pcl.py` [to update policy_current_law.json if needed]

--> run `python ppp.py` [to update policy_current_law.json if needed]

--> run `python extend_tcja.py > ext.json` [to update reforms/ext.json]

--> run `make tctest-jit` [to make sure JIT decorators are not hiding bugs]

--> run `make pytest-all` [or `pytest -m pre_release -n4` in taxcalc subdir]
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}`4.2.2 (2024-09-14) <about/releases>`
{doc}`4.3.0 (2024-10-02) <about/releases>`

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

Expand Down
13 changes: 8 additions & 5 deletions docs/usage/data.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,16 @@ file.

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
produces an input variables file (`tmd.csv`), a national weights file
(`tmd_weights.csv.gz`), and a variable growth factors file
(`tmd_growfactors.csv`) that can be used with 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.
version of the 2015 IRS-SOI PUF. For those users, those three files
are avaiable from the tax-microdata repository. These three tmd files
can be used with the Tax-Calculator Python API (using the
`Records.tmd_constructor()` static method) or with the Tax-Calculator
CLI tool, `tc`.

## Using other data with Tax-Calculator

Expand Down
53 changes: 38 additions & 15 deletions extend_tcja.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,15 @@
extend_tcja.json, that can serve as an alternative baseline to
current-law policy (which ends TCJA temporary provisions after 2025).

USAGE: (taxcalc-dev) ~% python extend_tcja.py
USAGE: (taxcalc-dev) Tax-Calculator% python extend_tcja.py > ext.json
THEN CHECK: % diff ext.json taxcalc/reforms/ext.json
IF DIFFS: % mv ext.json taxcalc/reforms/ext.json

IMPORTANT NOTE: be sure to remove the trailing comma after the last item
in the reform JSON object generated by this script.
WHEN TO USE: use this script to update reforms/ext.json in these situations:
(a) whenever inflation rates in the growfactors.csv files are changed
OR
(b) whenever inflation-indexed parameters are updated (usually as part
of changes that increase the value of Policy.LAST_KNOWN_YEAR).
"""

import sys
Expand Down Expand Up @@ -76,64 +81,82 @@
"PT_qbid_alt_property_rt": {"indexed": False, "category": 7},
# category 8 ...
"ALD_BusinessLosses_c": {"indexed": True, "category": 8},
"ALD_DomesticProduction_hc": {"indexed": False, "category": 8},
}


def main():
"""
High-level script logic.
"""
# identify last parameter name in TCJA_PARAMETERS
last_pname = list(TCJA_PARAMETERS.keys())[-1]
# calculate 2025-to-2026 parameters indexing factor
pol = taxcalc.Policy()
pirates = pol.inflation_rates()
ifactor = 1.0 + pirates[2025-taxcalc.Policy.JSON_START_YEAR]
ifactor25 = 1.0 + pirates[2025-taxcalc.Policy.JSON_START_YEAR]
ifactor28 = 1.0 + pirates[2028-taxcalc.Policy.JSON_START_YEAR]
# specify extend-TCJA-beyond-2025 reform
# ... get 2025 parameter values
pol.set_year(2025)
pdata = dict(pol.items())
# ... write reform header comments
print( '// REFORM TO EXTEND TEMPORARY TCJA PROVISIONS BEYOND 2025')
print(f'// USING TAX-CALCULATOR {taxcalc.__version__}')
print(f'// WITH 2025-to-2026 INDEXING FACTOR = {ifactor:.6f}')
print(f'// WITH 2025-to-2026 INDEXING FACTOR = {ifactor25:.6f}')
print(f'// AND 2028-to-2029 INDEXING FACTOR = {ifactor28:.6f}')
if TCJA_CATEGORY:
print(f'// ONLY TCJA PROVISIONS IN CATEGORY {TCJA_CATEGORY}')
print('{')
# ... set 2026 nonreverted values for the parameters set to revert
# ... set 2026/29 nonreverted values for the parameters set to revert
left_brace = '{'
right_brace = '}'
year = 2026
for pname, pinfo in TCJA_PARAMETERS.items():
if TCJA_CATEGORY and pinfo['category'] != TCJA_CATEGORY:
continue # skip this parameter
if pname == 'ALD_BusinessLosses_c':
ifactor = ifactor28
year = 2029
pol.set_year(2028)
pdata = dict(pol.items())
else:
if year != 2026:
pol.set_year(2025)
pdata = dict(pol.items())
ifactor = ifactor25
year = 2026
trailing_comma = '' if pname == last_pname else ','
if pinfo['indexed']:
pval = pdata[pname][0] * ifactor
if isinstance(pval, numpy.ndarray):
# handle vector parameter
pval = numpy.minimum(9e99, pval.round(2))
sys.stdout.write(f' "{pname}": ')
sys.stdout.write('{"2026": ')
sys.stdout.write(f'{left_brace}"{year}": ')
sys.stdout.write(f'{pval.tolist()}')
sys.stdout.write('},\n')
sys.stdout.write(f'{right_brace}{trailing_comma}\n')
else:
# handle scalar parameter
pval = min(9e99, pval)
sys.stdout.write(f' "{pname}": ')
sys.stdout.write('{"2026": ')
sys.stdout.write(f'{left_brace}"{year}": ')
sys.stdout.write(f'{pval*ifactor:.2f}')
sys.stdout.write('},\n')
sys.stdout.write(f'{right_brace}{trailing_comma}\n')
else: # if parameter is not indexed
pval = pdata[pname][0]
if isinstance(pval, numpy.ndarray):
# handle vector parameter
pval = numpy.minimum(9e99, pval.round(2))
sys.stdout.write(f' "{pname}": ')
sys.stdout.write('{"2026": ')
sys.stdout.write(f'{left_brace}"{year}": ')
sys.stdout.write(f'{pval.tolist()}')
sys.stdout.write('},\n')
sys.stdout.write(f'{right_brace}{trailing_comma}\n')
else:
# handle scalar parameter
sys.stdout.write(f' "{pname}": ')
sys.stdout.write('{"2026": ')
sys.stdout.write(f'{left_brace}"{year}": ')
sys.stdout.write(f'{pval:.2f}')
sys.stdout.write('},\n')
sys.stdout.write(f'{right_brace}{trailing_comma}\n')
print('}')
return 0
# end main function code
Expand Down
Loading
Loading