Simulation package
Project description
LexImpact Socio-Fiscal Simu API
HTTP + WebSocket API for OpenFisca
Used by LexImpact Socio-Fiscal UI, a simulator of the French tax-benefit system.
Pré-requis
Poetry
curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/get-poetry.py | python
source $HOME/.poetry/env
Installation
poetry install
Usage
poetry run api
How to develop
Update package to last version
poetry update
Jupyter
First time, and after adding a librairy :
#!poetry run python -m ipykernel install --name leximpact-socio-fiscal-simu-etat-kernel --user
Installed kernelspec leximpact-socio-fiscal-simu-etat-kernel in /home/ben/.local/share/jupyter/kernels/leximpact-socio-fiscal-simu-etat-kernel
Launch jupyter
poetry run jupyter lab
Jupyter Plotly
Pour voir les graph Plotly
#!poetry run jupyter labextension install jupyterlab-plotly
/home/ben/.local/lib/python3.8/site-packages/jupyter_server/transutils.py:13: FutureWarning: The alias `_()` will be deprecated. Use `_i18n()` instead.
warnings.warn(warn_msg, FutureWarning)
Building jupyterlab assets (production, minimized)
Check style
poetry run pre-commit run --all-files
NBDev
# Run pre-commit before converting notebooks
poetry run pre-commit run --all-files
# Build lib from notebook
poetry run nbdev_build_lib
# Build docs from notebook
poetry run nbdev_build_docs
# Re-run pre-commit
poetry run pre-commit run --all-files
Install
pip install leximpact_socio_fisca_simu_etat
How to use
Fill me in please! Don't forget code examples:
from leximpact_socio_fisca_simu_etat.csg_simu import (
ReformeSocioFiscale,
compute_all_simulation,
)
reform = ReformeSocioFiscale(
base=2021,
amendement={
"prelevements_sociaux.contributions_sociales.csg.activite.imposable.taux": 0.068,
},
output_variables=["csg"],
quantile_nb=4,
quantile_compare_variables=["csg"],
)
resultat = compute_all_simulation(reform, annee_de_calcul="2021")
[leximpact_socio-fisca-simu-etat DEBUG @ 20:10:41] reform.amendement : None
[leximpact_socio-fisca-simu-etat DEBUG @ 20:10:41] No cache for 5078a86c7201f132a44472774283e4a774e85b9bd94c88c9e756d3cb2021, compute it.
[leximpact_socio-fisca-simu-etat DEBUG @ 20:10:45] OpenFisca a retourné des individus
[leximpact_socio-fisca-simu-etat DEBUG @ 20:10:45] reform.amendement : {'prelevements_sociaux.contributions_sociales.csg.activite.imposable.taux': 0.068}
[leximpact_socio-fisca-simu-etat DEBUG @ 20:10:45] No cache for 3580f21542881d1996a7b3a16a759d8318e58bdc44ac26ab6cfbf8662021, compute it.
[leximpact_socio-fisca-simu-etat DEBUG @ 20:10:49] OpenFisca a retourné des individus
[leximpact_socio-fisca-simu-etat DEBUG @ 20:10:49] Temps de traitement total pour la simulation 7.873102587996982 secondes
print(
f"Montant total de la csg : {resultat.result['amendement'].state_budget['csg']:,} €"
)
Montant total de la csg : -147,054,542,277.62744 €
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for leximpact_socio_fisca_simu_etat-0.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4618ad31ea968023e753cdb751d3f8a53effcd353695b73f4e89c4b34d35de7e |
|
MD5 | 02fe968e261ed753be1a61720ed9240b |
|
BLAKE2b-256 | f62bee0cfc1b0bd2833c973958ec6cd692766fb3434a2f57759bb5486029ea64 |
Close
Hashes for leximpact_socio_fisca_simu_etat-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 49137658db6438c9a81ab3d4230f850e07994f820f07aeb9a287c8ee496ede52 |
|
MD5 | 5d7390ddd5de0456b962172b3876f4fd |
|
BLAKE2b-256 | 18b894428dca3bbf71f7da2a5c78c9b6db8912a077f93ee8ff4b7dcdb7a30508 |