Developers commonly work on both Python 2 and 3 codebases, so it's desirable to configure the pylint
utility to
execute against a specific version of the language. Problematically, it relies on the system-wide Python interpreter
(for abstract syntax trees, etc.), so simply passing in a flag, like --use-version 3
, wouldn't suffice; the
solution is to write a thin wrapper script around pylint
which executes it with the proper interpreter.
You must have:
python2
in your$PATH
python3
in your$PATH
pylint
installed (viapip
, and not from your package manager) for Python 2pylint
installed (viapip3
, and not from your package manager) for Python 3
Just plop the pylint+
shell-script somewhere in your $PATH
, and give it executable permissions. CLI usage:
pylint+ 2|3 PYLINT_ARGS
For instance:
$ pylint+ 2 --version
No config file found, using default configuration
-c 1.4.0,
astroid 1.3.2, common 0.61.0
Python 2.7.6 (default, Mar 22 2014, 22:59:56)
[GCC 4.8.2]
$ pylint+ 3 --version
No config file found, using default configuration
-c 1.4.0,
astroid 1.3.2, common 0.63.0
Python 3.4.0 (default, Apr 11 2014, 13:05:11)
[GCC 4.8.2]