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

Apply five-year-forward check on all reforms #5136

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 4 additions & 0 deletions changelog_entry.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- bump: minor
changes:
added:
- Add five-year-forward check on all reforms
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from policyengine_us.model_api import *
from policyengine_core.periods import period as period_


def create_capital_gains_tax_increase() -> Reform:
Expand Down Expand Up @@ -145,8 +146,16 @@ def create_capital_gains_tax_increase_reform(
return create_capital_gains_tax_increase()

p = parameters(period).gov.contrib.biden.budget_2025.capital_gains
current_period = period_(period)
reform_active = False

if p.active:
for i in range(5):
if p(current_period).active:
reform_active = True
break
current_period = current_period.offset(1, "year")

if reform_active:
return create_capital_gains_tax_increase()
else:
return None
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from policyengine_us.model_api import *
from policyengine_core.periods import period as period_


def create_medicare_and_investment_tax_increase() -> Reform:
Expand Down Expand Up @@ -75,8 +76,19 @@ def create_medicare_and_investment_tax_increase_reform(
return create_medicare_and_investment_tax_increase()

p = parameters(period).gov.contrib.biden.budget_2025
current_period = period_(period)
reform_active = False

if (p.medicare.rate > 0) | (p.net_investment_income.rate > 0):
for i in range(5):
if (
p(current_period).medicare.rate > 0
or p(current_period).net_investment_income.rate > 0
):
reform_active = True
break
current_period = current_period.offset(1, "year")

if reform_active:
return create_medicare_and_investment_tax_increase()
else:
return None
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from policyengine_us.model_api import *
from policyengine_core.periods import period as period_


def create_increase_taxable_earnings_for_social_security() -> Reform:
Expand Down Expand Up @@ -33,8 +34,16 @@ def create_increase_taxable_earnings_for_social_security_reform(
return create_increase_taxable_earnings_for_social_security()

p = parameters(period).gov.contrib.cbo.payroll
current_period = period_(period)
reform_active = False

if p.secondary_earnings_threshold < np.inf:
for i in range(5):
if p(current_period).secondary_earnings_threshold < np.inf:
reform_active = True
break
current_period = current_period.offset(1, "year")

if reform_active:
return create_increase_taxable_earnings_for_social_security()
else:
return None
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from policyengine_us.model_api import *
from policyengine_core.periods import period as period_


def create_boost_middle_class_tax_credit() -> Reform:
Expand Down Expand Up @@ -147,8 +148,16 @@ def create_boost_middle_class_tax_credit_reform(
return create_boost_middle_class_tax_credit()

p = parameters(period).gov.contrib.harris.lift.middle_class_tax_credit
current_period = period_(period)
reform_active = False

if p.in_effect:
for i in range(5):
if p(current_period).in_effect:
reform_active = True
break
current_period = current_period.offset(1, "year")

if reform_active:
return create_boost_middle_class_tax_credit()
else:
return None
Expand Down
11 changes: 10 additions & 1 deletion policyengine_us/reforms/congress/tlaib/end_child_poverty_act.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from policyengine_us.model_api import *
from policyengine_core.periods import period as period_


def create_end_child_poverty_act() -> Reform:
Expand Down Expand Up @@ -180,8 +181,16 @@ def create_end_child_poverty_act_reform(
return create_end_child_poverty_act()

p = parameters(period).gov.contrib.congress.tlaib.end_child_poverty_act
current_period = period_(period)
reform_active = False

if p.in_effect:
for i in range(5):
if p(current_period).in_effect:
reform_active = True
break
current_period = current_period.offset(1, "year")

if reform_active:
return create_end_child_poverty_act()
else:
return None
Expand Down
23 changes: 20 additions & 3 deletions policyengine_us/reforms/dc_kccatc.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
from policyengine_us.model_api import *
from policyengine_core.periods import period as period_


def create_dc_kccatc_reform(parameters, period, bypass=False):
def create_dc_kccatc():
class dc_kccatc(Variable):
value_type = float
entity = TaxUnit
Expand Down Expand Up @@ -87,8 +88,24 @@ class reform(Reform):
def apply(self):
self.update_variable(dc_kccatc)

if bypass or parameters(period).gov.contrib.dc_kccatc.active:
return reform
return reform


def create_dc_kccatc_reform(parameters, period, bypass=False):
if bypass:
return create_dc_kccatc()

p = parameters(period).gov.contrib.dc_kccatc
current_period = period_(period)

for i in range(5):
if p(current_period).active:
reform_active = True
break
current_period = current_period.offset(1, "year")

if reform_active:
return create_dc_kccatc()
else:
return None

Expand Down
11 changes: 10 additions & 1 deletion policyengine_us/reforms/eitc/halve_joint_eitc_phase_out_rate.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from policyengine_us.model_api import *
from policyengine_core.periods import period as period_


def create_halve_joint_eitc_phase_out_rate() -> Reform:
Expand Down Expand Up @@ -32,8 +33,16 @@ def create_halve_joint_eitc_phase_out_rate_reform(
return create_halve_joint_eitc_phase_out_rate()

p = parameters(period).gov.contrib.joint_eitc
current_period = period_(period)
reform_active = False

if p.in_effect:
for i in range(5):
if p(current_period).in_effect:
reform_active = True
break
current_period = current_period.offset(1, "year")

if reform_active:
return create_halve_joint_eitc_phase_out_rate()
else:
return None
Expand Down
10 changes: 9 additions & 1 deletion policyengine_us/reforms/federal/abolish_federal_income_tax.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from policyengine_us.model_api import *
from policyengine_core.periods import period as period_


def create_abolish_federal_income_tax() -> Reform:
Expand Down Expand Up @@ -54,8 +55,15 @@ def create_abolish_federal_income_tax_reform(
return create_abolish_federal_income_tax()

p = parameters(period).gov.contrib.ubi_center.flat_tax
current_period = period_(period)

if p.abolish_federal_income_tax:
for i in range(5):
if p(current_period).abolish_federal_income_tax:
reform_active = True
break
current_period = current_period.offset(1, "year")

if reform_active:
return create_abolish_federal_income_tax()
else:
return None
Expand Down
10 changes: 9 additions & 1 deletion policyengine_us/reforms/federal/abolish_payroll_tax.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from policyengine_us.model_api import *
from policyengine_core.periods import period as period_


def create_abolish_payroll_tax() -> Reform:
Expand Down Expand Up @@ -34,8 +35,15 @@ def create_abolish_payroll_tax_reform(
return create_abolish_payroll_tax()

p = parameters(period).gov.contrib.ubi_center.flat_tax
current_period = period_(period)

if p.abolish_payroll_tax:
for i in range(5):
if p(current_period).abolish_payroll_tax:
reform_active = True
break
current_period = current_period.offset(1, "year")

if reform_active:
return create_abolish_payroll_tax()
else:
return None
Expand Down
9 changes: 8 additions & 1 deletion policyengine_us/reforms/federal/reported_state_income_tax.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,15 @@ def create_reported_state_income_tax_reform(
return create_reported_state_income_tax()

p = parameters(period).simulation
current_period = period_(period)

if p.reported_state_income_tax:
for i in range(5):
if p(current_period).reported_state_income_tax:
reform_active = True
break
current_period = current_period.offset(1, "year")

if reform_active:
return create_reported_state_income_tax()
else:
return None
Expand Down
10 changes: 9 additions & 1 deletion policyengine_us/reforms/harris/lift/middle_class_tax_credit.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from policyengine_us.model_api import *
from policyengine_core.periods import period as period_


def create_middle_class_tax_credit() -> Reform:
Expand Down Expand Up @@ -61,8 +62,15 @@ def create_middle_class_tax_credit_reform(
return create_middle_class_tax_credit()

p = parameters(period).gov.contrib.harris.lift.middle_class_tax_credit
current_period = period_(period)

if p.in_effect:
for i in range(5):
if p(current_period).in_effect:
reform_active = True
break
current_period = current_period.offset(1, "year")

if reform_active:
return create_middle_class_tax_credit()
else:
return None
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from policyengine_us.model_api import *
from policyengine_core.periods import period as period_


def create_rent_relief_tax_credit() -> Reform:
Expand Down Expand Up @@ -83,8 +84,15 @@ def create_rent_relief_tax_credit_reform(
p = parameters(
period
).gov.contrib.harris.rent_relief_act.rent_relief_credit
current_period = period_(period)

if p.in_effect:
for i in range(5):
if p(current_period).in_effect:
reform_active = True
break
current_period = current_period.offset(1, "year")

if reform_active:
return create_rent_relief_tax_credit()
else:
return None
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from policyengine_us.model_api import *
from policyengine_core.periods import period as period_


def create_adjust_income_limit_and_min_children_by_filing_status() -> Reform:
Expand Down Expand Up @@ -55,8 +56,17 @@ def create_adjust_income_limit_by_filing_status_and_eligibility_by_children_refo
return create_adjust_income_limit_and_min_children_by_filing_status()

p = parameters(period).gov.contrib.local.nyc.stc
current_period = period_(period)

if p.adjust_income_limit_by_filing_status_and_eligibility_by_children:
for i in range(5):
if p(
current_period
).adjust_income_limit_by_filing_status_and_eligibility_by_children:
reform_active = True
break
current_period = current_period.offset(1, "year")

if reform_active:
return create_adjust_income_limit_and_min_children_by_filing_status()
else:
return None
Expand Down
11 changes: 8 additions & 3 deletions policyengine_us/reforms/states/dc/dc_ctc.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,19 @@ def create_dc_ctc_reform(parameters, period, bypass: bool = False):
return create_dc_ctc()

p = parameters.gov.contrib.states.dc.ctc

current_period = period_(period)
reform_active = False

for i in range(5):
if p(current_period).in_effect:
return create_dc_ctc()
reform_active = True
break
current_period = current_period.offset(1, "year")
return None

if reform_active:
return create_dc_ctc()
else:
return None


dc_ctc = create_dc_ctc_reform(None, None, bypass=True)
11 changes: 10 additions & 1 deletion policyengine_us/reforms/states/mn/walz/mn_walz_hf1938.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from policyengine_us.model_api import *
from policyengine_core.periods import period as period_


# Repealing Minnesota Bill HF1938 to pre 2023 rules
Expand Down Expand Up @@ -212,8 +213,16 @@ def create_mn_walz_hf1938_repeal_reform(
return create_mn_walz_hf1938_repeal()

p = parameters(period).gov.contrib.states.mn.walz.hf1938
reform_active = False
current_period = period_(period)

if p.repeal:
for i in range(5):
if p(current_period).repeal:
reform_active = True
break
current_period = current_period.offset(1, "year")

if reform_active:
return create_mn_walz_hf1938_repeal()
else:
return None
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from policyengine_us.model_api import *
from policyengine_core.periods import period as period_


def create_ny_working_families_tax_credit() -> Reform:
Expand Down Expand Up @@ -530,8 +531,16 @@ def create_ny_working_families_tax_credit_reform(
return create_ny_working_families_tax_credit()

p = parameters(period).gov.contrib.states.ny.wftc
reform_active = False
current_period = period_(period)

if p.in_effect:
for i in range(5):
if p(current_period).in_effect:
reform_active = True
break
current_period = current_period.offset(1, "year")

if reform_active:
return create_ny_working_families_tax_credit()
else:
return None
Expand Down
Loading
Loading