Skip to content

Commit fe540a5

Browse files
Max Ghenisclaude
andcommitted
Depend on microunit for tax-unit construction instead of in-repo copy
Replace the in-repo tax-unit construction engine and rule helpers with a dependency on the standalone microunit package, re-pointing all call sites (census_cps, the ACS wrapper, both validation scripts, and the tests). The engine logic was extracted from this repo and is byte-identical; tax-unit output is unchanged. Delete policyengine_us_data/datasets/cps/tax_unit_construction.py and tax_unit_rule_helpers.py. Keep the ACS column mapping and ACS wrapper, which microunit deliberately excludes. Rewrite the CPS engine unit tests (which now live in microunit) into thin integration tests for this repo's wiring; the ACS integration tests are unchanged. Pin microunit to a SHA until its first PyPI release and refresh uv.lock. Fixes #1156 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent f745831 commit fe540a5

11 files changed

Lines changed: 61 additions & 1436 deletions

changelog.d/1156.changed.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
- Replaced the in-repo tax-unit construction engine and rule helpers with a dependency on the standalone `microunit` package, re-pointing all call sites. Tax-unit output is unchanged.

policyengine_us_data/datasets/acs/acs_to_cps_columns.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"""
22
Map ACS PUMS person records onto the CPS-like columns consumed by
3-
``policyengine_us_data.datasets.cps.tax_unit_construction``.
3+
``microunit.construct_tax_units``.
44
55
Column contract:
66

policyengine_us_data/datasets/acs/tax_unit_construction.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,11 @@
22

33
import pandas as pd
44

5+
from microunit import POLICYENGINE_MODE, construct_tax_units
6+
57
from policyengine_us_data.datasets.acs.acs_to_cps_columns import (
68
acs_person_to_cps_tax_unit_columns,
79
)
8-
from policyengine_us_data.datasets.cps.tax_unit_construction import (
9-
POLICYENGINE_MODE,
10-
construct_tax_units,
11-
)
1210

1311

1412
def construct_tax_units_acs(

policyengine_us_data/datasets/cps/census_cps.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@
55
from zipfile import ZipFile
66
import pandas as pd
77
from policyengine_us_data.storage import STORAGE_FOLDER
8-
from policyengine_us_data.datasets.cps.tax_unit_construction import (
9-
construct_tax_units,
10-
)
8+
from microunit import construct_tax_units
119

1210

1311
OPTIONAL_PERSON_COLUMNS = {

0 commit comments

Comments
 (0)