When you want to use OpenFisca, either for running simulations or editing a country package, you need to setup a specific environement. If you don’t want the OpenFisca environment to interfere with your pre-existing setup, or if you don’t have one, you can use a container such as Docker that will set everything up for you.
FROM python:2-stretch
RUN pip install openfisca_country_template
WORKDIR /app
docker build --rm -t openfisca-country-template .
docker run -it openfisca-country-template bash
If you need to run local files with your Docker image, you can interface (i.e. mount) a local directory with a directory in your docker interface.
E.g. You need to update a country package such as openfisca-country-template
openfisca-core
in your project
directoryThe Dokerfile:
FROM python:2-stretch
RUN pip install OpenFisca-core
WORKDIR /country-template
country-template
in the directoryThe directory:
project
│ README.md
│ Dockerfile
│
└───country-template
docker build --rm -t openfisca-core .
docker run -it -v /absolute/path/to/country-template/:/country-template openfisca-core bash
country-template
in the Docker container
Use the country-template
in the docker container, any changes to the country-template
local files will affect the country-template
files in the container.