PyLint Integration

Index of All Documentation » Wing Pro Reference Manual »

Wing Pro and Wing Personal provide a simple integration with pylint, which is a third party tool that runs error and warning analyses on Python code.

To use the tool, you must install pylint separately first and verify that it works from the command line. Note that pylint has certain dependencies that may be missing from your system. See the pylint website for installation details.

Once this is done and pylint works on the command line, bring up the PyLint tool from the Tools menu. Right click on the tool and select Configure. This will open a configuration file in an editor in Wing. You can alter the following here:

  • command -- The command that invokes pylint
  • args -- Additional command line arguments to send to pylint (see the pylint documentation for details on those available)
  • timeout -- The maximum amount of time to wait for pylint to complete before aborting analysis.
  • autosave -- Set this to 1 to automatically save a file before starting pylint to analyze it or 2 to auto-save all open files before starting pylint to analyze any file. 0 disables any auto-saving.

The configuration file can contain environment variable references in the form $(ENV) or ${ENV}, including references to regular environment variables defined in Project Properties or special environment defined by Wing.6

Once you have edited the configuration file as desired, save and close it.

Per-project pylintrc files can also be specified. If a file .pylintrc exists in the same directory as a Wing project file, then this file name is passed to pylint using the --rcfile argument. See the pylint documentation for details on what this file can contain.

Next, bring up some Python source code in an editor in Wing and then right click on the PyLint tool and select Update. After some time (up to a minute for larger files), lists of errors, warnings, and informational messages will be placed into the tool. Click on the items to bring up the source code with the indicated line selected.

Note that you can disable messages on the command line to pylint, as configured using the args item in the configuration file. See the pylint documentation for details.

Processing multiple files

The context menu on the PyLint tool will include an item for running pylint on all the files in the current package, when the current file is in a package (a directory that contains a file In this case, the file name as well as the line number is shown in the Line column of the output.

Note that this option adds --output-format=parseable to the pylint command line so that the file names can be obtained. This may not work with all pylint versions.

Using VirtualEnv on Windows

On Windows, pylint installed into a virtualenv does not work because pylint.bat is invoking just python and that may find the wrong Python installation. To fix this, edit pylint.bat and change python to the full path of the virtualenv's Python. Another fix is to edit pylint instead and add the following lines at the top:

import os
dirname = os.path.dirname(__file__)
execfile(os.path.join(dirname, ''))


Thanks to Markus Meyer for providing the original implementation of this capability for Wing. The source code for this integration is available under open source license in scripts/ within your Wing installation.