policyengine-us 1.389.0__py3-none-any.whl → 1.390.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of policyengine-us might be problematic. Click here for more details.

@@ -0,0 +1,8 @@
1
+ description: The following percentage of employer-side payroll taxes are included in gross income.
2
+ metadata:
3
+ unit: /1
4
+ period: year
5
+ label: Percentage of employer payroll taxes included in gross income
6
+
7
+ values:
8
+ 0000-01-01: 1.0
@@ -58,11 +58,18 @@ def tax_employer_payroll_tax_reform() -> Reform:
58
58
  for source in sources:
59
59
  # Add positive values only - losses are deducted later.
60
60
  total += not_dependent * max_(0, add(person, period, [source]))
61
- return (
62
- total
63
- + person("employer_social_security_tax", period)
64
- + person("employer_medicare_tax", period)
61
+
62
+ # Get the percentage of employer payroll tax to include
63
+ p = parameters(period).gov.contrib.crfb.tax_employer_payroll_tax
64
+
65
+ # Apply percentage to employer payroll taxes
66
+ employer_payroll_tax = add(
67
+ person,
68
+ period,
69
+ ["employer_social_security_tax", "employer_medicare_tax"],
65
70
  )
71
+ taxable_employer_payroll_tax = p.percentage * employer_payroll_tax
72
+ return total + taxable_employer_payroll_tax
66
73
 
67
74
  # Create a reform object applies the method
68
75
  # It inherits the Reform class
@@ -0,0 +1,159 @@
1
+ - name: Full employer payroll tax inclusion (100%)
2
+ period: 2024
3
+ reforms: policyengine_us.reforms.crfb.tax_employer_payroll_tax.tax_employer_payroll_tax_reform_object
4
+ input:
5
+ gov.contrib.crfb.tax_employer_payroll_tax.in_effect: true
6
+ gov.contrib.crfb.tax_employer_payroll_tax.percentage: 1.0
7
+ people:
8
+ person1:
9
+ employment_income: 50_000
10
+ tax_units:
11
+ tax_unit:
12
+ members: [person1]
13
+ households:
14
+ household:
15
+ members: [person1]
16
+ state_code: CA
17
+ output:
18
+ # With $50,000 income:
19
+ # Employer SS tax: $50,000 * 0.062 = $3,100
20
+ # Employer Medicare tax: $50,000 * 0.0145 = $725
21
+ # Total employer tax: $3,825
22
+ employer_social_security_tax: [3_100]
23
+ employer_medicare_tax: [725]
24
+ # IRS gross income should include 100% of employer taxes
25
+ irs_gross_income: [53_825] # $50,000 + $3,825
26
+
27
+ - name: Half employer payroll tax inclusion (50%)
28
+ period: 2024
29
+ reforms: policyengine_us.reforms.crfb.tax_employer_payroll_tax.tax_employer_payroll_tax_reform_object
30
+ input:
31
+ gov.contrib.crfb.tax_employer_payroll_tax.in_effect: true
32
+ gov.contrib.crfb.tax_employer_payroll_tax.percentage: 0.5
33
+ people:
34
+ person1:
35
+ employment_income: 50_000
36
+ tax_units:
37
+ tax_unit:
38
+ members: [person1]
39
+ households:
40
+ household:
41
+ members: [person1]
42
+ state_code: CA
43
+ output:
44
+ employer_social_security_tax: [3_100]
45
+ employer_medicare_tax: [725]
46
+ # IRS gross income should include 50% of employer taxes
47
+ # $50,000 + ($3,825 * 0.5) = $50,000 + $1,912.50
48
+ irs_gross_income: [51_912.5]
49
+
50
+ - name: Quarter employer payroll tax inclusion (25%)
51
+ period: 2024
52
+ reforms: policyengine_us.reforms.crfb.tax_employer_payroll_tax.tax_employer_payroll_tax_reform_object
53
+ input:
54
+ gov.contrib.crfb.tax_employer_payroll_tax.in_effect: true
55
+ gov.contrib.crfb.tax_employer_payroll_tax.percentage: 0.25
56
+ people:
57
+ person1:
58
+ employment_income: 100_000
59
+ tax_units:
60
+ tax_unit:
61
+ members: [person1]
62
+ households:
63
+ household:
64
+ members: [person1]
65
+ state_code: CA
66
+ output:
67
+ # With $100,000 income:
68
+ # Employer SS tax: $100,000 * 0.062 = $6,200
69
+ # Employer Medicare tax: $100,000 * 0.0145 = $1,450
70
+ # Total employer tax: $7,650
71
+ employer_social_security_tax: [6_200]
72
+ employer_medicare_tax: [1_450]
73
+ # IRS gross income should include 25% of employer taxes
74
+ # $100,000 + ($7,650 * 0.25) = $100,000 + $1,912.50
75
+ irs_gross_income: [101_912.5]
76
+
77
+ - name: No employer payroll tax inclusion (0%)
78
+ period: 2024
79
+ reforms: policyengine_us.reforms.crfb.tax_employer_payroll_tax.tax_employer_payroll_tax_reform_object
80
+ input:
81
+ gov.contrib.crfb.tax_employer_payroll_tax.in_effect: true
82
+ gov.contrib.crfb.tax_employer_payroll_tax.percentage: 0.0
83
+ people:
84
+ person1:
85
+ employment_income: 75_000
86
+ tax_units:
87
+ tax_unit:
88
+ members: [person1]
89
+ households:
90
+ household:
91
+ members: [person1]
92
+ state_code: CA
93
+ output:
94
+ # With $75,000 income:
95
+ # Employer SS tax: $75,000 * 0.062 = $4,650
96
+ # Employer Medicare tax: $75,000 * 0.0145 = $1,087.50
97
+ employer_social_security_tax: [4_650]
98
+ employer_medicare_tax: [1_087.5]
99
+ # IRS gross income should not include any employer taxes with 0%
100
+ irs_gross_income: [75_000]
101
+
102
+ - name: Three-quarters employer payroll tax inclusion (75%)
103
+ period: 2024
104
+ reforms: policyengine_us.reforms.crfb.tax_employer_payroll_tax.tax_employer_payroll_tax_reform_object
105
+ input:
106
+ gov.contrib.crfb.tax_employer_payroll_tax.in_effect: true
107
+ gov.contrib.crfb.tax_employer_payroll_tax.percentage: 0.75
108
+ people:
109
+ person1:
110
+ employment_income: 60_000
111
+ person2:
112
+ employment_income: 40_000
113
+ tax_units:
114
+ tax_unit:
115
+ members: [person1, person2]
116
+ households:
117
+ household:
118
+ members: [person1, person2]
119
+ state_code: CA
120
+ output:
121
+ # Person 1: $60,000 income
122
+ # Employer SS tax: $60,000 * 0.062 = $3,720
123
+ # Employer Medicare tax: $60,000 * 0.0145 = $870
124
+ # Person 2: $40,000 income
125
+ # Employer SS tax: $40,000 * 0.062 = $2,480
126
+ # Employer Medicare tax: $40,000 * 0.0145 = $580
127
+ employer_social_security_tax: [3_720, 2_480]
128
+ employer_medicare_tax: [870, 580]
129
+ # IRS gross income should include 75% of employer taxes
130
+ # Person 1: $60,000 + (($3,720 + $870) * 0.75) = $60,000 + $3,442.50
131
+ # Person 2: $40,000 + (($2,480 + $580) * 0.75) = $40,000 + $2,295
132
+ irs_gross_income: [63_442.5, 42_295]
133
+
134
+ - name: High earner with partial inclusion at Social Security wage cap
135
+ period: 2024
136
+ reforms: policyengine_us.reforms.crfb.tax_employer_payroll_tax.tax_employer_payroll_tax_reform_object
137
+ input:
138
+ gov.contrib.crfb.tax_employer_payroll_tax.in_effect: true
139
+ gov.contrib.crfb.tax_employer_payroll_tax.percentage: 0.6
140
+ people:
141
+ person1:
142
+ employment_income: 200_000
143
+ tax_units:
144
+ tax_unit:
145
+ members: [person1]
146
+ households:
147
+ household:
148
+ members: [person1]
149
+ state_code: CA
150
+ output:
151
+ # With $200,000 income (above SS wage cap of $168,600 for 2024):
152
+ # Employer SS tax: $168,600 * 0.062 = $10,453.20
153
+ # Employer Medicare tax: $200,000 * 0.0145 = $2,900
154
+ # Total employer tax: $13,353.20
155
+ employer_social_security_tax: [10_453.2]
156
+ employer_medicare_tax: [2_900]
157
+ # IRS gross income should include 60% of employer taxes
158
+ # $200,000 + ($13,353.20 * 0.6) = $200,000 + $8,011.92
159
+ irs_gross_income: [208_011.92]
@@ -289,6 +289,11 @@ class SelectiveTestRunner:
289
289
 
290
290
  # Special handling for test files themselves
291
291
  if "tests" in file and file.endswith(".py"):
292
+ # Skip test infrastructure files that shouldn't trigger all tests
293
+ if file.endswith(
294
+ ("run_selective_tests.py", "test_batched.py")
295
+ ):
296
+ continue
292
297
  # Add the directory containing the test file
293
298
  test_dir = os.path.dirname(file)
294
299
  if test_dir:
@@ -314,7 +319,13 @@ class SelectiveTestRunner:
314
319
 
315
320
  return existing_test_paths
316
321
 
317
- def run_tests(self, test_paths: Set[str], verbose: bool = False) -> int:
322
+ def run_tests(
323
+ self,
324
+ test_paths: Set[str],
325
+ verbose: bool = False,
326
+ with_coverage: bool = False,
327
+ changed_files: Set[str] = None,
328
+ ) -> int:
318
329
  """Run pytest on specified test paths."""
319
330
  if not test_paths:
320
331
  print("No relevant tests found for changed files.")
@@ -325,7 +336,86 @@ class SelectiveTestRunner:
325
336
  print(f" - {path}")
326
337
 
327
338
  # Construct pytest command
328
- pytest_args = ["policyengine-core", "test", "-c", "policyengine_us"]
339
+ if with_coverage:
340
+ # Use coverage to run the tests
341
+ import sys
342
+
343
+ # First check if coverage is importable
344
+ try:
345
+ import coverage
346
+
347
+ print(f"Coverage version: {coverage.__version__}")
348
+ except ImportError as e:
349
+ print(f"ERROR: Coverage module not found: {e}")
350
+ print(
351
+ "Please ensure coverage is installed: pip install coverage"
352
+ )
353
+ return 1
354
+
355
+ # Only track coverage for the specific files that changed in the PR
356
+ include_patterns = []
357
+ if changed_files:
358
+ # Only include Python files that were actually changed (excluding test directories)
359
+ changed_py_files = [
360
+ f
361
+ for f in changed_files
362
+ if f.endswith(".py") and "/tests/" not in f
363
+ ]
364
+ if changed_py_files:
365
+ include_patterns = changed_py_files
366
+ else:
367
+ # Fallback to directory-based patterns if no changed files provided
368
+ for test_path in test_paths:
369
+ # Convert test path to variable path
370
+ if "tests/policy/baseline/" in test_path:
371
+ var_path = test_path.replace(
372
+ "tests/policy/baseline/", "variables/"
373
+ )
374
+ include_patterns.append(f"{var_path}/**/*.py")
375
+ include_patterns.append(f"{var_path}/*.py")
376
+ elif "tests/policy/reform/" in test_path:
377
+ include_patterns.append(
378
+ "policyengine_us/reforms/**/*.py"
379
+ )
380
+ include_patterns.append("policyengine_us/reforms/*.py")
381
+ elif "tests/policy/contrib/" in test_path:
382
+ include_patterns.append(
383
+ "policyengine_us/parameters/contrib/**/*.py"
384
+ )
385
+ include_patterns.append(
386
+ "policyengine_us/parameters/contrib/*.py"
387
+ )
388
+
389
+ pytest_args = [
390
+ sys.executable,
391
+ "-m",
392
+ "coverage",
393
+ "run",
394
+ "-a",
395
+ "--branch",
396
+ ]
397
+
398
+ # Add --include flag to only track relevant files
399
+ if include_patterns:
400
+ include_pattern = ",".join(include_patterns)
401
+ pytest_args.extend(["--include", include_pattern])
402
+
403
+ pytest_args.extend(
404
+ [
405
+ "-m",
406
+ "policyengine_core.scripts.policyengine_command",
407
+ "test",
408
+ "-c",
409
+ "policyengine_us",
410
+ ]
411
+ )
412
+ else:
413
+ pytest_args = [
414
+ "policyengine-core",
415
+ "test",
416
+ "-c",
417
+ "policyengine_us",
418
+ ]
329
419
 
330
420
  # Add test paths
331
421
  pytest_args.extend(sorted(test_paths))
@@ -409,6 +499,11 @@ def main():
409
499
  action="store_true",
410
500
  help="Show debug information about git state",
411
501
  )
