Skip to content

Expose axes in household calculators#322

Draft
MaxGhenis wants to merge 3 commits intomainfrom
codex/household-axes
Draft

Expose axes in household calculators#322
MaxGhenis wants to merge 3 commits intomainfrom
codex/household-axes

Conversation

@MaxGhenis
Copy link
Copy Markdown
Contributor

What changed

  • Adds an axes= keyword to pe.us.calculate_household and pe.uk.calculate_household.
  • Accepts either the lower-level nested axes shape or a flat list of axis dictionaries.
  • Defaults missing axis period values to the household calculator year.
  • Returns axis-series lists instead of scalars when axes are present, while preserving per-person result objects.
  • Documents the new household axes API and adds US/UK regression coverage.

Why

GiveCalc needs to evaluate the same household across donation amounts. Exposing axes through the public policyengine.py household calculators avoids forcing applications to reach into country-package Simulation classes directly.

Checks

  • uv run ruff check src/policyengine/tax_benefit_models/common src/policyengine/tax_benefit_models/us/household.py src/policyengine/tax_benefit_models/uk/household.py tests/test_household_impact.py
  • uv run ruff format --check src/policyengine/tax_benefit_models/common src/policyengine/tax_benefit_models/us/household.py src/policyengine/tax_benefit_models/uk/household.py tests/test_household_impact.py
  • uv run --extra dev pytest tests/test_household_impact.py -q
  • uv run --extra dev pytest tests/test_household_calculator_snapshot.py -q

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant