Any code in Python and TensorFlow should adhere to the Project AGI Coding Principles, TensorFlow Style Guide, and any additional modifications outlined below.
- Maximum characters per line is 120 characters, instead of 80.
- Install the Pylint plugin using
pip install pylint
- Download the pylintrc file and place it in your home directory as
.pylintrc
- Read this section of the
documentation to understand how
pylint
files the correct rules configuration
- Read this section of the
documentation to understand how
- Verify
pylint
is using the correct rules configuration by runningpylint .
in any Python project
› pylint .
Using config file /Users/Abdel/.pylintrc
*************
F: 1, 0: error while code parsing: Unable to load file __init__.py:
[Errno 2] No such file or directory: '__init__.py' (parse-error)
Refer to the Editor and IDE integration section in the Pylint documentation for more information about other editors.
- Visual Studio Code: integrated by default, no need to install plugins.
- Sublime Text: Install the SublimeLinter-pylint after following the
instructions above to install
pylint
- PyCharm: No easy plugin available due to PyCharm's default linting. Follow these instructions from the Pylint documentation to integrate with pylint
We use the pre-commit
package alongside the config file .pre-commit-config.yaml
to enforce styling rules on newly committed code. The package should be installed automatically as a dependencing when you first install pagi
. You then need to run pre-commit install
to install the hooks in your local Git repository.
You can also use pylint
using the command-line, instead of integrating with your editor/IDE of choice.
# Run pylint on files in the all directories within the project
pylint **/*.py
# Run pylint on a specific Python module (must contain __init__.py)
pylint parent_module/child_module
# Optionally pass a custom rcfile
pylint --rcfile=/path/to/pylintrc **/*.py