lpoaura / weatherlink2pg

script pour import des données via API
https://lpoaura.github.io/weatherlink2pg/
0 stars 0 forks source link

Factorisation du code #3

Closed lpofredc closed 3 months ago

lpofredc commented 4 months ago

La plupart des lignes de code des 3 scripts python sont communs et redondants. Il serait intéressant, maintenant que les fonctionnalités sont bien présentes, d'envisager de créer une appli en ligne de commande (weatherlink2db ?) avec 2 options:

@JohanRocheteau, tu peux utiliser click qui est une petite lib python qui permet facilement de créer des applis en ligne de commande.

JohanRocheteau commented 4 months ago

J'ai gardé que le fichier global. J'ai transformé ce fichier en fichier click (je n'ai pas supprimé l'autre encore).

lpofredc commented 4 months ago

@JohanRocheteau, je viens de créer une petite appli python avec click, si tu veux voir la structuration du projet: https://github.com/lpoaura/faune-france-global-sensitivity-rules-parser

JohanRocheteau commented 4 months ago

@lpofredc Merci j'ai modifié les dossiers en conséquence et j'ai divisé le script en deux avec click d'un coté et les définitions de l'autre comme toi.

lpofredc commented 3 months ago

Top, merci. J'ai apporté quelques modifications à la marge sur les scripts:

https://github.com/lpoaura/weatherlink2pg/blob/8e101a32733f97b3e2b632b79cdf520047fbe15c/src/weatherlink2pg/main.py#L40-L67

https://github.com/lpoaura/weatherlink2pg/blob/8e101a32733f97b3e2b632b79cdf520047fbe15c/pyproject.toml#L31

https://github.com/lpoaura/weatherlink2pg/blob/8e101a32733f97b3e2b632b79cdf520047fbe15c/pyproject.toml#L34-L35

https://github.com/lpoaura/weatherlink2pg/tree/main/docs

https://github.com/lpoaura/weatherlink2pg/tree/main/.github