Skip to content

Make simulation input exports safe by default#496

Merged
MaxGhenis merged 2 commits into
masterfrom
safe-input-export
May 17, 2026
Merged

Make simulation input exports safe by default#496
MaxGhenis merged 2 commits into
masterfrom
safe-input-export

Conversation

@MaxGhenis
Copy link
Copy Markdown
Contributor

Fixes #417.
Fixes #418.

Summary

  • Default Simulation.to_input_dataframe() and Simulation.to_input_dict() to export only structurally input variables populated through set_input on the current branch.
  • Preserve the historical all-known-values export path with include_computed_variables=True.
  • Add Simulation.true_input_variables / get_input_variables(include_computed_variables=False) for callers that need the safe source-input set.

Verification

  • uv run --no-sync pytest tests/core/test_simulations.py tests/core/test_subsample_invalidates_cache.py -q
  • uv run --no-sync ruff format --check policyengine_core/simulations/simulation.py tests/core/test_simulations.py
  • uv run --no-sync ruff check policyengine_core/simulations/simulation.py tests/core/test_simulations.py
  • uvx --from towncrier towncrier build --draft --version 3.26.9

Documentation Review

  • Not required beyond docstrings: docs/python_api/simulations.md uses autodoc :members:, so the changed public methods and defaults are surfaced from the source docstrings.
  • Impact: medium. Confidence: high.

@MaxGhenis MaxGhenis marked this pull request as ready for review May 17, 2026 18:16
@MaxGhenis MaxGhenis merged commit 6a616d6 into master May 17, 2026
23 checks passed
@MaxGhenis MaxGhenis deleted the safe-input-export branch May 17, 2026 18:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant