-
Notifications
You must be signed in to change notification settings - Fork 26
Code Formatting
The code formatting tool yapf provides reasonable defaults for code formatting and plenty of knobs to tweak formatting rules for your project. Using it will make your code look consistent, and avoid arguments about formatting in code reviews.
Using pylint to analyze your code and report irregularities is strongly encouraged.
Within a virtualenv or for python 2:
pip install pylintFor python 3 without virtualenv:
pip3 install pylintTo use:
pylint path/to/python/code/script.pyThe warnings can get irritating, so you'll want to learn how to disable some of them in code or in the pylint.rc file. Try searching the relevant github repo for "pylint: disable" to see which warnings are currently considered uninteresting. See https://pylint.readthedocs.io/en/latest/user_guide/message-control.html for more information.
The mypy tool is an experimental static type checker. It requires python 3.
pip3 install mypy-langTo use:
mypy path/to/python/code/script.py