Unable to build Pylint and Mypy plugins when compiling with PyCharm 2019.3.2 (2019.1.4 works fine)
Answered
I'm the developer of Pylint and Mypy plugins and if I update PyCharm from 2019.1.4 (Build #PC-191.8026.44, built on July 30, 2019) to 2019.3.2 (Build #PC-193.6015.41, built on January 21, 2020) I'm not able to build anymore the 2 plugins because I get these errors:
$ ./gradlew clean check
> Task :compileJava FAILED
/home/leinardi/Workspace/github/pylint-pycharm/src/main/java/com/leinardi/pycharm/pylint/util/FileTypes.java:20: error: cannot find symbol
import com.jetbrains.python.PythonFileType;
^
symbol: class PythonFileType
location: package com.jetbrains.python
/home/leinardi/Workspace/github/pylint-pycharm/src/main/java/com/leinardi/pycharm/pylint/util/PyPackageManagerUtil.java:23: error: package com.jetbrains.python.packaging does not exist
import com.jetbrains.python.packaging.PyPackageManagers;
^
/home/leinardi/Workspace/github/pylint-pycharm/src/main/java/com/leinardi/pycharm/pylint/plapi/PylintRunner.java:30: error: package com.jetbrains.python.packaging does not exist
import com.jetbrains.python.packaging.PyPackage;
^
/home/leinardi/Workspace/github/pylint-pycharm/src/main/java/com/leinardi/pycharm/pylint/plapi/PylintRunner.java:31: error: package com.jetbrains.python.packaging does not exist
import com.jetbrains.python.packaging.PyPackageManager;
^
/home/leinardi/Workspace/github/pylint-pycharm/src/main/java/com/leinardi/pycharm/pylint/plapi/PylintRunner.java:32: error: package com.jetbrains.python.sdk does not exist
import com.jetbrains.python.sdk.PySdkUtil;
^
/home/leinardi/Workspace/github/pylint-pycharm/src/main/java/com/leinardi/pycharm/pylint/plapi/PylintRunner.java:33: error: package com.jetbrains.python.sdk does not exist
import com.jetbrains.python.sdk.PythonEnvUtil;
^
6 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileJava'.
> Compilation failed with exit code 1; see the compiler error output for details.
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1s
2 actionable tasks: 1 executed, 1 up-to-date
If I downgrade PyCharm to 2019.1.4 everything builds again.
If instead of using PyCharm with alternativeIdePath I use plugins and specify PythonCore:2018.1.181.5087.50, it builds again but I can't run or debug my code on PyCharm because runIde will start IDEA.
Where can I find PythonFileType, PyPackageManagers, PyPackage, PySdkUtil and PythonEnvUtil when compiling with 2019.3.2?
Please sign in to leave a comment.
bump
Hello Leinardi!
Sorry for the delayed response.
PythonCore sources have been decoupled from the IDE - this is the reason that PythonFileType and others cannot be found.
However, if you'll build a plugin with pythonPlugin provided, everything will work as expected.
and in Gradle:
intellij {
...
alternativeIdePath pycharmPath
if (hasPythonPlugin) {
plugins += [pythonPlugin]
} else {
throw new StopActionException('Define pythonPlugin in your gradle.properties')
}
}
Hey thanks! That made it build again!
But now I see a warning when I build that I don't understand:
It is possible to reproduce the issue building the master branch of mypy plugin: https://github.com/leinardi/mypy-pycharm/tree/master
The plugin that you use as a dependency, which is targeted to 181.5087—181.* (* = SNAPSHOT), is not compatible with the IDE that you've set with pycharmPath.
So the plugin is not able to be run, but you've taken the required sources from it correctly.
Oh I see. Is there a better way for me to build my plugin? Or should I just ignore the warning?
In general, building your plugin with X version may cause some incompatibility issues in the following Y version because of the changed API/breaking changes.
Since you're depending on the plugin that has a numerous amount of builds, you probably should follow its convention to avoid runtime issues.