5.3 KiB
PyCharm Plugin Development
Introduction to developing plugins for PyCharm.
PyCharm is an IntelliJ Platform-based product. Plugin projects for PyCharm can be developed using IntelliJ IDEA.
PyCharm Plugin Setup
Gradle Build Script
Define a dependency using pycharmCommunity()
or pycharmProfessional()
, see Versions link on top of this page for all available versions.
See for using a local installation.
A dependency on the matching bundled PythonCore
/Pythonid
plugin (see below) must be added using the bundledPlugin()
helper.
Minimum build.gradle.kts setup:
repositories {
mavenCentral()
intellijPlatform {
defaultRepositories()
}
}
dependencies {
intellijPlatform {
pycharmCommunity("<versionNumber>")
bundledPlugin("PythonCore")
}
}
The configuration of PyCharm plugin projects follows the methods described in Configuring Plugin Projects using a Product-Specific Attribute, and Configuring the plugin.xml File. The table below summarizes the attributes to set in the Gradle build script. Click on an entry in the table's Attribute column to go to the documentation about that attribute.
gradle-intellij-plugin Attribute |
Attribute Value |
---|---|
intellij.type |
PC for PyCharm Community EditionPY for PyCharm Professional Edition |
intellij.version |
Set to the targeted PC or PY version. |
intellij.plugins |
See . |
intellij.downloadSources |
false is required because no public source code is available. |
runIde.ideDir |
Not needed; the Development Instance will automatically match intellij.type . |
plugin.xml
The dependency on the PyCharm APIs must be declared in the plugin.xml file.
As described in Configuring the plugin.xml File, the <depends>
tag must declare com.intellij.modules.python
.
Python Plugins
Plugin | Plugin ID | API |
---|---|---|
Python Community Edition | PythonCore |
PyCharm Community Edition (PC ) |
Python | Pythonid |
PyCharm Professional Edition (PY ) |
Python Plugins 2024.2
{id="python242"}
When using functionality from Pythonid
, a dependency on both PythonCore
and Pythonid
is now required.
Sample Plugin
See the SDK code sample pycharm_basics
for an example configuration.
Note that this code sample must be imported into Gradle explicitly, as it is not included in the _gradleCompositeBuild
.
Available PyCharm APIs
Additional Articles and Resources
Open Source Plugins for PyCharm
When learning new development configurations, it is helpful to have some representative projects for reference:
- Flake8 Support Adds support for flake8's
# noqa
comments in PyCharm.