How to get python class references working in PyCharm plugin?

Hello,

I modified the IntelliBot plugin using IDEA community edition (did only minor changes). The plugin builds successfully and works as expected when running it in IDEA community edition.

I built the plugin via 'Prepare Plugin Module .. For Deployment' and installed it into PyCharm using the created zip file.

After restart I get the following error in Event Log:

NoClassDefFoundError: Could not initialize class com.jetbrains.python.psi.stubs.PyClassNameIndex

Dependencies in plugin.xml are the original ones:

<depends>com.intellij.modules.lang</depends>
<depends optional="true">
com.intellij.modules.python</depends>
<depends optional="true">
Pythonid</depends>
<depends optional="true">
PythonCore</depends>


What should I do to get the plugin working in PyCharm?

Thanks,
Zoltan

0
8 comments

Looks like you added the Python plugin classes as a library to your module. Instead, you need to add them to the classpath of your IntelliJ IDEA SDK.


0
Avatar
Permanently deleted user

Thanks, this was the case.

0
Avatar
Permanently deleted user

How do I add those things to my IntelliJ IDEA SDK? Where are they?

0

Yann Cebron Can you please explain this in terms used in the documentation? classpath is not mentioned on the documentation link you provided.

Finding information on how to get a plugin working with Python is quite frustrating as especially this step is not documented clearly anywhere. (if it is, it is very hard to find)

0

Benjamin Justice Above link mentions on how to setup the recommended way of using Gradle as project setup. Please see https://plugins.jetbrains.com/docs/intellij/pycharm.html for information on how to get started writing plugins for PyCharm.

0
Yann Cebron Thanks for replying.
After hours of trial and error I was able to guess the correct values required in gradle and in plugin.xml

The site you linked lacks an explanation of how to support Pycharm Professional and Pycharm community with a single plugin. (though it does cleanly describe that there are 2 python plugins and how they are called. I missed that page)
I managed to do so and plan to write an article with a github sample project, but the official documentation was really difficult to work with.
(I used the gradle sample github repo after failing with the in-IDE wizard for creating a new plugin)
0

If you have functionality specific to PyCharm Professional, see https://plugins.jetbrains.com/docs/intellij/plugin-compatibility.html

0

Please sign in to leave a comment.