OpenFisca France

raw JSON →
175.0.40 verified Fri May 01 auth: no python

OpenFisca Rules as Code model for France. It simulates the French tax-benefit system. Current version: 175.0.40, requires Python >=3.9. Released continuously.

pip install openfisca-france
error ModuleNotFoundError: No module named 'openfisca_france'
cause Package not installed or imported with wrong syntax.
fix
Run: pip install openfisca-france. Then import as: from openfisca_france import FranceTaxBenefitSystem
error KeyError: 'individus'
cause Incorrect entity key in simulation builder.
fix
Use 'individus' (with 's') as key, and provide a list of person IDs.
error AttributeError: 'NoneType' object has no attribute 'calculate'
cause Simulation object is None because builder.build_from_entities failed (e.g., missing input).
fix
Ensure all required inputs (like income, age) are set before calculating.
breaking Version 6.0.0 introduced a major refactoring of variable names and entities. Old variable names (e.g., 'salaire_net', 'impots_directs') are deprecated or removed.
fix Update variable names to current ones as per the changelog. Use `openfisca_france.variables` to list available variables.
deprecated Python 3.9 is the minimum; support for Python 3.8 was dropped in version 5.0.0.
fix Upgrade Python to 3.9 or higher.
gotcha The simulation builder now requires explicit entity mapping; using `SimulationBuilder` incorrectly can lead to entity mismatches.
fix Always specify entities as a dict: {'individus': [...], 'familles': [...], 'menages': [...]}. Do not rely on automatic detection.

Simulate the monthly disposable income of a single person earning 2000 EUR/month.

from openfisca_france import FranceTaxBenefitSystem
from openfisca_core.simulation_builder import SimulationBuilder

# Create the tax-benefit system
tbs = FranceTaxBenefitSystem()

# Create a simulation for a single person
builder = SimulationBuilder()
simulation = builder.build_from_entities(tbs, {
    'individus': ['person1'],
    'familles': ['famille1'],
    'menages': ['menage1'],
})
simulation.set_input('age', '2026-01-01', {'person1': 30})
simulation.set_input('salaire_de_base', '2026-01', {'person1': 2000})
simulation.calculate('revenu_disponible', '2026-01')