502
+ parser.add_argument(
503
+ "--coverage",
504
+ action="store_true",
505
+ help="Run tests with coverage measurement",
506
+ )
412
507
 
413
508
  args = parser.parse_args()
414
509
 
@@ -508,7 +603,14 @@ def main():
508
603
  print("Consider running all tests with --all flag.")
509
604
  sys.exit(0)
510
605
 
511
- sys.exit(runner.run_tests(test_paths, verbose=args.verbose))
606
+ sys.exit(
607
+ runner.run_tests(
608
+ test_paths,
609
+ verbose=args.verbose,
610
+ with_coverage=args.coverage,
611
+ changed_files=changed_files if args.coverage else None,
612
+ )
613
+ )
512
614
 
513
615
 
514
616
  if __name__ == "__main__":
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: policyengine-us
3
- Version: 1.389.0
3
+ Version: 1.390.0
4
4
  Summary: Add your description here.
5
5
  Author-email: PolicyEngine <hello@policyengine.org>
6
6
  License-File: LICENSE
@@ -187,6 +187,7 @@ policyengine_us/parameters/gov/contrib/crfb/ss_credit/amount.yaml,sha256=3A_cUbp
187
187
  policyengine_us/parameters/gov/contrib/crfb/ss_credit/in_effect.yaml,sha256=4xq1pNu6_rSP3xjjcgJNolbMQJOrcEKrZn0hAcdOWcI,347
