Garten Eden

#linux #programming #android #online #stuff

Pylint3 for Ubuntu/Linux Mint and Sublime Text

Being a static code analyzer, Pylintis a useful tool for me while coding Python scripts. Sadly, the pylint package in Ubuntu-based distributions (like Linux Mint) analyze only Python2 scripts; Python3 support currently can only be found in the vivid sources (15.04).

pylint for Python 3

Nevertheless, one can install the package pylint3 without difficulty, after having provided the new version of python3-astroid. Both are downloadable from the official Ubuntu sources (below architecture: all):

After installation, both pylint3 and pylint are usable globally and independently.

Pylint3 for Sublime Text 3

Fortunately, there is a plugin/package for my favorite editor Sublime Text 3 which integrates Pylint and displays its results graphically (e.g. when saving a python script).

Screenshot Pylint3 in Sublime Text 3

It is called Pylinter and can be installed easily via Sublime’s Package Control.
After that, one has to edit the Pylint path for it to use version 3. This can be done through Preferences → Package Settings → Pylinter → Settings – User. (Default would be overwritten on every package update.)
My Pylinter.sublime-settings:

	// Show different icons for errors, warnings, etc.
	"use_icons": true,

	// Automatically run Pylinter when saving a Python document
	"run_on_save": true,

	// Don't hide pylint messages when moving the cursor
	"message_stay": true,

	// my changes for python3 support
	"python_bin": "python3",
	"pylint_path": "/usr/lib/python3/dist-packages/pylint/"
(relevant for the path are only the last two lines.)


Your comment:

So far...

18 Mar, 2018 08:16 pm v…d says:
[not yet approved]


Wait a sec, loading...

Email (not published)

Homepage (optional)

Comment... (code tag allowed)