PyCharm 2018.2 Help

Configuring Third-Party Tools

In PyCharm, you can specify third-party standalone applications and run them as External Tools. You can pass contextual information to these tools (like the currently selected file or your project source path), view the output within the IDE, configure the tool's launch as a step of your run/debug configuration, and more.

Tools defined in the External Tools dialog appear as commands in the Tools | External Tools menu and various context menus. Like most other actions, external tools can be assigned keyboard shortcuts for quick access.

Ways to call an external tool:

  • From the list of available tools in Tools | External Tools on the main menu

  • Via a keyboard shortcut assigned to the tool in Settings / Preferences | Keymap

  • As the Before launch step of a run/debug configuration

See the next chapter for an example of how to configure and use an external tool.

Example: Adding pylint as an external tool

pylint is a code analyzer tool that checks your code and detects any style, logic, and usage problems. It might be a great addition to the code validation features available with PyCharm.

To install pylint

  1. In the Settings/Preferences dialog (Ctrl+Alt+S) navigate to Project | Project Interpreter.

  2. Click the add a package button to install a new package.

  3. In the Available packages window, search for "pylint", then choose it in the list of packages, and click Install Package.

    pylint installation

    Wait until the package is installed and close the window.

Now that you have installed pylint on your system, you can configure its integration with Pycharm.

To configure pylint

  1. In the Settings/Preferences dialog (Ctrl+Alt+S) navigate to Tools | External Tools.

  2. Click the add an external tool button to add a new external tool.

  3. Add configuration options as shown below:

    Configure pylint as an external tool
    • Group – the name of the external tool group to show in the Tools | External Tools menu

    • Name – the external tool name

    • Description – an optional description

    • Program – the path to the pylint executable ($PyInterpreterDirectory$ is a directory where the Python interpreter of the current project is placed).

      $PyInterpreterDirectory$/pylint (Linux, macOS)

    • Argument – specifies what files and folders should be checked ( and test in this example) and sets the output format for pylint errors.

      --msg-template="$FileDir$\{path}:{line}:{column}:{C}:({symbol}){msg}" test
      --msg-template="$FileDir$/{path}:{line}:{column}:{C}:({symbol}){msg}" test

    • Working directory – project root directory

    • It is recommended to enable all options from the Advanced Options section and set up the Output filters to insert links to the files with errors into the pylint output, so you can quickly jump to an error or warning in your code.

  4. Click OK to save the changes. Complete adding an external tool by clicking Apply and OK in the External Tools window.

Now you can access this external tool from the Tools | External Tools.

pylint is shown in the External Tools menu

You can run pylint using this menu. However, you might also want to add it to the Run/Debug Configuration of your application.

To execute pylint right before your application run

  1. From the main menu, choose Run | Edit Configuration, then in the Edit Configurations dialog, click Run pylint before start in the Before launch section.

  2. Select Run External tool from the Add new configuration list and specify pylint. It will be added to the list of scripts to be executed before the application launch.

    Adding pylint to the Run/Debug configuration
  3. Click OK to save the changes

  4. Run the Run/Debug configuration (Shift+F10).

    Run the script

    You should expect to see the pylint tab in the Tools window with the following sample output:

    code validation with pylint

You can inspect the reported errors, click the corresponding links to navigate to the problematic code, and made the required changes.

Last modified: 21 November 2018

See Also