%global _empty_manifest_terminate_build 0 Name: python-OpenFisca-Core Version: 38.0.3 Release: 1 Summary: A versatile microsimulation free software License: https://www.fsf.org/licensing/licenses/agpl-3.0.html URL: https://github.com/openfisca/openfisca-core Source0: https://mirrors.nju.edu.cn/pypi/web/packages/54/b5/e0e2995f0392c2d57c0e77ddc6ce515ffae30024740af0adb9fb46fef77f/OpenFisca-Core-38.0.3.tar.gz BuildArch: noarch Requires: python3-PyYAML Requires: python3-dpath Requires: python3-importlib-metadata Requires: python3-nptyping Requires: python3-numexpr Requires: python3-numpy Requires: python3-psutil Requires: python3-pytest Requires: python3-sortedcontainers Requires: python3-typing-extensions Requires: python3-build Requires: python3-coveralls Requires: python3-twine Requires: python3-wheel Requires: python3-autopep8 Requires: python3-coverage Requires: python3-darglint Requires: python3-flake8 Requires: python3-flake8-bugbear Requires: python3-flake8-docstrings Requires: python3-flake8-print Requires: python3-flake8-rst-docstrings Requires: python3-idna Requires: python3-isort Requires: python3-mypy Requires: python3-openapi-spec-validator Requires: python3-pycodestyle Requires: python3-pylint Requires: python3-xdoctest Requires: python3-markupsafe Requires: python3-flask Requires: python3-flask-cors Requires: python3-gunicorn Requires: python3-werkzeug Requires: python3-openfisca-tracker Requires: python3-markupsafe Requires: python3-flask Requires: python3-flask-cors Requires: python3-gunicorn Requires: python3-werkzeug %description # OpenFisca Core [![PyPi Downloads](https://img.shields.io/pypi/dm/openfisca-core?label=pypi%2Fdownloads&style=for-the-badge)](https://pepy.tech/project/openfisca-core) [![PyPi Version](https://img.shields.io/pypi/v/openfisca-core.svg?label=pypi%2Fversion&style=for-the-badge)](https://pypi.python.org/pypi/openfisca-core) [![Conda Downloads](https://img.shields.io/conda/dn/conda-forge/openfisca-core?label=conda%2Fdownloads&style=for-the-badge)](https://anaconda.org/conda-forge/openfisca-core) [![Conda Version](https://img.shields.io/conda/vn/conda-forge/openfisca-core.svg?label=conda%2Fversion&style=for-the-badge)](https://anaconda.org/conda-forge/openfisca-core) [![Python](https://img.shields.io/pypi/pyversions/openfisca-core.svg?label=python&style=for-the-badge)](https://pypi.python.org/pypi/openfisca-core) [![Coveralls](https://img.shields.io/coveralls/github/openfisca/openfisca-core/master.svg?label=code%20coverage&style=for-the-badge)](https://coveralls.io/github/openfisca/openfisca-core?branch=master) [![Contributors](https://img.shields.io/github/contributors/openfisca/openfisca-core.svg?style=for-the-badge)](https://github.com/openfisca/openfisca-core/graphs/contributors) [![Newsletter](https://img.shields.io/badge/newsletter-subscribe!-informational.svg?style=for-the-badge)](mailto:contact%40openfisca.org?subject=Subscribe%20to%20your%20newsletter%20%7C%20S'inscrire%20%C3%A0%20votre%20newsletter&body=%5BEnglish%20version%20below%5D%0A%0ABonjour%2C%0A%0AVotre%C2%A0pr%C3%A9sence%C2%A0ici%C2%A0nous%C2%A0ravit%C2%A0!%20%F0%9F%98%83%0A%0AEnvoyez-nous%20cet%20email%20pour%20que%20l'on%20puisse%20vous%20inscrire%20%C3%A0%20la%20newsletter.%20%0A%0AAh%C2%A0!%20Et%20si%20vous%20pouviez%20remplir%20ce%20petit%20questionnaire%2C%20%C3%A7a%20serait%20encore%20mieux%C2%A0!%0Ahttps%3A%2F%2Fgoo.gl%2Fforms%2F45M0VR1TYKD1RGzX2%0A%0AAmiti%C3%A9%2C%0AL%E2%80%99%C3%A9quipe%20OpenFisca%0A%0A%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%20ENGLISH%20VERSION%20%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%0A%0AHi%2C%20%0A%0AWe're%20glad%20to%20see%20you%20here!%20%F0%9F%98%83%0A%0APlease%20send%20us%20this%20email%2C%20so%20we%20can%20subscribe%20you%20to%20the%20newsletter.%0A%0AAlso%2C%20if%20you%20can%20fill%20out%20this%20short%20survey%2C%20even%20better!%0Ahttps%3A%2F%2Fgoo.gl%2Fforms%2FsOg8K1abhhm441LG2%0A%0ACheers%2C%0AThe%20OpenFisca%20Team) [![Twitter](https://img.shields.io/badge/twitter-follow%20us!-9cf.svg?style=for-the-badge)](https://twitter.com/intent/follow?screen_name=openfisca) [![Slack](https://img.shields.io/badge/slack-join%20us!-blueviolet.svg?style=for-the-badge)](mailto:contact%40openfisca.org?subject=Join%20you%20on%20Slack%20%7C%20Nous%20rejoindre%20sur%20Slack&body=%5BEnglish%20version%20below%5D%0A%0ABonjour%2C%0A%0AVotre%C2%A0pr%C3%A9sence%C2%A0ici%C2%A0nous%C2%A0ravit%C2%A0!%20%F0%9F%98%83%0A%0ARacontez-nous%20un%20peu%20de%20vous%2C%20et%20du%20pourquoi%20de%20votre%20int%C3%A9r%C3%AAt%20de%20rejoindre%20la%20communaut%C3%A9%20OpenFisca%20sur%20Slack.%0A%0AAh%C2%A0!%20Et%20si%20vous%20pouviez%20remplir%20ce%20petit%20questionnaire%2C%20%C3%A7a%20serait%20encore%20mieux%C2%A0!%0Ahttps%3A%2F%2Fgoo.gl%2Fforms%2F45M0VR1TYKD1RGzX2%0A%0AN%E2%80%99oubliez%20pas%20de%20nous%20envoyer%20cet%20email%C2%A0!%20Sinon%2C%20on%20ne%20pourra%20pas%20vous%20contacter%20ni%20vous%20inviter%20sur%20Slack.%0A%0AAmiti%C3%A9%2C%0AL%E2%80%99%C3%A9quipe%20OpenFisca%0A%0A%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%20ENGLISH%20VERSION%20%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%0A%0AHi%2C%20%0A%0AWe're%20glad%20to%20see%20you%20here!%20%F0%9F%98%83%0A%0APlease%20tell%20us%20a%20bit%20about%20you%20and%20why%20you%20want%20to%20join%20the%20OpenFisca%20community%20on%20Slack.%0A%0AAlso%2C%20if%20you%20can%20fill%20out%20this%20short%20survey%2C%20even%20better!%0Ahttps%3A%2F%2Fgoo.gl%2Fforms%2FsOg8K1abhhm441LG2.%0A%0ADon't%20forget%20to%20send%20us%20this%20email!%20Otherwise%20we%20won't%20be%20able%20to%20contact%20you%20back%2C%20nor%20invite%20you%20on%20Slack.%0A%0ACheers%2C%0AThe%20OpenFisca%20Team) [OpenFisca](https://openfisca.org/doc/) is a versatile microsimulation free software. Check the [online documentation](https://openfisca.org/doc/) for more details. This package contains the core features of OpenFisca, which are meant to be used by country packages such as [OpenFisca-France](https://github.com/openfisca/openfisca-france). Bootstrapping your own country package should not take more than 5 minutes: check our [country package template](https://github.com/openfisca/country-template). ## Environment OpenFisca runs on Python 3.7. More recent versions should work but are not tested. 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](https://github.com/openfisca/openfisca-france/blob/100.0.0/setup.py#L60). If you want to contribute to OpenFisca-Core itself, welcome! To install it locally you can use one of these two options: * [conda](https://docs.conda.io/en/latest/) package manager that we recommend for Windows operating system users, * or standard Python [pip](https://packaging.python.org/en/latest/key_projects/#pip) package manager. ### Installing `openfisca-core` with `pip` This installation requires [Python](https://www.python.org/downloads/) 3.7+ and [GIT](https://git-scm.com) installations. To install `openfisca-core` locally in development mode run the following commands in a shell terminal: ```bash git clone https://github.com/openfisca/openfisca-core.git cd openfisca-core python3 -m venv .venv source .venv/bin/activate make install-deps install-edit ``` ### Installing `openfisca-core` with `conda` Since `openfisca-core` version [35.7.7](https://anaconda.org/conda-forge/openfisca-core), you could use `conda` to install OpenFisca-Core. Conda is the easiest way to use OpenFisca under Windows as by installing Anaconda you will get: - Python - The package manager [Anaconda.org](https://docs.anaconda.com/anacondaorg/user-guide/) - A virtual environment manager : [conda](https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html) - A GUI [Anaconda Navigator](https://docs.anaconda.com/anaconda/navigator/index.html) if you choose to install the full [Anaconda](https://www.anaconda.com/products/individual) If you are familiar with the command line you could use [Miniconda](https://docs.conda.io/projects/conda/en/latest/user-guide/install/windows.html), which needs very much less disk space than Anaconda. After installing conda, run these commands in an `Anaconda Powershell Prompt`: - `conda create --name openfisca python=3.7` to create an `openfisca` environment. - `conda activate openfisca` to use your new environment. Then, choose one of the following options according to your use case: - `conda install -c conda-forge openfisca-core` for default dependencies, - or `conda install -c conda-forge openfisca-core-api` if you want the Web API part, - or `conda install -c conda-forge -c openfisca openfisca-core-dev` if you want all the dependencies needed to contribute to the project. For information on how we publish to conda-forge, see [openfisca-core-feedstock](https://github.com/openfisca/openfisca-core-feedstock/blob/master/recipe/README.md). ## Testing Install the test dependencies: ``` make install-deps install-edit install-test ``` > For integration testing purposes, `openfisca-core` relies on > [country-template](https://github.com/openfisca/country-template.git) and > [extension-template](https://github.com/openfisca/extension-template.git). > Because these packages rely at the same time on `openfisca-core`, they need > to be installed separately. To run the entire test suite: ```sh make test ``` To run all the tests defined on a test file: ```sh pytest tests/core/test_parameters.py ``` To run a single test: ```sh 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: ```sh make check-types ``` ## Style This repository adheres to a [certain coding style](STYLEGUIDE.md), 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: ```sh make check-style ``` To automatically style-format your code changes: ```sh make format-style ``` To automatically style-format your code changes each time you commit: ```sh touch .git/hooks/pre-commit chmod +x .git/hooks/pre-commit tee -a .git/hooks/pre-commit << END #!/bin/sh # # Automatically format your code before committing. exec make format-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](CONTRIBUTING.md) for some general tips on how to document your contributions, and at our official documentation's [repository](https://github.com/openfisca/openfisca-doc/blob/master/README.md) 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: ```sh openfisca serve --country-package openfisca_country_template --port 2000 ``` To read more about the `openfisca serve` command, check out its [documentation](https://openfisca.org/doc/openfisca-python-api/openfisca_serve.html). By default, the Web API uses 3 workers to avoid [this issue](http://stackoverflow.com/questions/11150343/slow-requests-on-local-flask-server). 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: ```sh curl http://localhost:2000/parameters ``` For more information about endpoints and input formatting, see the [official documentation](https://openfisca.org/doc/openfisca-web-api). ### Tracker The OpenFisca Web API comes with an [optional tracker](https://github.com/openfisca/tracker) which allows you to measure the usage of the API. #### Tracker installation The tracker is not installed by default. To install it, run: ```sh pip install openfisca_core[tracker] --use-deprecated=legacy-resolver # Or `pip install --editable ".[tracker]"` for an editable installation ``` #### Tracker configuration The tracker is activated when these two options are set: * `--tracker-url`: An URL ending with `piwik.php`. It defines the Piwik instance that will receive the tracking information. To use the main OpenFisca Piwik instance, use `https://stats.data.gouv.fr/piwik.php`. * `--tracker-idsite`: An integer. It defines the identifier of the tracked site on your Piwik instance. To use the main OpenFisca piwik instance, use `4`. * `--tracker-token`: A string. It defines the Piwik API Authentification token to differentiate API calls based on the user IP. Otherwise, all API calls will seem to come from your server. The Piwik API Authentification token can be found in your Piwik interface when you are logged in. For instance, to run the Web API with the mock country package `openfisca_country_template` and the tracker activated, run: ```sh openfisca serve --country-package openfisca_country_template --port 5000 --tracker-url https://stats.data.gouv.fr/piwik.php --tracker-idsite 4 --tracker-token $TRACKER_TOKEN ``` %package -n python3-OpenFisca-Core Summary: A versatile microsimulation free software Provides: python-OpenFisca-Core BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-pip %description -n python3-OpenFisca-Core # OpenFisca Core [![PyPi Downloads](https://img.shields.io/pypi/dm/openfisca-core?label=pypi%2Fdownloads&style=for-the-badge)](https://pepy.tech/project/openfisca-core) [![PyPi Version](https://img.shields.io/pypi/v/openfisca-core.svg?label=pypi%2Fversion&style=for-the-badge)](https://pypi.python.org/pypi/openfisca-core) [![Conda Downloads](https://img.shields.io/conda/dn/conda-forge/openfisca-core?label=conda%2Fdownloads&style=for-the-badge)](https://anaconda.org/conda-forge/openfisca-core) [![Conda Version](https://img.shields.io/conda/vn/conda-forge/openfisca-core.svg?label=conda%2Fversion&style=for-the-badge)](https://anaconda.org/conda-forge/openfisca-core) [![Python](https://img.shields.io/pypi/pyversions/openfisca-core.svg?label=python&style=for-the-badge)](https://pypi.python.org/pypi/openfisca-core) [![Coveralls](https://img.shields.io/coveralls/github/openfisca/openfisca-core/master.svg?label=code%20coverage&style=for-the-badge)](https://coveralls.io/github/openfisca/openfisca-core?branch=master) [![Contributors](https://img.shields.io/github/contributors/openfisca/openfisca-core.svg?style=for-the-badge)](https://github.com/openfisca/openfisca-core/graphs/contributors) [![Newsletter](https://img.shields.io/badge/newsletter-subscribe!-informational.svg?style=for-the-badge)](mailto:contact%40openfisca.org?subject=Subscribe%20to%20your%20newsletter%20%7C%20S'inscrire%20%C3%A0%20votre%20newsletter&body=%5BEnglish%20version%20below%5D%0A%0ABonjour%2C%0A%0AVotre%C2%A0pr%C3%A9sence%C2%A0ici%C2%A0nous%C2%A0ravit%C2%A0!%20%F0%9F%98%83%0A%0AEnvoyez-nous%20cet%20email%20pour%20que%20l'on%20puisse%20vous%20inscrire%20%C3%A0%20la%20newsletter.%20%0A%0AAh%C2%A0!%20Et%20si%20vous%20pouviez%20remplir%20ce%20petit%20questionnaire%2C%20%C3%A7a%20serait%20encore%20mieux%C2%A0!%0Ahttps%3A%2F%2Fgoo.gl%2Fforms%2F45M0VR1TYKD1RGzX2%0A%0AAmiti%C3%A9%2C%0AL%E2%80%99%C3%A9quipe%20OpenFisca%0A%0A%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%20ENGLISH%20VERSION%20%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%0A%0AHi%2C%20%0A%0AWe're%20glad%20to%20see%20you%20here!%20%F0%9F%98%83%0A%0APlease%20send%20us%20this%20email%2C%20so%20we%20can%20subscribe%20you%20to%20the%20newsletter.%0A%0AAlso%2C%20if%20you%20can%20fill%20out%20this%20short%20survey%2C%20even%20better!%0Ahttps%3A%2F%2Fgoo.gl%2Fforms%2FsOg8K1abhhm441LG2%0A%0ACheers%2C%0AThe%20OpenFisca%20Team) [![Twitter](https://img.shields.io/badge/twitter-follow%20us!-9cf.svg?style=for-the-badge)](https://twitter.com/intent/follow?screen_name=openfisca) [![Slack](https://img.shields.io/badge/slack-join%20us!-blueviolet.svg?style=for-the-badge)](mailto:contact%40openfisca.org?subject=Join%20you%20on%20Slack%20%7C%20Nous%20rejoindre%20sur%20Slack&body=%5BEnglish%20version%20below%5D%0A%0ABonjour%2C%0A%0AVotre%C2%A0pr%C3%A9sence%C2%A0ici%C2%A0nous%C2%A0ravit%C2%A0!%20%F0%9F%98%83%0A%0ARacontez-nous%20un%20peu%20de%20vous%2C%20et%20du%20pourquoi%20de%20votre%20int%C3%A9r%C3%AAt%20de%20rejoindre%20la%20communaut%C3%A9%20OpenFisca%20sur%20Slack.%0A%0AAh%C2%A0!%20Et%20si%20vous%20pouviez%20remplir%20ce%20petit%20questionnaire%2C%20%C3%A7a%20serait%20encore%20mieux%C2%A0!%0Ahttps%3A%2F%2Fgoo.gl%2Fforms%2F45M0VR1TYKD1RGzX2%0A%0AN%E2%80%99oubliez%20pas%20de%20nous%20envoyer%20cet%20email%C2%A0!%20Sinon%2C%20on%20ne%20pourra%20pas%20vous%20contacter%20ni%20vous%20inviter%20sur%20Slack.%0A%0AAmiti%C3%A9%2C%0AL%E2%80%99%C3%A9quipe%20OpenFisca%0A%0A%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%20ENGLISH%20VERSION%20%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%0A%0AHi%2C%20%0A%0AWe're%20glad%20to%20see%20you%20here!%20%F0%9F%98%83%0A%0APlease%20tell%20us%20a%20bit%20about%20you%20and%20why%20you%20want%20to%20join%20the%20OpenFisca%20community%20on%20Slack.%0A%0AAlso%2C%20if%20you%20can%20fill%20out%20this%20short%20survey%2C%20even%20better!%0Ahttps%3A%2F%2Fgoo.gl%2Fforms%2FsOg8K1abhhm441LG2.%0A%0ADon't%20forget%20to%20send%20us%20this%20email!%20Otherwise%20we%20won't%20be%20able%20to%20contact%20you%20back%2C%20nor%20invite%20you%20on%20Slack.%0A%0ACheers%2C%0AThe%20OpenFisca%20Team) [OpenFisca](https://openfisca.org/doc/) is a versatile microsimulation free software. Check the [online documentation](https://openfisca.org/doc/) for more details. This package contains the core features of OpenFisca, which are meant to be used by country packages such as [OpenFisca-France](https://github.com/openfisca/openfisca-france). Bootstrapping your own country package should not take more than 5 minutes: check our [country package template](https://github.com/openfisca/country-template). ## Environment OpenFisca runs on Python 3.7. More recent versions should work but are not tested. 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](https://github.com/openfisca/openfisca-france/blob/100.0.0/setup.py#L60). If you want to contribute to OpenFisca-Core itself, welcome! To install it locally you can use one of these two options: * [conda](https://docs.conda.io/en/latest/) package manager that we recommend for Windows operating system users, * or standard Python [pip](https://packaging.python.org/en/latest/key_projects/#pip) package manager. ### Installing `openfisca-core` with `pip` This installation requires [Python](https://www.python.org/downloads/) 3.7+ and [GIT](https://git-scm.com) installations. To install `openfisca-core` locally in development mode run the following commands in a shell terminal: ```bash git clone https://github.com/openfisca/openfisca-core.git cd openfisca-core python3 -m venv .venv source .venv/bin/activate make install-deps install-edit ``` ### Installing `openfisca-core` with `conda` Since `openfisca-core` version [35.7.7](https://anaconda.org/conda-forge/openfisca-core), you could use `conda` to install OpenFisca-Core. Conda is the easiest way to use OpenFisca under Windows as by installing Anaconda you will get: - Python - The package manager [Anaconda.org](https://docs.anaconda.com/anacondaorg/user-guide/) - A virtual environment manager : [conda](https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html) - A GUI [Anaconda Navigator](https://docs.anaconda.com/anaconda/navigator/index.html) if you choose to install the full [Anaconda](https://www.anaconda.com/products/individual) If you are familiar with the command line you could use [Miniconda](https://docs.conda.io/projects/conda/en/latest/user-guide/install/windows.html), which needs very much less disk space than Anaconda. After installing conda, run these commands in an `Anaconda Powershell Prompt`: - `conda create --name openfisca python=3.7` to create an `openfisca` environment. - `conda activate openfisca` to use your new environment. Then, choose one of the following options according to your use case: - `conda install -c conda-forge openfisca-core` for default dependencies, - or `conda install -c conda-forge openfisca-core-api` if you want the Web API part, - or `conda install -c conda-forge -c openfisca openfisca-core-dev` if you want all the dependencies needed to contribute to the project. For information on how we publish to conda-forge, see [openfisca-core-feedstock](https://github.com/openfisca/openfisca-core-feedstock/blob/master/recipe/README.md). ## Testing Install the test dependencies: ``` make install-deps install-edit install-test ``` > For integration testing purposes, `openfisca-core` relies on > [country-template](https://github.com/openfisca/country-template.git) and > [extension-template](https://github.com/openfisca/extension-template.git). > Because these packages rely at the same time on `openfisca-core`, they need > to be installed separately. To run the entire test suite: ```sh make test ``` To run all the tests defined on a test file: ```sh pytest tests/core/test_parameters.py ``` To run a single test: ```sh 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: ```sh make check-types ``` ## Style This repository adheres to a [certain coding style](STYLEGUIDE.md), 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: ```sh make check-style ``` To automatically style-format your code changes: ```sh make format-style ``` To automatically style-format your code changes each time you commit: ```sh touch .git/hooks/pre-commit chmod +x .git/hooks/pre-commit tee -a .git/hooks/pre-commit << END #!/bin/sh # # Automatically format your code before committing. exec make format-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](CONTRIBUTING.md) for some general tips on how to document your contributions, and at our official documentation's [repository](https://github.com/openfisca/openfisca-doc/blob/master/README.md) 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: ```sh openfisca serve --country-package openfisca_country_template --port 2000 ``` To read more about the `openfisca serve` command, check out its [documentation](https://openfisca.org/doc/openfisca-python-api/openfisca_serve.html). By default, the Web API uses 3 workers to avoid [this issue](http://stackoverflow.com/questions/11150343/slow-requests-on-local-flask-server). 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: ```sh curl http://localhost:2000/parameters ``` For more information about endpoints and input formatting, see the [official documentation](https://openfisca.org/doc/openfisca-web-api). ### Tracker The OpenFisca Web API comes with an [optional tracker](https://github.com/openfisca/tracker) which allows you to measure the usage of the API. #### Tracker installation The tracker is not installed by default. To install it, run: ```sh pip install openfisca_core[tracker] --use-deprecated=legacy-resolver # Or `pip install --editable ".[tracker]"` for an editable installation ``` #### Tracker configuration The tracker is activated when these two options are set: * `--tracker-url`: An URL ending with `piwik.php`. It defines the Piwik instance that will receive the tracking information. To use the main OpenFisca Piwik instance, use `https://stats.data.gouv.fr/piwik.php`. * `--tracker-idsite`: An integer. It defines the identifier of the tracked site on your Piwik instance. To use the main OpenFisca piwik instance, use `4`. * `--tracker-token`: A string. It defines the Piwik API Authentification token to differentiate API calls based on the user IP. Otherwise, all API calls will seem to come from your server. The Piwik API Authentification token can be found in your Piwik interface when you are logged in. For instance, to run the Web API with the mock country package `openfisca_country_template` and the tracker activated, run: ```sh openfisca serve --country-package openfisca_country_template --port 5000 --tracker-url https://stats.data.gouv.fr/piwik.php --tracker-idsite 4 --tracker-token $TRACKER_TOKEN ``` %package help Summary: Development documents and examples for OpenFisca-Core Provides: python3-OpenFisca-Core-doc %description help # OpenFisca Core [![PyPi Downloads](https://img.shields.io/pypi/dm/openfisca-core?label=pypi%2Fdownloads&style=for-the-badge)](https://pepy.tech/project/openfisca-core) [![PyPi Version](https://img.shields.io/pypi/v/openfisca-core.svg?label=pypi%2Fversion&style=for-the-badge)](https://pypi.python.org/pypi/openfisca-core) [![Conda Downloads](https://img.shields.io/conda/dn/conda-forge/openfisca-core?label=conda%2Fdownloads&style=for-the-badge)](https://anaconda.org/conda-forge/openfisca-core) [![Conda Version](https://img.shields.io/conda/vn/conda-forge/openfisca-core.svg?label=conda%2Fversion&style=for-the-badge)](https://anaconda.org/conda-forge/openfisca-core) [![Python](https://img.shields.io/pypi/pyversions/openfisca-core.svg?label=python&style=for-the-badge)](https://pypi.python.org/pypi/openfisca-core) [![Coveralls](https://img.shields.io/coveralls/github/openfisca/openfisca-core/master.svg?label=code%20coverage&style=for-the-badge)](https://coveralls.io/github/openfisca/openfisca-core?branch=master) [![Contributors](https://img.shields.io/github/contributors/openfisca/openfisca-core.svg?style=for-the-badge)](https://github.com/openfisca/openfisca-core/graphs/contributors) [![Newsletter](https://img.shields.io/badge/newsletter-subscribe!-informational.svg?style=for-the-badge)](mailto:contact%40openfisca.org?subject=Subscribe%20to%20your%20newsletter%20%7C%20S'inscrire%20%C3%A0%20votre%20newsletter&body=%5BEnglish%20version%20below%5D%0A%0ABonjour%2C%0A%0AVotre%C2%A0pr%C3%A9sence%C2%A0ici%C2%A0nous%C2%A0ravit%C2%A0!%20%F0%9F%98%83%0A%0AEnvoyez-nous%20cet%20email%20pour%20que%20l'on%20puisse%20vous%20inscrire%20%C3%A0%20la%20newsletter.%20%0A%0AAh%C2%A0!%20Et%20si%20vous%20pouviez%20remplir%20ce%20petit%20questionnaire%2C%20%C3%A7a%20serait%20encore%20mieux%C2%A0!%0Ahttps%3A%2F%2Fgoo.gl%2Fforms%2F45M0VR1TYKD1RGzX2%0A%0AAmiti%C3%A9%2C%0AL%E2%80%99%C3%A9quipe%20OpenFisca%0A%0A%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%20ENGLISH%20VERSION%20%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%0A%0AHi%2C%20%0A%0AWe're%20glad%20to%20see%20you%20here!%20%F0%9F%98%83%0A%0APlease%20send%20us%20this%20email%2C%20so%20we%20can%20subscribe%20you%20to%20the%20newsletter.%0A%0AAlso%2C%20if%20you%20can%20fill%20out%20this%20short%20survey%2C%20even%20better!%0Ahttps%3A%2F%2Fgoo.gl%2Fforms%2FsOg8K1abhhm441LG2%0A%0ACheers%2C%0AThe%20OpenFisca%20Team) [![Twitter](https://img.shields.io/badge/twitter-follow%20us!-9cf.svg?style=for-the-badge)](https://twitter.com/intent/follow?screen_name=openfisca) [![Slack](https://img.shields.io/badge/slack-join%20us!-blueviolet.svg?style=for-the-badge)](mailto:contact%40openfisca.org?subject=Join%20you%20on%20Slack%20%7C%20Nous%20rejoindre%20sur%20Slack&body=%5BEnglish%20version%20below%5D%0A%0ABonjour%2C%0A%0AVotre%C2%A0pr%C3%A9sence%C2%A0ici%C2%A0nous%C2%A0ravit%C2%A0!%20%F0%9F%98%83%0A%0ARacontez-nous%20un%20peu%20de%20vous%2C%20et%20du%20pourquoi%20de%20votre%20int%C3%A9r%C3%AAt%20de%20rejoindre%20la%20communaut%C3%A9%20OpenFisca%20sur%20Slack.%0A%0AAh%C2%A0!%20Et%20si%20vous%20pouviez%20remplir%20ce%20petit%20questionnaire%2C%20%C3%A7a%20serait%20encore%20mieux%C2%A0!%0Ahttps%3A%2F%2Fgoo.gl%2Fforms%2F45M0VR1TYKD1RGzX2%0A%0AN%E2%80%99oubliez%20pas%20de%20nous%20envoyer%20cet%20email%C2%A0!%20Sinon%2C%20on%20ne%20pourra%20pas%20vous%20contacter%20ni%20vous%20inviter%20sur%20Slack.%0A%0AAmiti%C3%A9%2C%0AL%E2%80%99%C3%A9quipe%20OpenFisca%0A%0A%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%20ENGLISH%20VERSION%20%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%3D%0A%0AHi%2C%20%0A%0AWe're%20glad%20to%20see%20you%20here!%20%F0%9F%98%83%0A%0APlease%20tell%20us%20a%20bit%20about%20you%20and%20why%20you%20want%20to%20join%20the%20OpenFisca%20community%20on%20Slack.%0A%0AAlso%2C%20if%20you%20can%20fill%20out%20this%20short%20survey%2C%20even%20better!%0Ahttps%3A%2F%2Fgoo.gl%2Fforms%2FsOg8K1abhhm441LG2.%0A%0ADon't%20forget%20to%20send%20us%20this%20email!%20Otherwise%20we%20won't%20be%20able%20to%20contact%20you%20back%2C%20nor%20invite%20you%20on%20Slack.%0A%0ACheers%2C%0AThe%20OpenFisca%20Team) [OpenFisca](https://openfisca.org/doc/) is a versatile microsimulation free software. Check the [online documentation](https://openfisca.org/doc/) for more details. This package contains the core features of OpenFisca, which are meant to be used by country packages such as [OpenFisca-France](https://github.com/openfisca/openfisca-france). Bootstrapping your own country package should not take more than 5 minutes: check our [country package template](https://github.com/openfisca/country-template). ## Environment OpenFisca runs on Python 3.7. More recent versions should work but are not tested. 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](https://github.com/openfisca/openfisca-france/blob/100.0.0/setup.py#L60). If you want to contribute to OpenFisca-Core itself, welcome! To install it locally you can use one of these two options: * [conda](https://docs.conda.io/en/latest/) package manager that we recommend for Windows operating system users, * or standard Python [pip](https://packaging.python.org/en/latest/key_projects/#pip) package manager. ### Installing `openfisca-core` with `pip` This installation requires [Python](https://www.python.org/downloads/) 3.7+ and [GIT](https://git-scm.com) installations. To install `openfisca-core` locally in development mode run the following commands in a shell terminal: ```bash git clone https://github.com/openfisca/openfisca-core.git cd openfisca-core python3 -m venv .venv source .venv/bin/activate make install-deps install-edit ``` ### Installing `openfisca-core` with `conda` Since `openfisca-core` version [35.7.7](https://anaconda.org/conda-forge/openfisca-core), you could use `conda` to install OpenFisca-Core. Conda is the easiest way to use OpenFisca under Windows as by installing Anaconda you will get: - Python - The package manager [Anaconda.org](https://docs.anaconda.com/anacondaorg/user-guide/) - A virtual environment manager : [conda](https://docs.conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html) - A GUI [Anaconda Navigator](https://docs.anaconda.com/anaconda/navigator/index.html) if you choose to install the full [Anaconda](https://www.anaconda.com/products/individual) If you are familiar with the command line you could use [Miniconda](https://docs.conda.io/projects/conda/en/latest/user-guide/install/windows.html), which needs very much less disk space than Anaconda. After installing conda, run these commands in an `Anaconda Powershell Prompt`: - `conda create --name openfisca python=3.7` to create an `openfisca` environment. - `conda activate openfisca` to use your new environment. Then, choose one of the following options according to your use case: - `conda install -c conda-forge openfisca-core` for default dependencies, - or `conda install -c conda-forge openfisca-core-api` if you want the Web API part, - or `conda install -c conda-forge -c openfisca openfisca-core-dev` if you want all the dependencies needed to contribute to the project. For information on how we publish to conda-forge, see [openfisca-core-feedstock](https://github.com/openfisca/openfisca-core-feedstock/blob/master/recipe/README.md). ## Testing Install the test dependencies: ``` make install-deps install-edit install-test ``` > For integration testing purposes, `openfisca-core` relies on > [country-template](https://github.com/openfisca/country-template.git) and > [extension-template](https://github.com/openfisca/extension-template.git). > Because these packages rely at the same time on `openfisca-core`, they need > to be installed separately. To run the entire test suite: ```sh make test ``` To run all the tests defined on a test file: ```sh pytest tests/core/test_parameters.py ``` To run a single test: ```sh 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: ```sh make check-types ``` ## Style This repository adheres to a [certain coding style](STYLEGUIDE.md), 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: ```sh make check-style ``` To automatically style-format your code changes: ```sh make format-style ``` To automatically style-format your code changes each time you commit: ```sh touch .git/hooks/pre-commit chmod +x .git/hooks/pre-commit tee -a .git/hooks/pre-commit << END #!/bin/sh # # Automatically format your code before committing. exec make format-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](CONTRIBUTING.md) for some general tips on how to document your contributions, and at our official documentation's [repository](https://github.com/openfisca/openfisca-doc/blob/master/README.md) 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: ```sh openfisca serve --country-package openfisca_country_template --port 2000 ``` To read more about the `openfisca serve` command, check out its [documentation](https://openfisca.org/doc/openfisca-python-api/openfisca_serve.html). By default, the Web API uses 3 workers to avoid [this issue](http://stackoverflow.com/questions/11150343/slow-requests-on-local-flask-server). 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: ```sh curl http://localhost:2000/parameters ``` For more information about endpoints and input formatting, see the [official documentation](https://openfisca.org/doc/openfisca-web-api). ### Tracker The OpenFisca Web API comes with an [optional tracker](https://github.com/openfisca/tracker) which allows you to measure the usage of the API. #### Tracker installation The tracker is not installed by default. To install it, run: ```sh pip install openfisca_core[tracker] --use-deprecated=legacy-resolver # Or `pip install --editable ".[tracker]"` for an editable installation ``` #### Tracker configuration The tracker is activated when these two options are set: * `--tracker-url`: An URL ending with `piwik.php`. It defines the Piwik instance that will receive the tracking information. To use the main OpenFisca Piwik instance, use `https://stats.data.gouv.fr/piwik.php`. * `--tracker-idsite`: An integer. It defines the identifier of the tracked site on your Piwik instance. To use the main OpenFisca piwik instance, use `4`. * `--tracker-token`: A string. It defines the Piwik API Authentification token to differentiate API calls based on the user IP. Otherwise, all API calls will seem to come from your server. The Piwik API Authentification token can be found in your Piwik interface when you are logged in. For instance, to run the Web API with the mock country package `openfisca_country_template` and the tracker activated, run: ```sh openfisca serve --country-package openfisca_country_template --port 5000 --tracker-url https://stats.data.gouv.fr/piwik.php --tracker-idsite 4 --tracker-token $TRACKER_TOKEN ``` %prep %autosetup -n OpenFisca-Core-38.0.3 %build %py3_build %install %py3_install install -d -m755 %{buildroot}/%{_pkgdocdir} if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi pushd %{buildroot} if [ -d usr/lib ]; then find usr/lib -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/lib64 ]; then find usr/lib64 -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/bin ]; then find usr/bin -type f -printf "/%h/%f\n" >> filelist.lst fi if [ -d usr/sbin ]; then find usr/sbin -type f -printf "/%h/%f\n" >> filelist.lst fi touch doclist.lst if [ -d usr/share/man ]; then find usr/share/man -type f -printf "/%h/%f.gz\n" >> doclist.lst fi popd mv %{buildroot}/filelist.lst . mv %{buildroot}/doclist.lst . %files -n python3-OpenFisca-Core -f filelist.lst %dir %{python3_sitelib}/* %files help -f doclist.lst %{_docdir}/* %changelog * Sun Apr 23 2023 Python_Bot - 38.0.3-1 - Package Spec generated