How Analysis Works

Index of All Documentation » Wing Pro Reference Manual » Source Code Analysis »


To analyze your source code, Wing uses the Python Executable and Python Path that you have specified in your Project Properties and any main entry point. This environment defines which modules are found by import statements and alters some aspects of type inference, according to Python version.

Note: In Wing 101, which which does not have projects, the Python environment is instead configured with Configure Python in the Edit menu.

Show Analysis Stats in the Source menu displays the Python environment that is being used for source code analysis.

Note that this environment is used to analyze all files in your project, even if some of them use Launch Configurations or File Properties to set up a different Python environment for themselves. This is usually OK, but in some cases it may be better to set up a separate project for each Python environment.

Wing's source code analysis process can be summarized as follows:

  • To resolve an import statement, Wing searches the Python Path and same directory for a matching importable module.
  • If the module is Python code, Wing runs static analysis on the code to extract information from it.
  • If the module is an extension module, Wing looks for a *.pi or *.pyi interface description file, as described later in this chapter.
  • If the module cannot be inspected, Wing tries to import it in a separate process space, in order to analyze its contents.
  • If a debug process is active, or when working in the Python Shell, Wing tries to read relevant type information from the live runtime state associated with the source code

The results of this analysis are cached on disk and recomputed only as necessary when the Python environment or code changes.