From 27bb4d65fdde02020d8618ae0170e8be7d0c517a Mon Sep 17 00:00:00 2001 From: PavelMakarchuk Date: Fri, 27 Dec 2024 16:15:47 -0500 Subject: [PATCH 1/2] Abolish SNAP net income test and deductions reforms Fixes #5422 --- changelog_entry.yaml | 5 +++ .../snap/abolish_deductions/in_effect.yaml | 8 ++++ .../abolish_net_income_test/in_effect.yaml | 8 ++++ policyengine_us/reforms/reforms.py | 12 ++++++ policyengine_us/reforms/snap/__init__.py | 6 +++ .../reforms/snap/abolish_snap_deductions.py | 40 ++++++++++++++++++ .../snap/abolish_snap_net_income_test.py | 42 +++++++++++++++++++ .../contrib/snap/abolish_snap_deductions.yaml | 17 ++++++++ .../snap/abolish_snap_net_income_test.yaml | 15 +++++++ 9 files changed, 153 insertions(+) create mode 100644 policyengine_us/parameters/gov/contrib/snap/abolish_deductions/in_effect.yaml create mode 100644 policyengine_us/parameters/gov/contrib/snap/abolish_net_income_test/in_effect.yaml create mode 100644 policyengine_us/reforms/snap/__init__.py create mode 100644 policyengine_us/reforms/snap/abolish_snap_deductions.py create mode 100644 policyengine_us/reforms/snap/abolish_snap_net_income_test.py create mode 100644 policyengine_us/tests/policy/contrib/snap/abolish_snap_deductions.yaml create mode 100644 policyengine_us/tests/policy/contrib/snap/abolish_snap_net_income_test.yaml diff --git a/changelog_entry.yaml b/changelog_entry.yaml index e69de29bb2d..e48965a788e 100644 --- a/changelog_entry.yaml +++ b/changelog_entry.yaml @@ -0,0 +1,5 @@ +- bump: minor + changes: + added: + - Abolish SNAP net income test reform. + - Abolish SNAP deductions reform. diff --git a/policyengine_us/parameters/gov/contrib/snap/abolish_deductions/in_effect.yaml b/policyengine_us/parameters/gov/contrib/snap/abolish_deductions/in_effect.yaml new file mode 100644 index 00000000000..11470d6b243 --- /dev/null +++ b/policyengine_us/parameters/gov/contrib/snap/abolish_deductions/in_effect.yaml @@ -0,0 +1,8 @@ +description: SNAP deductions are abolished, if this is true. +metadata: + unit: bool + period: year + label: Abolish SNAP deductions in effect + +values: + 0000-01-01: false diff --git a/policyengine_us/parameters/gov/contrib/snap/abolish_net_income_test/in_effect.yaml b/policyengine_us/parameters/gov/contrib/snap/abolish_net_income_test/in_effect.yaml new file mode 100644 index 00000000000..4992ec3f08c --- /dev/null +++ b/policyengine_us/parameters/gov/contrib/snap/abolish_net_income_test/in_effect.yaml @@ -0,0 +1,8 @@ +description: SNAP net income test is abolished, if this is true. +metadata: + unit: bool + period: year + label: Abolish SNAP net income test in effect + +values: + 0000-01-01: false diff --git a/policyengine_us/reforms/reforms.py b/policyengine_us/reforms/reforms.py index f465859398a..4bf91d17169 100644 --- a/policyengine_us/reforms/reforms.py +++ b/policyengine_us/reforms/reforms.py @@ -68,6 +68,10 @@ from .ctc.eppc import ( create_expanded_ctc_reform, ) +from .snap import ( + create_abolish_snap_deductions_reform, + create_abolish_snap_net_income_test_reform, +) from policyengine_core.reforms import Reform @@ -152,6 +156,12 @@ def create_structural_reforms_from_parameters(parameters, period): parameters, period ) expanded_ctc = create_expanded_ctc_reform(parameters, period) + abolish_snap_deductions = create_abolish_snap_deductions_reform( + parameters, period + ) + abolish_snap_net_income_test = create_abolish_snap_net_income_test_reform( + parameters, period + ) reforms = [ afa_reform, @@ -184,6 +194,8 @@ def create_structural_reforms_from_parameters(parameters, period): ctc_older_child_supplement, second_earner_tax_reform, expanded_ctc, + abolish_snap_deductions, + abolish_snap_net_income_test, ] reforms = tuple(filter(lambda x: x is not None, reforms)) diff --git a/policyengine_us/reforms/snap/__init__.py b/policyengine_us/reforms/snap/__init__.py new file mode 100644 index 00000000000..c50b6b9c9d9 --- /dev/null +++ b/policyengine_us/reforms/snap/__init__.py @@ -0,0 +1,6 @@ +from .abolish_snap_deductions import ( + create_abolish_snap_deductions_reform, +) +from .abolish_snap_net_income_test import ( + create_abolish_snap_net_income_test_reform, +) diff --git a/policyengine_us/reforms/snap/abolish_snap_deductions.py b/policyengine_us/reforms/snap/abolish_snap_deductions.py new file mode 100644 index 00000000000..2fcbdfb1363 --- /dev/null +++ b/policyengine_us/reforms/snap/abolish_snap_deductions.py @@ -0,0 +1,40 @@ +from policyengine_us.model_api import * + + +def create_abolish_snap_deductions() -> Reform: + class snap_deductions(Variable): + value_type = float + entity = SPMUnit + label = "SNAP income deductions" + unit = USD + documentation = "Deductions made from gross income for SNAP benefits" + definition_period = MONTH + reference = "https://www.law.cornell.edu/uscode/text/7/2014#e" + + def formula(spm_unit, period, parameters): + return 0 + + class reform(Reform): + def apply(self): + self.update_variable(snap_deductions) + + return reform + + +def create_abolish_snap_deductions_reform( + parameters, period, bypass: bool = False +): + if bypass: + return create_abolish_snap_deductions() + + p = parameters(period).gov.contrib.snap.abolish_deductions + + if p.in_effect: + return create_abolish_snap_deductions() + else: + return None + + +abolish_snap_deductions = create_abolish_snap_deductions_reform( + None, None, bypass=True +) diff --git a/policyengine_us/reforms/snap/abolish_snap_net_income_test.py b/policyengine_us/reforms/snap/abolish_snap_net_income_test.py new file mode 100644 index 00000000000..d394b8dd259 --- /dev/null +++ b/policyengine_us/reforms/snap/abolish_snap_net_income_test.py @@ -0,0 +1,42 @@ +from policyengine_us.model_api import * + + +def create_abolish_snap_net_income_test() -> Reform: + class meets_snap_net_income_test(Variable): + value_type = bool + entity = SPMUnit + label = "Meets SNAP net income test" + documentation = "Whether this SPM unit meets the SNAP net income test" + definition_period = MONTH + reference = ( + "https://www.law.cornell.edu/uscode/text/7/2017#a", + "https://www.law.cornell.edu/uscode/text/7/2014#c", + ) + + def formula(spm_unit, period, parameters): + return True + + class reform(Reform): + def apply(self): + self.update_variable(meets_snap_net_income_test) + + return reform + + +def create_abolish_snap_net_income_test_reform( + parameters, period, bypass: bool = False +): + if bypass: + return create_abolish_snap_net_income_test() + + p = parameters(period).gov.contrib.snap.abolish_net_income_test + + if p.in_effect: + return create_abolish_snap_net_income_test() + else: + return None + + +abolish_snap_net_income_test = create_abolish_snap_net_income_test_reform( + None, None, bypass=True +) diff --git a/policyengine_us/tests/policy/contrib/snap/abolish_snap_deductions.yaml b/policyengine_us/tests/policy/contrib/snap/abolish_snap_deductions.yaml new file mode 100644 index 00000000000..76a08893d5b --- /dev/null +++ b/policyengine_us/tests/policy/contrib/snap/abolish_snap_deductions.yaml @@ -0,0 +1,17 @@ +- name: Reform not in effect + period: 2024 + input: + snap_standard_deduction: 3_000 + snap_child_support_deduction: 1_000 + output: + snap_deductions: 4_000 + +- name: Reform in effect + period: 2024 + reforms: policyengine_us.reforms.snap.abolish_snap_deductions.abolish_snap_deductions + input: + gov.contrib.snap.abolish_deductions.in_effect: true + snap_standard_deduction: 3_000 + snap_child_support_deduction: 1_000 + output: + snap_deductions: 0 diff --git a/policyengine_us/tests/policy/contrib/snap/abolish_snap_net_income_test.yaml b/policyengine_us/tests/policy/contrib/snap/abolish_snap_net_income_test.yaml new file mode 100644 index 00000000000..815303047e9 --- /dev/null +++ b/policyengine_us/tests/policy/contrib/snap/abolish_snap_net_income_test.yaml @@ -0,0 +1,15 @@ +- name: Reform not in effect + period: 2024 + input: + snap_net_income_fpg_ratio: 1.5 + output: + meets_snap_net_income_test: false + +- name: Reform in effect + period: 2024 + reforms: policyengine_us.reforms.snap.abolish_snap_net_income_test.abolish_snap_net_income_test + input: + gov.contrib.snap.abolish_net_income_test.in_effect: true + snap_net_income_fpg_ratio: 1.5 + output: + meets_snap_net_income_test: true From f0b00efc414f7549237b72ac8beab123d4202baf Mon Sep 17 00:00:00 2001 From: "Github Actions[bot]" Date: Fri, 27 Dec 2024 21:47:43 +0000 Subject: [PATCH 2/2] Update PolicyEngine US --- CHANGELOG.md | 8 ++++++++ changelog.yaml | 6 ++++++ changelog_entry.yaml | 5 ----- setup.py | 2 +- 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6909c83c56c..c23d9a418a9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.166.0] - 2024-12-27 21:44:15 + +### Added + +- Abolish SNAP net income test reform. +- Abolish SNAP deductions reform. + ## [1.165.0] - 2024-12-26 12:59:32 ### Added @@ -10481,6 +10488,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 +[1.166.0]: https://github.com/PolicyEngine/policyengine-us/compare/1.165.0...1.166.0 [1.165.0]: https://github.com/PolicyEngine/policyengine-us/compare/1.164.0...1.165.0 [1.164.0]: https://github.com/PolicyEngine/policyengine-us/compare/1.163.1...1.164.0 [1.163.1]: https://github.com/PolicyEngine/policyengine-us/compare/1.163.0...1.163.1 diff --git a/changelog.yaml b/changelog.yaml index fac1d78259f..91e20024c06 100644 --- a/changelog.yaml +++ b/changelog.yaml @@ -8859,3 +8859,9 @@ added: - SSI qualified non-citizen eligibility. date: 2024-12-26 12:59:32 +- bump: minor + changes: + added: + - Abolish SNAP net income test reform. + - Abolish SNAP deductions reform. + date: 2024-12-27 21:44:15 diff --git a/changelog_entry.yaml b/changelog_entry.yaml index e48965a788e..e69de29bb2d 100644 --- a/changelog_entry.yaml +++ b/changelog_entry.yaml @@ -1,5 +0,0 @@ -- bump: minor - changes: - added: - - Abolish SNAP net income test reform. - - Abolish SNAP deductions reform. diff --git a/setup.py b/setup.py index 58fd3f3d643..6de734ee5e8 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ setup( name="policyengine-us", - version="1.165.0", + version="1.166.0", author="PolicyEngine", author_email="hello@policyengine.org", long_description=readme,