I had been using KDevelop for Python programming since KDevelop started providing Python support, both in my spare time and professionally.
On August 2016 I switched to PyCharm because of a new job where I was imposed PyCharm and Ubuntu so that the whole development team would use the same tooling. After a couple of weeks, I switched to PyCharm at home as well.
After our short talk at Akademy 2017, I switched back to KDevelop at work (new job, complete tooling freedom again) to try to determine the things from PyCharm that I miss in KDevelop.
To be honest, most of them are small things, from a user point of view, but together they do make PyCharm feel like a significantly better IDE.
That said, the switch back to KDevelop has not been as painful as I thought it would be, and I actually plan to stick to KDevelop from now on. Its development being community-driven and its support for C++/Qt/QML are important features for me in the long run, and there are also some other minor features that I really appreciate, such as variable coloring.
I’ll be comparing a recent PyCharm version with KDevelop 5.0.4 running Kubuntu 17.04. I have 5.1 at home, but I’ve barely coded any Python at home lately.
Many, small things, in no specific order:
This is the feature I was most worried about, because I had never used Python virtual environments before I started using PyCharm, and they are definitely the way to go for any serious development.
When you create a project, PyCharm asks you to choose an environment, basically a Python executable, and it provides facilities to create a virtual environment where you have isolated dependencies installed using pip from a requirements.txt file.
Now, while PyCharm does things better here (actively asks you for a Python executable, allows you to create a virtual environment from the IDE, allows you to manage the packages installed on the virtual environment, and prompts automatically to install packages from your requirements.txt file that are not installed in your local virtual environment), it turns out KDevelop does allow you to select the Python executable to use, and import autocompletion does work for packages installed on a virtual environment provided that you configure the project to use the Python executable from that virtual environment.
So, while PyCharm makes things more user-friendly, KDevelop fully supports virtual environments as far as I can tell.
On PyCharm you can Ctrl+click on any element of the import lines to go to its declaration.
I find this really, really useful, specially for third-party dependencies with poor or no documentation, where reading the corresponding Python code is often the easiest way to find out how to use a method or class.
On KDevelop, it only seems to work outside imports. To find the source of elements in import lines, I have to manually find the corresponding file in the virtual environment. Doable, but not as straightforward.
On PyCharm, when you press Enter
while in a literal string, you get the
string to continue on the next line following language rules. For example,
if the break is entered between a
and b
:
print('ab') print('a' 'b') variable = 'ab' variable = 'a' \ 'b'
On KDevelop, you get:
print('ab') print('a b') variable = 'ab' variable = 'a b'
To me naming is very important, and I really love how IDEs make it easier to rename a given element everywhere it appers.
In PyCharm, if you select a source code element (e.g. a function name), you just need to press F6 to rename it. Even better: the same shortcut works for renaming files selected on the project file tree.
In KDevelop there is no default shortcut, you must right-click and select Rename. It does not seem possible to set a shortcut for it either, at least not from “Settings → Configure Keyboard Shortcuts”.
It is actually available, but it highlights very poorly (e.g. headers and lists are not highlighted). Same when using it on Kate.
This is something I could probably fix myself, I’ve worked with Kate syntax highlighting files in the past and I love regular expressions.
I believe this is a general issue of KDevelop for all languages: If I write a syntax error anywhere in a file, any new code on that file is not properly highlighted until the whole file is free of syntax errors again.
In PyCharm, syntax errors only affect the syntax highlighting of the affected line or context. I am not sure exactly what it affect and what it does not affect, but it really feels more localized.
Given asdf()
, deleting (
deletes )
.
Literal strings that are detected as regular expressions are actually syntax highlighted as such.
Session management in PyCharm is more user-friendly. For example, you can easily start a new session that replaces the current session, while in KDevelop you have to manually close the previous session, and stand both of them consuming memory until you do.
In PyCharm, there is a context menu entry on Python modules (module.py
)
and packages (package/__init__.py
) to convert one into the other. After
renaming, this is the refactoring I use the most.
It is trivial to do manually, though.
So, lets say I have a really big virtual environment (venv
folder) where
I have installed many libraries that my project no longer uses. So I want to
delete it and create a fresh one where I can run pip install -r
requirements.txt
to install my current dependencies only.
If I delete the venv
folder from KDevelop, KDevelop will freeze until
the deletion completes, which can take many seconds depending on the project.
PyCharm marks unused imports as such, which really helps code cleanup.
Of course, if you really care about code cleanup, you use PyLint instead, which reports that and much more stuff.