Skip to content
Merged
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
1 change: 1 addition & 0 deletions changelog.d/us-bundle-1.115.3.changed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Updated the bundled US release manifest to policyengine-us 1.691.10 and policyengine-us-data 1.115.3.
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ uk = [
]
us = [
"policyengine_core>=3.26.1",
"policyengine-us==1.691.3",
"policyengine-us==1.691.10",
]
dev = [
"pytest",
Expand All @@ -62,7 +62,7 @@ dev = [
"ruff>=0.9.0",
"policyengine_core>=3.26.1",
"policyengine-uk==2.88.14",
"policyengine-us==1.691.3",
"policyengine-us==1.691.10",
"towncrier>=24.8.0",
"mypy>=1.11.0",
"pytest-cov>=5.0.0",
Expand Down
28 changes: 14 additions & 14 deletions src/policyengine/data/release_manifests/us.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,34 +5,34 @@
"policyengine_version": "4.5.0",
"model_package": {
"name": "policyengine-us",
"version": "1.691.3",
"sha256": "c5d37aa4442f23d48bd5d587a02876c89d83c6135809f12988cc39bd3a47e8b2",
"wheel_url": "https://files.pythonhosted.org/packages/2a/03/e21c872664f90dcc99f1fcf29d1da71409c50cf8a7798ff0596ad10d9400/policyengine_us-1.691.3-py3-none-any.whl"
"version": "1.691.10",
"sha256": "a2c8365f152c2ec3332e996c4003d560b433b6c204bdfcc73bf094a0ae49f10e",
"wheel_url": "https://files.pythonhosted.org/packages/a7/a3/53630e30285cb441cc96e5264621b1b9e5af3b648ccd176b376f0e03a458/policyengine_us-1.691.10-py3-none-any.whl"
},
"data_package": {
"name": "policyengine-us-data",
"version": "1.113.1",
"version": "1.115.3",
"repo_id": "policyengine/policyengine-us-data",
"release_manifest_path": "releases/1.113.1/release_manifest.json",
"release_manifest_revision": "99e0ec7e784cdba43dd21ff1d80a081599a7a537"
"release_manifest_path": "releases/1.115.3/release_manifest.json",
"release_manifest_revision": "69fc39a7fece4c49ba87291e598e76b40568cc5d"
},
"certified_data_artifact": {
"data_package": {
"name": "policyengine-us-data",
"version": "1.113.1"
"version": "1.115.3"
},
"build_id": "policyengine-us-data-1.113.1",
"build_id": "policyengine-us-data-1.115.3",
"dataset": "enhanced_cps_2024",
"uri": "hf://policyengine/policyengine-us-data/enhanced_cps_2024.h5@99e0ec7e784cdba43dd21ff1d80a081599a7a537",
"sha256": "0ce549af18753287c097718362b8cd5cdccfc47953acf7f282709d604cf314d2"
"uri": "hf://policyengine/policyengine-us-data/enhanced_cps_2024.h5@69fc39a7fece4c49ba87291e598e76b40568cc5d",
"sha256": "96965b0d9931d36beb29486b25fffee8b630e3b62c9376e7265976e02f7ab3ca"
},
"certification": {
"compatibility_basis": "exact_build_model_version",
"data_build_id": "policyengine-us-data-1.113.1",
"built_with_model_version": "1.691.3",
"certified_for_model_version": "1.691.3",
"data_build_id": "policyengine-us-data-1.115.3",
"built_with_model_version": "1.691.10",
"certified_for_model_version": "1.691.10",
"certified_by": "policyengine.py bundled manifest",
"data_build_fingerprint": "sha256:d891044ece8ec3338904771c879b98ec11a12f1090c074e5b8cee846825d8056"
"data_build_fingerprint": "sha256:b80625974285a9cff23bc2436fc46df98477997d50aea61e73b7f137b5121584"
},
"default_dataset": "enhanced_cps_2024",
"datasets": {
Expand Down
39 changes: 18 additions & 21 deletions src/policyengine/data/release_manifests/us.trace.tro.jsonld
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"schema:name": "PolicyEngine",
"schema:url": "https://policyengine.org"
},
"schema:dateCreated": "2026-05-13T03:56:37.150215Z",
"schema:dateCreated": "2026-05-16T04:38:05.331368Z",
"schema:description": "TRACE TRO for certified runtime bundle us-4.5.0 covering the bundle manifest, the certified dataset artifact, the country model wheel, and the country data release manifest when it is available.",
"schema:name": "policyengine us certified bundle TRO",
"trov:createdWith": {
Expand Down Expand Up @@ -45,23 +45,23 @@
"trov:hasArtifact": {
"@id": "composition/1/artifact/data_release_manifest"
},
"trov:hasLocation": "https://huggingface.co/policyengine/policyengine-us-data/resolve/99e0ec7e784cdba43dd21ff1d80a081599a7a537/releases/1.113.1/release_manifest.json"
"trov:hasLocation": "https://huggingface.co/policyengine/policyengine-us-data/resolve/69fc39a7fece4c49ba87291e598e76b40568cc5d/releases/1.115.3/release_manifest.json"
},
{
"@id": "arrangement/1/location/dataset",
"@type": "trov:ArtifactLocation",
"trov:hasArtifact": {
"@id": "composition/1/artifact/dataset"
},
"trov:hasLocation": "https://huggingface.co/policyengine/policyengine-us-data/resolve/99e0ec7e784cdba43dd21ff1d80a081599a7a537/enhanced_cps_2024.h5"
"trov:hasLocation": "https://huggingface.co/policyengine/policyengine-us-data/resolve/69fc39a7fece4c49ba87291e598e76b40568cc5d/enhanced_cps_2024.h5"
},
{
"@id": "arrangement/1/location/model_wheel",
"@type": "trov:ArtifactLocation",
"trov:hasArtifact": {
"@id": "composition/1/artifact/model_wheel"
},
"trov:hasLocation": "https://files.pythonhosted.org/packages/2a/03/e21c872664f90dcc99f1fcf29d1da71409c50cf8a7798ff0596ad10d9400/policyengine_us-1.691.3-py3-none-any.whl"
"trov:hasLocation": "https://files.pythonhosted.org/packages/a7/a3/53630e30285cb441cc96e5264621b1b9e5af3b648ccd176b376f0e03a458/policyengine_us-1.691.10-py3-none-any.whl"
}
]
}
Expand All @@ -75,54 +75,51 @@
"@type": "trov:ResearchArtifact",
"schema:name": "policyengine.py bundle manifest for us",
"trov:mimeType": "application/json",
"trov:sha256": "b62f5676e4c17515e5aefde4101b58e1d8eb1dc7abe432e1ad8ccc5660bd50d0"
"trov:sha256": "2a0f005a25d2a6fae219c7f7a1f57652392298ea7d2a2764301c9025e7326804"
},
{
"@id": "composition/1/artifact/data_release_manifest",
"@type": "trov:ResearchArtifact",
"schema:name": "policyengine-us-data release manifest 1.113.1",
"schema:name": "policyengine-us-data release manifest 1.115.3",
"trov:mimeType": "application/json",
"trov:sha256": "d6b29ceff0cbf6a5cff4de94362ebc533dc5044c6a4155a46da7143140a8cb5f"
"trov:sha256": "50fec0baf199cf7f5bc5a16d9956d7c8d0fca3e2097b69dbb7f26cbbcf9114a9"
},
{
"@id": "composition/1/artifact/dataset",
"@type": "trov:ResearchArtifact",
"schema:name": "enhanced_cps_2024",
"trov:mimeType": "application/x-hdf5",
"trov:sha256": "0ce549af18753287c097718362b8cd5cdccfc47953acf7f282709d604cf314d2"
"trov:sha256": "96965b0d9931d36beb29486b25fffee8b630e3b62c9376e7265976e02f7ab3ca"
},
{
"@id": "composition/1/artifact/model_wheel",
"@type": "trov:ResearchArtifact",
"schema:name": "policyengine-us==1.691.3 wheel",
"schema:name": "policyengine-us==1.691.10 wheel",
"trov:mimeType": "application/zip",
"trov:sha256": "c5d37aa4442f23d48bd5d587a02876c89d83c6135809f12988cc39bd3a47e8b2"
"trov:sha256": "a2c8365f152c2ec3332e996c4003d560b433b6c204bdfcc73bf094a0ae49f10e"
}
],
"trov:hasFingerprint": {
"@id": "composition/1/fingerprint",
"@type": "trov:CompositionFingerprint",
"trov:sha256": "d6d03e72c1538a20ca214e5d80c5e11b6d270c1e57a0910e05ad682ec64b63d1"
"trov:sha256": "e5fa0f4b9b84c8e898deb4d5b47bc15f6203e50d68c551a60d57d8fcbc64901d"
}
},
"trov:hasPerformance": {
"@id": "trp/1",
"@type": "trov:TransparentResearchPerformance",
"pe:builtWithModelVersion": "1.691.3",
"pe:builtWithModelVersion": "1.691.10",
"pe:certifiedBy": "policyengine.py bundled manifest",
"pe:certifiedForModelVersion": "1.691.3",
"pe:ciGitRef": "refs/heads/main",
"pe:ciGitSha": "ab381161123fc076c13981f4131be9400f833810",
"pe:ciRunUrl": "https://github.com/PolicyEngine/policyengine.py/actions/runs/25952327329",
"pe:certifiedForModelVersion": "1.691.10",
"pe:compatibilityBasis": "exact_build_model_version",
"pe:dataBuildFingerprint": "sha256:d891044ece8ec3338904771c879b98ec11a12f1090c074e5b8cee846825d8056",
"pe:dataBuildId": "policyengine-us-data-1.113.1",
"pe:emittedIn": "github-actions",
"rdfs:comment": "Certification of build policyengine-us-data-1.113.1 for policyengine-us 1.691.3.",
"pe:dataBuildFingerprint": "sha256:b80625974285a9cff23bc2436fc46df98477997d50aea61e73b7f137b5121584",
"pe:dataBuildId": "policyengine-us-data-1.115.3",
"pe:emittedIn": "local",
"rdfs:comment": "Certification of build policyengine-us-data-1.115.3 for policyengine-us 1.691.10.",
"trov:accessedArrangement": {
"@id": "arrangement/1"
},
"trov:startedAtTime": "2026-05-13T03:56:37.150215Z",
"trov:startedAtTime": "2026-05-16T04:38:05.331368Z",
"trov:wasConductedBy": {
"@id": "trs"
}
Expand Down
6 changes: 3 additions & 3 deletions tests/test_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,12 @@ def test_has_release_manifest_metadata(self):
assert us_latest.release_manifest is not None
assert us_latest.release_manifest.country_id == "us"
assert us_latest.model_package.name == "policyengine-us"
assert us_latest.model_package.version == "1.691.3"
assert us_latest.model_package.version == "1.691.10"
assert us_latest.data_package.name == "policyengine-us-data"
assert us_latest.data_package.version == "1.113.1"
assert us_latest.data_package.version == "1.115.3"
assert (
us_latest.default_dataset_uri
== "hf://policyengine/policyengine-us-data/enhanced_cps_2024.h5@99e0ec7e784cdba43dd21ff1d80a081599a7a537"
== "hf://policyengine/policyengine-us-data/enhanced_cps_2024.h5@69fc39a7fece4c49ba87291e598e76b40568cc5d"
)

def test_has_hundreds_of_parameters(self):
Expand Down
36 changes: 18 additions & 18 deletions tests/test_release_manifests.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,27 +64,27 @@ def test__given_us_manifest__then_has_pinned_model_and_data_packages(self):
assert manifest.country_id == "us"
assert manifest.policyengine_version == POLICYENGINE_VERSION
assert manifest.model_package.name == "policyengine-us"
assert manifest.model_package.version == "1.691.3"
assert manifest.model_package.version == "1.691.10"
assert manifest.data_package.name == "policyengine-us-data"
assert manifest.data_package.version == "1.113.1"
assert manifest.data_package.version == "1.115.3"
assert manifest.data_package.repo_id == "policyengine/policyengine-us-data"
assert (
manifest.data_package.release_manifest_path
== "releases/1.113.1/release_manifest.json"
== "releases/1.115.3/release_manifest.json"
)
assert (
manifest.data_package.release_manifest_revision
== "99e0ec7e784cdba43dd21ff1d80a081599a7a537"
== "69fc39a7fece4c49ba87291e598e76b40568cc5d"
)
assert manifest.certified_data_artifact is not None
assert (
manifest.certified_data_artifact.build_id == "policyengine-us-data-1.113.1"
manifest.certified_data_artifact.build_id == "policyengine-us-data-1.115.3"
)
assert manifest.certified_data_artifact.dataset == "enhanced_cps_2024"
assert manifest.certification is not None
assert manifest.certification.data_build_id == "policyengine-us-data-1.113.1"
assert manifest.certification.built_with_model_version == "1.691.3"
assert manifest.certification.certified_for_model_version == "1.691.3"
assert manifest.certification.data_build_id == "policyengine-us-data-1.115.3"
assert manifest.certification.built_with_model_version == "1.691.10"
assert manifest.certification.certified_for_model_version == "1.691.10"

def test__given_uk_manifest__then_has_pinned_model_and_data_packages(self):
manifest = get_release_manifest("uk")
Expand Down Expand Up @@ -119,7 +119,7 @@ def test__given_us_dataset_name__then_resolves_to_versioned_hf_url(self):

assert (
resolved
== "hf://policyengine/policyengine-us-data/enhanced_cps_2024.h5@99e0ec7e784cdba43dd21ff1d80a081599a7a537"
== "hf://policyengine/policyengine-us-data/enhanced_cps_2024.h5@69fc39a7fece4c49ba87291e598e76b40568cc5d"
)

def test__given_uk_dataset_name__then_resolves_to_versioned_hf_url(self):
Expand Down Expand Up @@ -240,17 +240,17 @@ def test__given_country__then_can_fetch_data_release_manifest(self):
mock_get.assert_called_once()
assert mock_get.call_args.args[0] == (
"https://huggingface.co/policyengine/policyengine-us-data/resolve/"
"99e0ec7e784cdba43dd21ff1d80a081599a7a537/"
"releases/1.113.1/release_manifest.json"
"69fc39a7fece4c49ba87291e598e76b40568cc5d/"
"releases/1.115.3/release_manifest.json"
)

def test__given_explicit_manifest_revision__then_builds_manifest_url(self):
manifest = get_release_manifest("us")

assert https_release_manifest_uri(manifest.data_package) == (
"https://huggingface.co/policyengine/policyengine-us-data/resolve/"
"99e0ec7e784cdba43dd21ff1d80a081599a7a537/"
"releases/1.113.1/release_manifest.json"
"69fc39a7fece4c49ba87291e598e76b40568cc5d/"
"releases/1.115.3/release_manifest.json"
)

def test__given_release_manifest_artifact_uses_version_tag__then_rewrites_to_commit(
Expand All @@ -261,14 +261,14 @@ def test__given_release_manifest_artifact_uses_version_tag__then_rewrites_to_com
"schema_version": 1,
"data_package": {
"name": "policyengine-us-data",
"version": "1.113.1",
"version": "1.115.3",
},
"artifacts": {
"enhanced_cps_2024": {
"kind": "microdata",
"path": "enhanced_cps_2024.h5",
"repo_id": "policyengine/policyengine-us-data",
"revision": "1.113.1",
"revision": "1.115.3",
"sha256": "abc",
"size_bytes": 123,
}
Expand All @@ -283,7 +283,7 @@ def test__given_release_manifest_artifact_uses_version_tag__then_rewrites_to_com

assert (
manifest.artifacts["enhanced_cps_2024"].uri
== "hf://policyengine/policyengine-us-data/enhanced_cps_2024.h5@99e0ec7e784cdba43dd21ff1d80a081599a7a537"
== "hf://policyengine/policyengine-us-data/enhanced_cps_2024.h5@69fc39a7fece4c49ba87291e598e76b40568cc5d"
)
assert (
manifest.source_sha256
Expand Down Expand Up @@ -394,7 +394,7 @@ def test__given_private_manifest_unavailable__then_bundled_certification_is_used
):
certification = certify_data_release_compatibility(
"us",
runtime_model_version="1.691.3",
runtime_model_version="1.691.10",
)

assert certification == get_release_manifest("us").certification
Expand All @@ -410,7 +410,7 @@ def test__given_manifest_request_timeout__then_bundled_certification_is_used(
):
certification = certify_data_release_compatibility(
"us",
runtime_model_version="1.691.3",
runtime_model_version="1.691.10",
)

assert certification == get_release_manifest("us").certification
Expand Down
18 changes: 15 additions & 3 deletions tests/test_trace_tro.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
DataReleaseManifestUnavailableError,
get_data_release_manifest,
get_release_manifest,
https_dataset_uri,
)
from policyengine.provenance.trace import (
POLICYENGINE_ORGANIZATION,
Expand Down Expand Up @@ -54,6 +55,17 @@ def _fake_fetch_pypi(name: str, version: str) -> dict:
return {"sha256": FAKE_WHEEL_SHA, "url": FAKE_WHEEL_URL}


def _https_location_from_hf_uri(uri: str) -> str:
path_without_scheme = uri.removeprefix("hf://")
path_without_revision, revision = path_without_scheme.rsplit("@", 1)
repo_owner, repo_name, path_in_repo = path_without_revision.split("/", 2)
return https_dataset_uri(
repo_id=f"{repo_owner}/{repo_name}",
path_in_repo=path_in_repo,
revision=revision,
)


def _us_data_release_manifest(
sha256: str = "c" * 64,
data_build_fingerprint: str = "sha256:build",
Expand Down Expand Up @@ -290,9 +302,9 @@ def test__given_data_manifest_revision_is_unresolvable__then_dataset_location_us
dataset_location = next(
loc for loc in locations if loc["@id"].endswith("dataset")
)
assert (
dataset_location["trov:hasLocation"]
== "https://huggingface.co/policyengine/policyengine-us-data/resolve/99e0ec7e784cdba43dd21ff1d80a081599a7a537/enhanced_cps_2024.h5"
assert country_manifest.certified_data_artifact is not None
assert dataset_location["trov:hasLocation"] == _https_location_from_hf_uri(
country_manifest.certified_data_artifact.uri
)
assert "/resolve/1.113.1/" not in dataset_location["trov:hasLocation"]

Expand Down
19 changes: 13 additions & 6 deletions tests/test_us_regions.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@
from policyengine.countries.us.regions import (
us_region_registry,
)
from policyengine.provenance.manifest import get_release_manifest


def _current_us_data_revision() -> str:
revision = get_release_manifest("us").data_package.release_manifest_revision
assert revision is not None
return revision


class TestUSStates:
Expand Down Expand Up @@ -104,8 +111,8 @@ def test__given_us_registry__then_has_national_region(self):
assert national.label == "United States"
assert national.region_type == "national"
assert (
national.dataset_path
== "hf://policyengine/policyengine-us-data/enhanced_cps_2024.h5@99e0ec7e784cdba43dd21ff1d80a081599a7a537"
national.dataset_path == "hf://policyengine/policyengine-us-data/"
f"enhanced_cps_2024.h5@{_current_us_data_revision()}"
)

def test__given_us_registry__then_has_51_states(self):
Expand Down Expand Up @@ -133,8 +140,8 @@ def test__given_california_region__then_has_correct_format(self):
assert ca.region_type == "state"
assert ca.parent_code == "us"
assert (
ca.dataset_path
== "hf://policyengine/policyengine-us-data/states/CA.h5@99e0ec7e784cdba43dd21ff1d80a081599a7a537"
ca.dataset_path == "hf://policyengine/policyengine-us-data/"
f"states/CA.h5@{_current_us_data_revision()}"
)
assert ca.state_code == "CA"
assert ca.state_name == "California"
Expand Down Expand Up @@ -166,8 +173,8 @@ def test__given_ca_first_district__then_has_correct_format(self):
assert ca01.region_type == "congressional_district"
assert ca01.parent_code == "state/ca"
assert (
ca01.dataset_path
== "hf://policyengine/policyengine-us-data/districts/CA-01.h5@99e0ec7e784cdba43dd21ff1d80a081599a7a537"
ca01.dataset_path == "hf://policyengine/policyengine-us-data/"
f"districts/CA-01.h5@{_current_us_data_revision()}"
)
assert ca01.state_code == "CA"
assert not ca01.requires_filter
Expand Down
Loading
Loading