188
188
  policyengine_us/parameters/gov/contrib/crfb/tax_employer_medicare_tax/in_effect.yaml,sha256=E2lrX7YCKkIctuL1bw4dlMXDQnLKW29jwYV9temCYsY,221
189
189
  policyengine_us/parameters/gov/contrib/crfb/tax_employer_payroll_tax/in_effect.yaml,sha256=f1OyGZQyJqq0QeUj0oVdtVrWuvSt7bLpRALdu3isHRg,250
190
+ policyengine_us/parameters/gov/contrib/crfb/tax_employer_payroll_tax/percentage.yaml,sha256=oHFxJ_1RTLZIYHH-OPCNRN-cl7LVhYQHmH9u1_nBIRs,232
190
191
  policyengine_us/parameters/gov/contrib/crfb/tax_employer_social_security_tax/in_effect.yaml,sha256=DTXhl5bLmrrrpBneziAAHGjqKfMIn826IotgKmOajHI,235
191
192
  policyengine_us/parameters/gov/contrib/ctc/additional_bracket/in_effect.yaml,sha256=ye9DVUx50Q5jWNw5m9RFtWHeB7MDwle7qHGX7_wd0Ck,187
192
193
  policyengine_us/parameters/gov/contrib/ctc/additional_bracket/amount/actc.yaml,sha256=_Dyd6AWevefbcEc_QNyAy1LHeEiVXoNqqKp5CENKu3U,457
