Moving to KDevelop for my larger Python Projects
By EricMesa
- 5 minutes read - 949 wordsWhen I first started programming it was just at the prompt of my Tandy computer. Then it was in the QBasic text editor on the IBM computers at school. But when I started programming again with “real” languages, I ended up going with Emacs. Although I was first annoyed at the way commands like save were prefixed, it became my favorite editor. I think that was partially because of diving headfirst into the free software movement and partially because I didn’t like vi’s different modes and how annoying that made things if you didn’t realize you weren’t in the text entry mode. Eventually, I moved on to Kate because I love KDE (been running it as my main desktop for over 10 years now) and I loved the features it enabled. Also, since vi (or vim) is found EVERYWHERE while Emacs usually requires installation, I ended up switching to vi whenever I’m ssh’d into a computer. If you add plugins like powerline, it can be pretty awesome to use. Even on my desktop if I’m editing /etc/fstab I’m more likely to pull up vi than the weight of KDE (not that it takes up THAT much RAM).
However, today I was reading this blog post about Kate devs planning where to go in the future, particularly the last paragraph where they talk about figuring out their lane where they don’t step on KDevelop, but also don’t fall behind compared to VS Code or others. I started thinking about KDevelop again (it’d be years since I last looked at it - maybe in the KDE3 days). It looks like Python is now a first-class citizen on KDevelop (before it was very focused on C and C++). So, while KDevelop is probably overkill on many of my Python projects, it might be quite useful for my Extra Life Donation Tracker Program, which now involves a lot of files. A few things caught my eye like KDevelop’s intelligent code completion and the way it handles highlighting. It would also be great if it kept track of function names across files. I love that Kate will let me quickly enter names of functions within the same Python file, but it doesn’t seem to do it across files that are open. It’s integrated git functionality also piqued my curiosity.
Here’s the way I typically use Kate:
Kate’s multiple tabs and side-by-side windows are indispensable!
And this is what my programming virtual desktop 1 usually looks like:
My typical desktop setup. Although a slight lie because I usually have QT Designer fully expanded and switch back and forth with QGit.
So I installed KDevelop and its Python3 plugin. According to their site, it’s up to distros whether they separate PHP and Python support into their own packages, but if you get the Appimage it’s included. On Fedora,which I run, it PHP and Python were separate packages. After I loaded up KDevelop I was worried it was going to make me make a project first and then import things. That would suck, since I hadn’t started my coding within KDevelop. But when I hit open project it actually allowed me to pick a folder that defined a project. Then it created the .kdev4 file on its own. Now, THAT is pretty darned smart!
KDdevelop understanding that I’ve looking at a variable!
Now, I don’t 100% understand everything going on in that dialog, but it’s pretty awesome that it understands from context that textfolder is a variable and that it is in the “save” function.
Kdevelop understanding scope
Again, I think it’s pretty awesome here that it understands the scope of this variable - that it belongs to MyForm as well as knowing it’s publicly accessible and a variable. I’m not quite sure why, but KDevelop calls its color themes Schema. Here’s the Breeze Dark, which I like:
KDevelop with Breeze Dark Schema
And here’s a comparison with one (it’s called Solarized Dark) that looks a lot like VS Studio’s Cobalt theme (the one I always see people running at conferences)
KDevelop Solarized Dark vs KDE Dark Breeze
This does highlight one thing that’s a bummer when using schema. As far as I can tell, it’s applied PER FILE. Maybe there’s a way to apply it to the whole project, but I didn’t see it here. I did a quick edit to play around with the integrated git and I. LOVE. IT.
KDevelop’s built-in git integration showing the diff
First of all, I love that it shows the diff here, but I love even more that it shows it here:
KDevelop showing where the change is. (I had to fudge this because my screenshot didn’t save. So in this part I’m adding an extra space)
THAT IS SO COOL! Usually I don’t do TOO many changes per commit to make it saner to revert commits if I have to. But sometimes I lose track of what I’m committing and so this integration is so great! By the way, speaking of it, go back up a few screenshots to where I was comparing color schemas and notice that it knows I’m in the devel branch of my git repo!
I’m pretty much sold! This setup saves me a whole screen in terms of not needing the console to the side OR the Qgit! I could use the extra screen to have some documentation up without having to flip back and forth between windows. The built-in launch is also so cool in all the config parameters that can be given to it. I might do an updated post after I’ve used this for a while to develop, but as of right now I’m hyped to do some Python development!