diff --git a/changelog.d/update-policyengine-bundle-6.2.5.changed.md b/changelog.d/update-policyengine-bundle-6.2.5.changed.md new file mode 100644 index 000000000..73cf4e634 --- /dev/null +++ b/changelog.d/update-policyengine-bundle-6.2.5.changed.md @@ -0,0 +1 @@ +Update the PolicyEngine bundle to 6.2.5 so state and congressional-district simulations use the certified ACS local-area dataset with the temporary compatibility fix for missing ACS WIC participation decisions. diff --git a/docker/Dockerfile b/docker/Dockerfile index 83b3cabe4..f38749eb5 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -1,4 +1,4 @@ FROM python:3.12 # Match the API bundle in pyproject.toml; the bundle updater changes both pins. # The models extra pins the complete certified runtime package set. -RUN pip install "policyengine[models]==6.2.1" ipython +RUN pip install "policyengine[models]==6.2.5" ipython diff --git a/pyproject.toml b/pyproject.toml index e660ff9e3..9488eb6a2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -47,7 +47,7 @@ dependencies = [ # versions certified by this PolicyEngine bundle. Cloud Run installs the # complete frozen environment from uv.lock; the generic image installs # this requirement directly. - "policyengine[models]==6.2.1", + "policyengine[models]==6.2.5", "pydantic", "pymysql", "python-dotenv", diff --git a/tests/integration/test_v2_catalog_installed.py b/tests/integration/test_v2_catalog_installed.py index 88718b122..98a2d772a 100644 --- a/tests/integration/test_v2_catalog_installed.py +++ b/tests/integration/test_v2_catalog_installed.py @@ -43,7 +43,8 @@ def test_installed_policyengine_catalog_is_complete_and_bounded() -> None: "parameter_nodes": 29_170, "parameters": 103_853, "parameter_values": 1_193_400, - "datasets": 2, + # US national and ACS-local datasets, plus the UK default dataset. + "datasets": 3, "regions": 826, } @@ -68,16 +69,31 @@ def test_installed_policyengine_catalog_is_complete_and_bounded() -> None: assert total_values == country.entity_counts()["parameter_values"] assert {dataset.name for dataset in catalog.country("us").datasets} == { - "populace_us_2024" + "populace_us_2024", + "populace_us_2024_acs_local", } assert {dataset.name for dataset in catalog.country("uk").datasets} == { "enhanced_frs_2024_25" } + us_catalog = catalog.country("us") + us_dataset_names = {dataset.id: dataset.name for dataset in us_catalog.datasets} + expected_dataset_by_region_type = { + "national": "populace_us_2024", + "place": "populace_us_2024", + "state": "populace_us_2024_acs_local", + "congressional_district": "populace_us_2024_acs_local", + } + for region in us_catalog.regions: + assert ( + us_dataset_names[region.default_dataset_id] + == (expected_dataset_by_region_type[region.region_type]) + ) + + # State and district records now have explicit certified dataset paths; + # only places still use the national dataset when no path is provided. assert [ (summary.region_type, summary.count) - for summary in catalog.country("us").fallback_summaries + for summary in us_catalog.fallback_summaries ] == [ - ("congressional_district", 436), ("place", 333), - ("state", 51), ] diff --git a/tests/unit/test_constants.py b/tests/unit/test_constants.py index 33a4040c8..df6990774 100644 --- a/tests/unit/test_constants.py +++ b/tests/unit/test_constants.py @@ -237,3 +237,21 @@ def test__uses_policyengine_bundle_versions_for_us_uk_and_core(self): assert POLICYENGINE_CORE_VERSION == expected_versions["core"] assert COUNTRY_PACKAGE_VERSIONS["us"] == expected_versions["us"] assert COUNTRY_PACKAGE_VERSIONS["uk"] == expected_versions["uk"] + + def test__us_bundle_certifies_acs_local_regional_dataset(self): + manifest = json.loads(get_py_manifest().read_text(encoding="utf-8")) + us_release = manifest["data_releases"]["us"] + region_datasets = us_release["region_datasets"] + + assert us_release["default_dataset"] == "populace_us_2024" + assert ( + region_datasets["state"]["path_template"] == "populace_us_2024_acs_local.h5" + ) + assert ( + region_datasets["congressional_district"]["path_template"] + == "populace_us_2024_acs_local.h5" + ) + assert "populace_us_2024_acs_local" in us_release["datasets"] + assert "populace_us_2024_acs_local" not in manifest.get( + "dataset_overlays", {} + ).get("us", {}) diff --git a/uv.lock b/uv.lock index fa520e7a9..b2260cf9d 100644 --- a/uv.lock +++ b/uv.lock @@ -1,5 +1,5 @@ version = 1 -revision = 3 +revision = 5 requires-python = ">=3.11" resolution-markers = [ "python_full_version >= '3.15' and sys_platform == 'win32'", @@ -2743,7 +2743,7 @@ wheels = [ [[package]] name = "policyengine" -version = "6.2.1" +version = "6.2.2" source = { registry = "https://pypi.org/simple" } dependencies = [ { name = "h5py" }, @@ -2755,9 +2755,9 @@ dependencies = [ { name = "pydantic" }, { name = "requests" }, ] -sdist = { url = "https://files.pythonhosted.org/packages/67/f2/3a75eb571fa3eda2e9f043c145cadae9eab4df6959fc447e767f92885d88/policyengine-6.2.1.tar.gz", hash = "sha256:0f2e51be23229ab5d8a8f80fb7b716fe4d3780806e2e16dfcda0362983beac56", size = 772927, upload-time = "2026-09-30T22:19:57.846Z" } +sdist = { url = "https://files.pythonhosted.org/packages/32/54/a74cea7fce9af49e950b5e05b076e8921e467968d158b43827a527070e4e/policyengine-6.2.2.tar.gz", hash = "sha256:e3db0556ec91ccbc32ba5c5c5568b095709f917fa617e1ceb16bb1bc406c277b", size = 775211, upload-time = "2026-10-07T22:30:00.039Z" } wheels = [ - { url = "https://files.pythonhosted.org/packages/5a/8b/4b216e42d150852e51c01ea654455496e1e1197c008e72e70f29392dec8c/policyengine-6.2.1-py3-none-any.whl", hash = "sha256:d07ff400da096be4b43843bd333ea0b7f42b06f5eea584e72c78f75a16fe3cdb", size = 252406, upload-time = "2026-09-30T22:19:56.61Z" }, + { url = "https://files.pythonhosted.org/packages/9a/d1/bf47e1e3f54fd4b01b0cbbbbc2bb67eb1bfb5b07a3110173a2a4bf265790/policyengine-6.2.2-py3-none-any.whl", hash = "sha256:c255dda960557bc9c255e5765c36470e8b88a43deacfa8efe46b3632ec312a69", size = 253372, upload-time = "2026-10-07T22:29:58.775Z" }, ] [package.optional-dependencies] @@ -2844,7 +2844,7 @@ requires-dist = [ { name = "mypy", marker = "extra == 'dev'", specifier = ">=1.15,<2" }, { name = "openai" }, { name = "packaging", specifier = ">=24,<27" }, - { name = "policyengine", extras = ["models"], specifier = "==6.2.1" }, + { name = "policyengine", extras = ["models"], specifier = "==6.2.2" }, { name = "policyengine-canada", specifier = "==0.96.3" }, { name = "policyengine-il", specifier = "==0.1.0" }, { name = "policyengine-ng", specifier = "==0.5.1" },