Openfisca-core

Latest version: v43.3.5

Safety actively analyzes 723177 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 36 of 66

25.0.0

Breaking changes

- Change the syntax of OpenFisca YAML tests

For instance, a test that was using the `input_variables` keyword like:

yaml
- name: Basic income
period: 2016-12
input_variables:
salary: 1200
output_variables:
basic_income: 600


becomes:

yaml
- name: Basic income
period: 2016-12
input:
salary: 1200
output:
basic_income: 600


A test that was fully specifying its entities like:

yaml
name: Housing tax
period: 2017-01
households:
- parents: [ Alicia ]
children: [ Michael ]
persons:
- id: Alicia
birth: 1961-01-15
- id: Michael
birth: 2002-01-15
output_variables:
housing_tax:
2017: 1000


becomes:

yaml
name: Housing tax
period: 2017-01
input:
household:
parents: [ Alicia ]
children: [ Michael ]
persons:
Alicia:
birth: 1961-01-15
Michael:
birth: 2002-01-15
output:
housing_tax:
2017: 1000


A **migration script** is available to automatically convert tests:

sh
python openfisca_core/scripts/migrations/v24_to_25.py /path/to/tests/


> Note for country packages using Scenarios (e.g. France, Tunisia):
> Tests are not using scenarios anymore. Therefore, tests cannot partially specify entities anymore. Tests using entities inference may need manual adaptation in addition to the script.

- The `Entity` constructor (usually not directly called by users) does not accept an `entities_json` parameter anymore.


Deprecation

- Deprecate `openfisca-run-test`
- `openfisca test` should be used instead.

- Deprecate the use of the `simulation_json` parameter in the `Simulation` constructor.
- `SimulationBuilder(tax_benefit_system).build_from_entities(simulation_json)` should be used instead


New features

- In YAML tests, allow to define expected output for a specific entity

For instance:

yaml
name: Housing tax
period: 2017-01
input:
...
output:
persons:
Alicia:
salary: 3000


- In YAML tests, allow to specify an extension to use to run the test:
- See [example](https://github.com/openfisca/openfisca-core/blob/25.0.0/tests/core/yaml_tests/test_with_extension.yaml)

- In YAML tests, allow the use of YAML anchors:
- See [example](https://github.com/openfisca/openfisca-core/blob/25.0.0/tests/core/yaml_tests/test_with_anchors.yaml)

- Introduce [`EnumArray.decode_to_str`](https://openfisca.org/doc/openfisca-python-api/enum_array.html#openfisca_core.indexed_enums.EnumArray.decode_to_str)


Architecture changes

- Move the complex initialisation logics (for JSON-like inputs) to `SimulationBuilder`, away from the `Simulation` and `Entity` classes

24.11.0

- In Python, simplify getting known periods for variable in a simulation:

Before:

py
simulation = ...
holder = simulation.persons.get_holder('salary')
holder.get_known_periods()


After:

py
simulation = ...
simulation.get_known_periods('salary')

24.10.0

- In Python, simplify simulation array deletion:

Before:

py
simulation = ...
holder = simulation.persons.get_holder('salary')
holder.delete_arrays('2018-08')


After:

py
simulation = ...
simulation.delete_arrays('salary', '2018-08')

24.9.9

- Set a 120s default timeout in `openfisca serve`
- Otherwise, they regularly restart with an anxiety-provoking "[CRITICAL] WORKER TIMEOUT (pid:2137)" message in log

24.9.8

- Allow non-integral inputs to int variables

24.9.7

- Ensure `path.to.parameter` syntax works consistently across country and extension

Page 36 of 66

Links

Releases

Has known vulnerabilities

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.