catala/french_law/python
2021-06-26 17:12:15 +02:00
..
src Improve Python library API 2021-06-26 17:12:15 +02:00
.gitignore Various bugfixing and improvements for the Python backend 2021-06-25 00:16:21 +02:00
dependencies.txt Various bugfixing and improvements for the Python backend 2021-06-25 00:16:21 +02:00
main.py Improve Python library API 2021-06-26 17:12:15 +02:00
Makefile Improve Python library API 2021-06-26 17:12:15 +02:00
README.md Improve Python library API 2021-06-26 17:12:15 +02:00
setup_env.sh Missing cd 2021-06-24 18:27:02 +02:00

Python French Law Library

This folder contains a ready-to-use Python library featuring French public algorithms coded up in Catala.

The Python version expected to run the Python code is above 3.6. For the commands noted below to run, you are expected to setup a virtual Python environment with virtualenv by running the setup_env.sh script.

Organization

Law source

The src/ folder contains the Python files generated by the Catala compiler. To update them from the Catala sources, invoke this command from the root of the repository:

make generate_french_law_library_python

The Python files generated by the Catala compiler expect the presence of the src/catala.py file which contains the definitions of the values and operations used by the generated code.

All theses Python files feature type annotations which can be checked against using the following command inside this directory (french_law/python)

make type

API

To use the algorithms in src/, you can take a look at the example provided in main.py. It is very important to wrap all of the input parameters using src/catala.py conversion functions.

You can benchmark the computation using the following command inside this directory (french_law/python)

make bench