[Idle-dev] IDLE extension to integrate 3rd party checkers and analyzers

Saimadhav Heblikar saimadhavheblikar at gmail.com
Tue Jun 24 11:37:15 CEST 2014

Hi all,

1. Overall idea
   Two files Analyzer.py and configAnalyze.def to be added to Lib/idlelib.

   Analyzer.py will contain GUI components for
       a) Letting the user to install/uninstall 3rd party analyzers, via pip.
         There will be predefined templates for most commonly used analyzers
         like pyflakes, pylint, pep8 etc.
         If the user chooses to install their own, they should supply
the parameters
         for it - Name, pypi url/pip name, optional arguments to be passed on
         to the analyzer when it is run, command line name for that program/
         module name.
       b) There will be options for the user to reinstall/delete a analyser
          installed via IDLE
       c) If a analyzer is already installed, the user can skip reinstall by
         not mentioning the pypi url/pip name. We can perform checks to ensure
         that it is present,and prompt the user to enter a url/name if not.
       d) A list of currently installed checkers. Clicking it will bring up
          the above dialog with values filled in. The user can modify
          options in this dialog.

       a) Example:
       pip_name = pyflakes
       pypip url = https://pypi.python.org/pypi/pyflakes
       commandline_name = pyflakes
       commandline_parameters =
       enable_shell = 0
       enable_editor = 1
       add_file = 0 # should filename be prefixed in outputwindow output?
       regex = see below for explanation

2. Installation process

  This refers to the installation of the packages and not this extension.
  Once the details are ready, do

  What to do if pip not available?
      1. Try to install using ensurepip after asking user
      2. Tell the user we cant proceed without pip.

  Ensure completion of instalation by doing simple checks
  like either importing that module/ calling it via command line and ensuring
  that no "file not found" type of errors are raised.

3. Process of analyzing a python file

   Retrieve settings for the analyzer. Make menu additions in
   PyShellEditorWindow programmatically, to display all extensions which the
   user has selected to use.
   Once the user wants to run it, ensure file is saved.
   Extract all required information like current file, the interpreter(2/3),
   and other settings as required.
   Call the standard runner method from Analyze.py, which will use subprocess.
   It will return the result, which will be displayed in outputwindow.
   (RightClick -> GotoLine capability already present!)
   All analyzers will not format the results in the same way. So we use the
   regex value to format the result in the same way.
   At minimum, we could extract the linenumber component. Format it
   according to our format and append the remaining part of the result
   before sending it to outputwindow.

Using ensurepip means it will be 3.4+ feature, unless the target
system already has pip, or atleast easy_install.

Saimadhav Heblikar

More information about the IDLE-dev mailing list