LexImpact Simu Etat

Pré-requis

Sur Ubuntu il faut installer python3.8-venv avant Poetry :

sudo apt-get install python3.8-venv

Poetry

curl -sSL https://raw.githubusercontent.com/python-poetry/poetry/master/install-poetry.py | python3 -

Ajouter la commande suivante dans le .bashrc :

export PATH="$HOME/.local/bin:$PATH"

Installation des dépendances

Minimal install

poetry install --no-dev

Dev install

poetry install

Full install with API dependencies:

poetry install --extras api

Spécifier la version de Python à Poetry

poetry env use /usr/bin/python3.9

La version de Python actuellement employée est indiquée à la section tool.poetry.dependencies du le fichier pyproject.toml à la racine de ce dépôt.

How to develop

Configure

Lien sécurisé vers l’ERFS-FPR

sudo mkdir -p /mnt/data-in /mnt/data-out
sudo chown $USER:$USER /mnt/data-*
sshfs ysabell:/data/private-data/input /mnt/data-in
sshfs ysabell:/data/private-data/output /mnt/data-out

Configurer les variables d’environnement

cp env.example .env

Update package to last version

poetry update

Jupyter

First time, and after adding a library:

!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

Check style

make precommit
# Build docs from notebookµ
#!poetry run nbdev_build_docs
!cd .. && make docs
poetry run nbdev_build_lib
#find ./notebooks/ -name '*.ipynb' -exec poetry run nbdev_build_lib --fname \{\} \;
Converted config.ipynb.
Converted contributing.ipynb.
Converted index.ipynb.
Converted logger.ipynb.
poetry run nbdev_build_docs
touch docs
converting: /media/data/dev/src/LEXIMPACT/leximpact-prepare-data/notebooks/logger.ipynb
converting: /media/data/dev/src/LEXIMPACT/leximpact-prepare-data/notebooks/index.ipynb
converting: /media/data/dev/src/LEXIMPACT/leximpact-prepare-data/notebooks/contributing.ipynb
converting: /media/data/dev/src/LEXIMPACT/leximpact-prepare-data/notebooks/config.ipynb

Publier les nouvelles versions vers PyPi et Conda

Préparer votre environnement

C’est géré par la CI, voir .gitlab-ci.yml

Il faut faire le bump de version manuellement avec la commande suivante:

make bump

Avec cette commande, on monte la version et lors du merge de cette branche sur master, la CI de master déclenchera automatiquement la publication d’un nouveau package Pypi

Test de charge de l’API web

Voir la documentation de test suivante : tests/load_testing/README.md.