Interview: Joachim Ansorg for next week’s PyCharm Plugins webinar
JetBrains IDEs have a lot that’s “integrated” into the “development environment.” At some times, it seems daunting: there’s an infinity of features, with useful new things to learn at every corner. At other times, though, there’s something missing, something unique to what you do or how you do it.
Fortunately the IntelliJ platform for IDEs has a powerful plugin model. In fact, most of PyCharm is done as plugins, either specific to PyCharm or reusable across all IntelliJ IDEs. Getting started can be daunting though, which is why we set up this webinar, to show writing a simple-but-useful PyCharm plugin.
Our presenter, Joachim Ansorg, does this professionally. To help set the stage for the webinar, we invited him to a brief interview. As a note, here is a longer interview, with video, done in November.
The previous interview goes into more detail, but briefly: tell us about your background, where you live, and how you’re employed?
I’m living in the south of Germany, near the border to Switzerland and France. My wife and I moved here 2.5 years ago. About two years ago, after 8 years as an employee in a small software company, I became self-employed and I’m still enjoying this :) Much of my business is around IntelliJ plugins.
I enjoy software development and most often use Java, Kotlin and Go nowadays. Sometimes a bit of Bash, Scala and tiny bits of C++. Some projects involve Python, but I’m usually reading Python code instead of writing it.
Do you enjoy writing IntelliJ plugins?
I really do! There’s always something new to learn, I’m feeling productive at the end of a day and most of all I’m building something useful and helpful for others.
How hard is it to write a quality, useful plugin?
That depends on the features you want to implement, on your Java/Kotlin skills and on your experience with the IntelliJ platform. Even a tiny plugin can be very useful! I hope that you’ll see this in the webinar.
In my experience the integration of a custom language is the most complex. This kind of plugin is useful, of course, but it’s harder to keep the quality up.
It’s a great help here to have a good test coverage. Luckily the IntelliJ platform comes with good support for this. Tests are run in a headless environment where almost all parts of the IDE are available. For example, you’re able to programmatically interact with an editor, call refactorings, validate parsing and a lot more.
My recommendation is to start small, always add tests for the features you’re working on and use CI to run your tests with all the major builds you’re supporting.
PyCharm plugins aren’t in Python, they’re in Java/Kotlin. How big of a barrier is that?
If you’ve not yet worked with Java or Kotlin before, then it’s probably difficult to get started. I’ve always profited from learning a new language, though. Knowing Java or Kotlin can be a great help sometimes. You’ll be able to use it to improve your personal Python development environment.
Both languages are not that difficult, the APIs of the IntelliJ SDK are probably more overwhelming at first.
What are some of the most interesting integration points?
Personally I like that most things are extensible and that there are only few restrictions. The IDE offers extension points to enable plugins to add new or to customize existing functionality.
Plugins can offer additional extension points to allow further customization by other plugins. For example, the Python support in IntelliJ is implemented as a plugin. This plugin offers some more, Python-only extension points.
The basics like inspections, quick fixes and code completion are very powerful. You can add a lot to the editor if you create a few of these extensions.
It’s possible to make a customized editor. For example, you could implement a graphical editor for your programming language, if you wanted to.
Tell us about some of the interesting customer projects you’ve done.
There’s the integration for kite.com. It integrates the Kite software, a smart and AI-powered tool for Python developers, into PyCharm and IntelliJ Ultimate. The plugin is not available in the repository but comes packaged with the Kite download.
Technically we had to dig deep into the IDE to offer better documentation rendering. For example, at one point we replaced the built-in quick-doc panel with our own in Python files. The panel override isn’t in place anymore but I really liked that this kind of change was possible in a plugin.
Personally I really liked to work on the Tezos plugin. Tezos is an interesting new blockchain. Here I was able to build a new plugin from scratch with good test coverage and a lot of best-practices. In the process I’ve also learned a lot of new things: about the blockchain, about Tezos bakeries, the unusual language Michelson and even a bit about OCaml. The plugin is open-source and available at https://www.plugin-dev.com/project/tezos-michelson/.
In the previous interview you mentioned the productivity gains possible from a highly-tailored plugin. Mind discussing this?
For me a plugin is a tool. A good tool helps you to get your work done. In my opinion a software tool should be out of your way, smart and a time-saver. That’s why I’m using IntelliJ. It helps me to get my tasks done more quickly and with less frustration overall.
If you’re doing something over and over again or if you’re slow at what you’re doing then a tool might help. Write a script or, if you want something more integrated, a plugin.
Custom file formats, custom programming languages or a yet unsupported technology stack might also be a good indicator that a plugin could support you. If there’s more than one developer, then this can easily add up to a larger amount of time.
Just imagine to save 10 minutes a day per developer in a team of 5 for a year. They will get more work done and will thank you that you care. At least I would :)
Let’s take Michelson as an example. It’s an awkward language, at least to an average person like me. In Michelson, there’s an instruction called
PAPPAIIR. The instruction
PAPPAAIIR is invalid, though. Can you spot the difference? :)
Now, let the Tezos plugin help you out! It’ll highlight the invalid instructions, it’ll show what
PAPPAIIR is doing and saves your time by automating the manual tasks like formatting, validating and executing a Michelson file.
It’s an investment at first to build that plugin, but I’m sure that it’ll pay in the long run.
Is it reasonable for companies to learn enough to maintain what you created for them?
That’s a good question.
Maintenance is easier than the implementation. Tasks like the release of an update for the newest version of the IDE should be possible for most. There’s a build script and a good description how to release a new version. A good set of tests helps to make sure that everything is working with the latest major release.
Updates to the IntelliJ SDK may break plugins which were made for previous versions. This doesn’t happen very often, but cases like this usually require some more knowledge of the platform. I can either teach one or more developers of this company about plugin development and maintenance or could fix it when necessary.
What will you be showing in the webinar?
I’ll show how to suppress PyCharm’s warnings when a #noqa marker is present. #noqa is a marker used by flake8 to suppress warnings and errors. If you use #noqa then you usually don’t want to add additional PyCharm’s custom marker to keep it quiet.
This is a fix for https://youtrack.jetbrains.com/issue/PY-8656, which is one of the most-voted-on issues PyCharm’s YouTrack. It’s not that hard to implement, hopefully very helpful for many and a time-saver, too.
The initial version of the plugin will be published after the webinar so that all users of PyCharm will be able to use it soon afterwards.