This is the package modelling the French Polynesia tax system. What is currently modelled:
- CST-S
- IT
- CST-NS
- TVA & CPS
But this is a work in progress and none of those taxes are validated yet.
It includes the pricing for the French Polynesia estate managment for the public domain and its own lands.
See the Confluence documentation here:
https://doc.projet.gov.pf/pages/viewpage.action?pageId=40938529
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 install 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:
wslOn macOS use homebrew to install python 3.10:
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.10See 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 pipPip install the openfisca core version 40.0.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]==40.0.0In 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 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 path:
%HOMEDRIVE%%HOMEPATH%\AppData\Roaming\Python\Python310\site-packages\openfisca_core%HOMEDRIVE%\Program Files\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.10\dist-packages\openfisca_core- On Linux it will be located at:
$HOMEBREW_PREFIX/lib/python3.10/site-packages/openfisca_core- Open the file
openfisca_core\variables\config.py.- At line
18and25, replacenumpy.int32tonumpy.int64andnumpy.float32tonumpy.float64- Open the file
openfisca_core/tools/__init__.py- At lines
44and46, replacenumpy.float32tonumpy.float64.
Clone the OpenFisca-PF project:
wget https://github.com/openfisca/openfisca-core/archive/refs/tags/40.0.0.zipGo to the folder where you clone the Openfisca PF project
cd openfisca-pfInstall 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:
cd openfisca-pf
openfisca test --country-package openfisca_pf openfisca_pf/testsAnd you can serve the Openfisca Web API locally (for more information visit the documentation):
cd openfisca-pf
openfisca serve --reload -f config.pyONLY 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.