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/py-dataset-inputs.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update the PolicyEngine bundle to 6.20.5. From 6.0.0 to 6.20.4, .py built US simulations from a dataset without listing most of the dataset's inputs, so policyengine-us recalculated marginal tax rates without the household's income other than earnings, its age and its location, and `target=cliff` economy results counted the lost income as cliff gaps. 6.20.5 lists the inputs, so US marginal tax rates and `target=cliff` results calculated from datasets keep the household's inputs. US labor supply responses, which read marginal tax rates, change too: in .py's example, one earner's response to a reform moves from -$591.09 to policyengine-us's -$655.38.
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
@@ -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.20.4" ipython
RUN pip install "policyengine[models]==6.20.5" ipython
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,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.20.4",
"policyengine[models]==6.20.5",
# The simulation service's generated client, which builds the requests of
# API v2's household calculation, simulation and report routes, and the
# one-time migration command's run-free report create
Expand Down
24 changes: 24 additions & 0 deletions tests/unit/test_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ def find_spec(self, fullname, path=None, target=None):
# incomes in the order of their rows (PolicyEngine/policyengine.py#777).
FIRST_RELEASE_WITH_STABLE_INEQUALITY_SORT = Version("6.20.4")

# The first .py release whose US simulations built from a dataset list every
# stored dataset column in ``input_variables``, so policyengine-us's
# ``marginal_tax_rate`` recalculates net income with the household's inputs
# (PolicyEngine/policyengine.py#783).
FIRST_RELEASE_RECORDING_DATASET_INPUTS = Version("6.20.5")


class TestBundleDatasetDisplayLabels:
@pytest.mark.parametrize(
Expand Down Expand Up @@ -343,6 +349,24 @@ def test__requests_name_a_release_that_sorts_incomes_stably(self):
assert installed_version == POLICYENGINE_VERSION
assert Version(installed_version) >= FIRST_RELEASE_WITH_STABLE_INEQUALITY_SORT

def test__requests_name_a_release_that_records_dataset_inputs(self):
"""API v1's economy requests run on a .py release that records dataset inputs.

Economy requests send ``POLICYENGINE_VERSION`` as
``policyengine_version``, and the simulation service runs each request
on the app it deployed for that version. From 6.0.0 up to the release
in ``FIRST_RELEASE_RECORDING_DATASET_INPUTS``, .py built a US
simulation from a dataset without listing most of the dataset's
columns in ``input_variables``. policyengine-us's ``marginal_tax_rate``
raises the earnings of each of the household's two adults with the
highest market income in a branch of the simulation that deletes every
variable not in that list, then recalculates household net income.
The branch lost the household's income other than earnings, its age
and its location, so marginal tax rates were wrong, and
``target=cliff`` results counted the lost income as cliff gaps.
"""
assert Version(POLICYENGINE_VERSION) >= FIRST_RELEASE_RECORDING_DATASET_INPUTS

def test__uses_policyengine_bundle_versions_for_us_uk_and_core(self):
expected_versions = self._expected_bundle_versions()
assert expected_versions["policyengine"] == POLICYENGINE_VERSION
Expand Down
8 changes: 4 additions & 4 deletions uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading