- Notifications
You must be signed in to change notification settings - Fork3
mafda/python_best_practices
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
How can you make your code shine with isort, Black, Flake8 and Pylint?
In this repository, I would like to show some guidelines and best practice tipson how to write Python code.
We can use a simple deck of programs to get ourcodestylingdone. We can useisort for sorting the library imports (yes, imports have asuggested order), we can check the existence of undesired artifacts usingFlake8 andPylint, and we can keep the code within the same style usingBlack.
Those tools can be configured to bePEP8compliant.PEP8 — Python Enhancement Proposal, is a style guide thatprovides guidelines and best practices suggestions on how to write Python code.
- Importing sorting withisort
- Formatting withBlack
- Linting withFlake8
- Bug and quality checking withPylint
(base)$: git clone git@github.com:mafda/python_best_practices.git(base)$:cd python_best_practices- Create the conda environment
(base)$: conda env create -f environment.yml
- Activate the environment
(base)$: conda activate linear-regression
- And run
(linear-regression)$: sh pep8.sh
(base)$: conda env create -f environment-dev.yml(base)$: conda activate best-practices(best-practices)$:cd your-projectYou could useisort . orisort . --check-only
You could useblack --line-length 79 . orblack --line-length 79 --check .
You could useflake8 .
Fix errors:
You could usefind . -type f -name "*.py" | xargs pylint
made with 💙 bymafda
About
How to make your code shine with isort, Black, Flake8, and Pylint. Guidelines and best practice suggestions on how to write Python code.
Topics
Resources
Uh oh!
There was an error while loading.Please reload this page.



