-
Notifications
You must be signed in to change notification settings - Fork 0
Format
Code format does not influence it's execution. Actually, a file with well formatted code is usually bigger then one with bad formatted code. But readability counts a lot, so this can never be an excuse. And more then readability, in my opinion, a well formatted code pass the message that the team cares for the code they write.
The template enforces code format in three ways:
- black and isort: if there are lines too long or unsorted imports in Python files, for example, black and isort will indicate them.
-
EditorConfig: if there are files without ending with a new line or files with wrong indentation, for example, EditorConfig will indicate them. To run it, run
ec -verbose
. - Prospector: if there are lines too long, for example, Prospector will indicate them.
https://github.com/mateusoliveira43/python-project-template/blob/main/pyproject.toml#L51-L61
The command dev format --check
(an alias to black --check --diff . && isort --check --diff .
) will check the style of project's Python code.
To format the Python code with black and isort, run dev format
(an alias to black . && isort .
). I like to let the commands separate, so a developer can see what would be formatted and learns the style.