@@ -3143,7 +3144,7 @@ policyengine_us/reforms/congress/wyden_smith/ctc_expansion.py,sha256=SLqv8nk2gQT
3143
3144
  policyengine_us/reforms/crfb/__init__.py,sha256=na1OcXNKdnI-L9qEKU1HoDOLz7I7LS9Wa7e0fTkaZpc,740
3144
3145
  policyengine_us/reforms/crfb/non_refundable_ss_credit.py,sha256=bMEGGi1R16fnfBeNhiRFXh9DfpVyq4dZH1jcsidf-2c,5453
3145
3146
  policyengine_us/reforms/crfb/tax_employer_medicare_tax.py,sha256=Hc2GVwoXn2b_izOyoEpocySLo11BdmzFnyQoEiHJsFI,4236
3146
- policyengine_us/reforms/crfb/tax_employer_payroll_tax.py,sha256=Tkod1VMnZQ-JBJo3dx7xUCq50ZuqUjiHUnkoOyBPVes,4342
3147
+ policyengine_us/reforms/crfb/tax_employer_payroll_tax.py,sha256=-V6vv51aYb0NRuB4mjqfjD6yGNSLqqgbKVhVG455U3I,4678
3147
3148
  policyengine_us/reforms/crfb/tax_employer_social_security_tax.py,sha256=hawAdLtwCnY3_7jUVPTM0KpeYRfT7tVk0xqCMhdxP4E,4292
