Skip to main content

OpenFisca Core

PyPi Downloads PyPi Version

Python Contributors

Newsletter Twitter Slack

OpenFisca is a versatile microsimulation free software. Check the online documentation for more details.

This package contains the core features of OpenFisca, which are meant to be used by country packages such as OpenFisca-France. Bootstrapping your own country package should not take more than 5 minutes: check our country package template.

Environment

OpenFisca runs on Python. See pyproject.toml for supported versions.

OpenFisca also relies strongly on NumPy. The last four minor versions should work, but only the latest/stable is tested.

Installation

If you're developing your own country package, you don't need to explicitly install OpenFisca-Core. It just needs to appear in your package dependencies. If you want to contribute to OpenFisca-Core itself, welcome! To install it locally we recommend to use uv.

Installing openfisca-core with uv

This installation requires Python and GIT installations.

To install openfisca-core locally in development mode run the following commands in a shell terminal:

git clone https://github.com/openfisca/openfisca-core.git
cd openfisca-core
uv run make test

Testing

For integration testing purposes, openfisca-core relies on country-template and extension-template. Because these packages rely at the same time on openfisca-core, they need to be installed separately.

To run the entire test suite:

uv run make test

If you have many tests, you could run them in parallel :

uv run make test-core openfisca_args="--in-parallel"

You could add an option --num-workers=4 to limit to 4 threads. Default is your CPU Core number minus 1.

Be aware that this add overhead so use it only for huge test suite.

To run all the tests defined on a test file:

uv run pytest tests/core/test_parameters.py

To run a single test:

uv run pytest tests/core/test_parameters.py -k test_parameter_for_period

Types

This repository relies on MyPy for optional dynamic & static type checking.

As NumPy introduced the typing module in 1.20.0, to ensure type hints do not break the code at runtime, we run the checker against the last four minor NumPy versions.

Type checking is already run with make test. To run the type checker alone:

uv run make check-types

Style

This repository adheres to a certain coding style, and we invite you to follow it for your contributions to be integrated promptly.

Style checking is already run with make test. To run the style checker alone:

uv run make check-style

To automatically style-format your code changes:

uv run make format-style

To automatically style-format your code changes each time you commit:

touch .git/hooks/pre-commit
chmod +x .git/hooks/pre-commit

tee -a .git/hooks/pre-commit << END
#!/bin/bash
#
# Automatically format your code before committing.
# Change .venv/bin/activate if your virtual environment is located elsewhere.
source .venv/bin/activate
exec make format-style
exec make check-style
END

Documentation

OpenFisca’s toolchain checks whether documentation builds correctly and updates it automatically with each contribution to this repository.

In the meantime, please take a look at our contributing guidelines for some general tips on how to document your contributions, and at our official documentation's repository to in case you want to know how to build it by yourself —and improve it!

Serving the API

OpenFisca-Core provides a Web-API. It is by default served on the 5000 port.

To run it with the mock country package openfisca_country_template and another port value such as 2000, run:

openfisca serve --country-package openfisca_country_template --port 2000

To read more about the openfisca serve command, check out its documentation.

By default, the Web API uses 3 workers to avoid this issue. Without it, AJAX requests from Chrome sometimes take more than 20s to process. You can change the number of workers by specifying a --workers k option.

You can test that the API is running by executing the command:

curl http://localhost:2000/parameters

For more information about endpoints and input formatting, see the official documentation.

Metadata

Release files for OpenFisca-Core 46.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for OpenFisca-Core 46.0.1
File Size Uploaded Provenance
openfisca_core-46.0.1.tar.gz 185.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for OpenFisca-Core 46.0.1
File Interpreter ABI Platform
openfisca_core-46.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 437.0 kB

Release files / openfisca_core-46.0.1.tar.gz

Download URL openfisca_core-46.0.1.tar.gz
Size 185.2 kB
Tags Source
SHA-256 checksum
How to use checksums
0898c5e3cbbe1534f1ec449e068bbe3da40618fbf91ebc5830e62ae08fa7a607
BLAKE2b-256 checksum
How to use checksums
8018bc55b88506160a0b28707d30284c7aab17b9b0bf950c76b884e54eec33df
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Release files / openfisca_core-46.0.1-py3-none-any.whl

Download URL openfisca_core-46.0.1-py3-none-any.whl
Size 251.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
09a4cdc1627684cb97a11d1aac50577fb8f0d3549b742480c5d3e1b8d9fa3a31
BLAKE2b-256 checksum
How to use checksums
7116c0a3fb2e4bb603396813b044fe543b7bbf360f04919b7d42b730943a1598
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via uv/0.13.1 {"installer":{"name":"uv","version":"0.13.1","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

Security for OpenFisca-Core 46.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

46.0.1 This release

2 release files No provenance

2.0.1.dev1

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page