Images OpenFisca du gouvernement de la Polynésie Française
10K+
This is the package modeling the French Polynesia rules from https://lexpol.cloud.pf/ :
But this is a work in progress.
Serving the OpenFisca WEB API is not currently supported on Windows computer. It can only be run natively on macOS and Linux. Thus, on Windows computers a virtual machine is required (pyenv will not suffice). On Windows, we recommend installing Linux on Windows using Microsoft WSL2: https://learn.microsoft.com/fr-fr/windows/wsl/install
In the rest of this README we assume that on Windows WSL2 is used. Any command we describe must thus be executed in a wsl terminal. To open a wsl terminal, run CMD or PowerShell and run the command:
wsl
On macOS use homebrew to install python 3.13:
brew install [email protected]
See https://formulae.brew.sh/formula/[email protected] for more details.
On Linux or Windows WSL2 Run the following command
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update
sudo apt-get install python3.13
See https://launchpad.net/~deadsnakes/+archive/ubuntu/ppa for more details.
OpenFisca will install two python scripts to test and serve the API.
So make sure that python scripts are in your path.
This should be the case by default on Linux and macOS.
On Windows add %USERPROFILE%\AppData\Roaming\Python\Python310\Scripts to you PATH.
Make sure PIP is up to date
python3 -m pip install --upgrade pip
Pip installs the openfisca core version 43.5.0 with the flask web api. This will install the python package, and add the two scripts we mentioned above to the python scripts directory.
pip3 install openfisca-core[web-api]==43.5.0
In French Polynesia, amounts are expressed in Pacific Franc (XPF) and can become very large. Thus, they can reach large values that can lead to computation errors when using a 32-bit floating point number. For this reason when need to edit OpenFisca Core tu use 64-bit floating point numbers instead of 32-bit ones.
- Locate your
openfisca-coreinstall directory in thesite-packagedirectory.
- On Windows it will be located at one of the two following paths:
%HOMEDRIVE%%HOMEPATH%\AppData\Roaming\Python\Python310\site-packages\openfisca_core- Or
%HOMEDRIVE%\Program Files\Python310\Lib\site-packages\openfisca_core.- Or
%HOMEDRIVE%%HOMEPATH%\AppData\Local\Programs\Python\Python310\Lib\site-packages\openfisca_core- On Windows WSL2 it will be located at:
%HOMEDRIVE%%HOMEPATH%\AppData\Local\Packages\CanonicalGroupLimited.Ubuntu_79rhkp1fndgsc\LocalState\rootfs\usr\local\lib\python3.13\dist-packages\openfisca_core- On Linux it will be located at:
$HOMEBREW_PREFIX/lib/python3.13/site-packages/openfisca_core- Open the file
openfisca_core\variables\config.py.- At line
17and24, replacenumpy.int32tonumpy.int64andnumpy.float32tonumpy.float64- Open the file
openfisca_core/tools/__init__.py- At lines
43and45, replacenumpy.float32tonumpy.float64.
Clone openfisca-pf project:
git clone https://github.com/openfisca/openfisca-pf.git
Go to the folder where you clone the openfisca-pf project:
cd openfisca-pf
Install the local project as a python package under development:
pip3 install --editable .[dev]
This command makes pip install a package bound to a local directory instead of downloading it from the web.
This way if you modify the openfisca-pf code, your changes will be taken into account on the fly.
You can run tests of the OpenFisca PF country package using:
openfisca test --country-package openfisca_pf openfisca_pf/tests
And you can serve the Openfisca Web API locally (for more information visit the documentation):
openfisca serve --reload -f config.py
ONLY AVAILABLE ON linux, macOS, and Windows WSL2
To read more about the openfisca serve command, check out its documentation.
You can make sure that your instance of the API is working by requesting:
curl "http://localhost:5000/spec"
This endpoint returns the Open API specification of the Openfisca PF API. For more details on the API see the documentation on the OpenFisca Web API documentation.
Content type
Image
Digest
sha256:c28a11b81…
Size
152.9 MB
Last updated
3 months ago
docker pull govpf/openfisca-pf:0.9.5