3148
3149
  policyengine_us/reforms/ctc/__init__.py,sha256=_qWyJ2JK4xfkef1REpYcXjY2v8m-xppoXGxoPFs7voc,172
3149
3150
  policyengine_us/reforms/ctc/ctc_additional_bracket.py,sha256=KNmEB_OLwpLbvaPo4w0n18VnAmg0u3efirfVVCOrWj4,2391
@@ -3190,7 +3191,7 @@ policyengine_us/reforms/tax_exempt/__init__.py,sha256=v3EbtUk6a2jsi9MrOlyb8ckzPy
3190
3191
  policyengine_us/reforms/tax_exempt/tax_exempt_reform.py,sha256=bkW91XMJ-jd23nhq4-PfWJv0YW2whVn98cQikbq6-Z8,2427
3191
3192
  policyengine_us/reforms/treasury/__init__.py,sha256=406jIbu32B57tUKhVLflWxlXf3S4SWjclVqlEtMeMwg,92
3192
3193
  policyengine_us/reforms/treasury/repeal_dependent_exemptions.py,sha256=-xyMCtUK_dIBn2aAmhPW8pJEZjxcgOZzWKEUSI3w5e8,1354
3193
- policyengine_us/tests/run_selective_tests.py,sha256=AYvT1yM4bkOy4_2RtJEfpiV-l9lrlj86cl11zs8TsrE,18931
3194
+ policyengine_us/tests/run_selective_tests.py,sha256=kVuz9-CEXL2db8MuFi1J3cHj_Mqx28retvAPX8N3LCY,22571
3194
3195
  policyengine_us/tests/test_batched.py,sha256=K1LN3IIbWIioXWpFXZ6Hlch-BeglV3QPc1zxAbUeP-M,11491
3195
3196
  policyengine_us/tests/code_health/parameters.py,sha256=e9VKC8dmmB_dTafOO90WJuVu-PAogoLAaa5QZd2rY-s,1126
3196
3197
  policyengine_us/tests/code_health/variable_names.py,sha256=hY4ucqPwBD7v_fvnBpzexJDf0yCGpF4Sueff4z4rQ24,554
