Python Best Practices
How can you make your code shine with isort, Black, and Flake8?
In this post, I would like to show some guidelines and best practice tips on how to write Python code.
We can use a simple deck of programs to get our code styling done. We can use isort for sorting the library imports (yes, imports have a suggested order), we can check the existence of undesired artifacts using Flake8, and we can keep the code within the same style using Black.
Those tools can be configured to be PEP8 compliant. PEP8 — Python Enhancement Proposal, is a style guide that provides guidelines and best practices suggestions on how to write Python code.
Python Tools
Project Setup
Clone this repository and follow the steps:
How does it works?
isort
You could use isort .
or isort . --check-only
Black
You could use black --line-length 79 .
or black --line-length 79 --check .
Flake8
You could use flake8 .
made with 💙 by mafda.