Une application pour appliquer des transformations XML aux catalogues Geonetwork du MTECT.
Le parti-pris pour les étapes 2. et 3. est d'utiliser (actuellement simulé) un fichier binaire d'échange qui peut être téléchargé par l'usager à l'issue de l'étape et/ou appliqué par l'application à l'étape 3.
L'application Flask intègre :
Les variables d'environnement suivantes sont nécessaires :
export FLASK_APP=isomorphe.app
export FLASK_DEBUG=1
export FLASK_SECRET_KEY=s3cr3t
export REDIS_URL=redis://localhost:6379
Lancement du service Redis éphémère :
docker compose up
Installation des dépendances :
pip install -r requirements.txt
Lancement de l'application principale :
flask run
Lancement du worker RQ (traitement des jobs en asynchrone) :
rq worker --url $REDIS_URL
Lancer les services de test :
docker compose -f docker-compose.tests.yml up
Lancer les tests :
pytest
Sur MacOS, il peut être nécessaire d'utiliser la variable d'environnement suivante pour éviter un crash du worker RQ :
export OBJC_DISABLE_INITIALIZE_FORK_SAFETY=YES
Référence : https://github.com/rq/rq/issues/2058
Linting, formatting and import sorting are done automatically by Ruff launched by a pre-commit hook. So, before contributing to the repository, it is necessary to initialize the pre-commit hooks:
pre-commit install
Once this is done, code formatting and linting, as well as import sorting, will be automatically checked before each commit.
If you cannot use pre-commit, it is necessary to format, lint, and sort imports with Ruff before committing:
ruff check --fix .
ruff format .
WARNING: running
ruff
on the codebase will lint and format all of it, whereas usingpre-commit
will only be done on the staged files.