PyCharm 2016.2 Help

Using Python Skeletons

In this section:


Python skeletons are Python files that contain API definitions of existing libraries extended for the static analysis tools. These Python API definitions comprise a database, which is a collection of Python files called skeletons.

Static analysis tools already understand Python code, so it should be easy to start extracting API definitions from these Python skeleton files. Regular function and class definitions can be extended with additional docstrings and decorators, e.g. for providing types of function parameters and return values. Static analysis tools may use a subset of information contained in skeleton files needed for their operation.

Using Python files instead of a custom Python API definitions format also makes it easier for the users to populate the skeletons database. Declarative Python API definitions for static analysis tools cannot cover all dynamic tricks used in real APIs of libraries: some of them still require library-specific code analysis. Nevertheless, the skeletons database is sufficient for many libraries.

PyCharm Support of Python Skeletons

PyCharm installation contains directory helpers/python-skeletons. This directory is a snapshot of the Python skeletons repository. For the regular usage, the contents of this directory is sufficient.

However, if you are going to contribute your changes, it is NOT RECOMMENDED to modify the skeletons provided with PyCharm. The reason is that the directory helpers/python-skeletons gets updated with each new PyCharm installation.

Changing Python Skeletons

To change the Python skeletons, first clone the skeletons GitHub repository into your PyCharm config directory.

cd <config_directory> git clone

where the <config_directory>, depending on your platform, is:

  • OS X: ~/Library/Preferences/PyCharmXX
  • Linux: ~/.PyCharmXX/config
  • Windows: <User home>\.PyCharmXX\config

As a result, the directory python-skeletons is created. You can make your changes to the contents of this directory, and if necessary, send your pull requests to the Python skeletons repository on GitHub.

See Also

Last modified: 23 November 2016