From 44270684fe37605734f3c1449fb046e866ea789d Mon Sep 17 00:00:00 2001 From: Julien Palard Date: Wed, 24 May 2023 10:39:59 +0200 Subject: [PATCH] =?UTF-8?q?Python=20avanc=C3=A9:=20Aboter=20des=20outils?= =?UTF-8?q?=20de=20qualit=C3=A9.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- python-avancé/5-packaging.md | 46 +++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/python-avancé/5-packaging.md b/python-avancé/5-packaging.md index 65ea92b..4a8ac21 100644 --- a/python-avancé/5-packaging.md +++ b/python-avancé/5-packaging.md @@ -50,3 +50,49 @@ python -m build pip install twine twine upload dist/* ``` + +## Bonnes habitudes + +> There are 2 hard problems in computer science: cache invalidation, +> naming things, and off-by-1 errors. + + +## Bonnes habitudes + +Pas plus de 7. + + +## Garder son API évolutive + +Utilisez correctement `/` et `*` dans les prototypes de fonction. + +Notes: + +help(sum) + + +## Les « linters » + +Il existe plusieurs outils pour « relire » votre code : +- flake8, +- pylint, +- mypy, +- black, +- bandit, +- isort, +- ruff, +- tox. + +Notes: Leur faire implémenter un `is_prime(x)` pour jouer avec. + + +## pdb + +``` +breakpoint() +``` + + +## PYTHONDEVMODE=y + +Et `./configure --with-pydebug`.