Search code examples
pythonpycharmcall-graph

How to access pycharm code inspectors internals


I am using Pycharm for writing my code and would like to access the internals of it's inspectors to pull out the static call graphs for my program (something that Pycharm is already doing in my understanding in order to perform autocompletion and declaration order verification).

Is there a way of doing it?

PS: to prevent suggestions, pycallgraph is a nice package, but doesn't work in my case due to the pecularities of the __main__ initialization in Pycharm.


Solution

  • PyCharm is written in Java, and there is no API for accessing its internal code representation from a Python program. If you really want to do this, you can build a plugin for PyCharm that will expose the information in the way that you'll be able to consume, but this is likely to be fairly difficult.

    Note that PyCharm Community Edition is open-source; you can find its code here.