@@ -5192,6 +5193,7 @@ policyengine_us/tests/policy/contrib/congress/tlaib/end_child_poverty_act/integr
5192
5193
  policyengine_us/tests/policy/contrib/crfb/non_refundable_ss_credit.yaml,sha256=ycLoBzbBzgSJ1RuAin4Y3SIlNu3TgtUY9QJp15dvTTQ,2773
5193
5194
  policyengine_us/tests/policy/contrib/crfb/tax_employer_all_payroll_tax.yaml,sha256=ljSr35bDosWTqTDqEZKWhRqZvIw7SwPVMY-O8YFIsLc,559
5194
5195
  policyengine_us/tests/policy/contrib/crfb/tax_employer_medicare_tax.yaml,sha256=jE-_SssrvqdWuVgw9GrA1sJy6dvrvKuMHwZCHm48oRc,446
5196
+ policyengine_us/tests/policy/contrib/crfb/tax_employer_payroll_tax_percentage.yaml,sha256=507anp-sJyRirjz1sevPOi_pF1zuFAPcCzyvmwUGiXY,5509
5195
5197
  policyengine_us/tests/policy/contrib/crfb/tax_employer_social_security_tax.yaml,sha256=0boINedj32lA-V2VLztNBoylnOlzRinlwtcg3JIij0g,474
5196
5198
  policyengine_us/tests/policy/contrib/ctc/ctc_additional_bracket.yaml,sha256=0vUrhnn91ETd_lkk1YqG5EzGj8wTj2r5mHZ3A-mjwlo,3445
5197
5199
  policyengine_us/tests/policy/contrib/ctc/ctc_older_child_supplement.yaml,sha256=7P67DlafOtTxAcpH2ossYPDInWyz6DJayNf_0Ed7rcQ,2059
@@ -8378,8 +8380,8 @@ policyengine_us/variables/input/farm_income.py,sha256=BEKxYmHNNnWJAAvULl5qZJigy5
8378
8380
  policyengine_us/variables/input/geography.py,sha256=Ux0ueAf0rhZaflyEqz81UuXP3xKCKBDvoO3CrKhiQEc,5421
8379
8381
  policyengine_us/variables/input/self_employment_income.py,sha256=PwsGz8R4lRikKWUYOhsC0qosNNLXq4f5SQmfw4S3mk8,511
8380
8382
  policyengine_us/variables/input/self_employment_income_before_lsr.py,sha256=E8fcX9Nlyqz8dziHhQv_euutdmoIwFMMWePUwbbwv_w,379
8381
- policyengine_us-1.389.0.dist-info/METADATA,sha256=oRKU3Ud2HNPdNXxoDeuit_z5MXjpbsEDe1prifcuT-c,1649
8382
- policyengine_us-1.389.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
8383
- policyengine_us-1.389.0.dist-info/entry_points.txt,sha256=MLaqNyNTbReALyKNkde85VkuFFpdPWAcy8VRG1mjczc,57
8384
- policyengine_us-1.389.0.dist-info/licenses/LICENSE,sha256=2N5ReRelkdqkR9a-KP-y-shmcD5P62XoYiG-miLTAzo,34519
8385
- policyengine_us-1.389.0.dist-info/RECORD,,
8383
+ policyengine_us-1.390.0.dist-info/METADATA,sha256=8VqeqHs6EMmhHfsJI2-btq4QyI-fpGj80IsJs50J59k,1649
8384
+ policyengine_us-1.390.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
8385
+ policyengine_us-1.390.0.dist-info/entry_points.txt,sha256=MLaqNyNTbReALyKNkde85VkuFFpdPWAcy8VRG1mjczc,57
8386
+ policyengine_us-1.390.0.dist-info/licenses/LICENSE,sha256=2N5ReRelkdqkR9a-KP-y-shmcD5P62XoYiG-miLTAzo,34519
8387
+ policyengine_us-1.390.0.dist-info/RECORD,,