Friday, February 19, 2016

My Python IDE Journey

Pick one.
This post is not intended as advertising but to illustrate my journey to my currently used Python IDE. I tried several ones in recent years due to educational and professional needs as well as to satisfy my curiosity.

First Stop

Everything starts with geditnano and vim, right? Not quite full IDEs but it's a start. You can at least write code and have some syntax highlighting available. Until today, a colleague of mine uses vim with tons of plugins featuring "go to definition", "find usages", "code completion", "project nav tree", etc. So, it's quite possible to work with simple editors and enhance them indefinitely.

As you can imagine, I was looking for something else which goes beyond the venerable terminal. So, I started looking for an alternative with the following properties (in its order of priority):
  • out-of-the-box experience
  • mouse usage where appropriate
  • fewer keystrokes and mouse clicks
  • faster search without manual indexing
  • configurable executions (run unittests, run scripts, etc.)
  • debugging with most important things on a glance
  • introspection

Second Stop

I made my second stop at Spyder. It is an open-source project providing almost all the basic needs described above. In general it feels like Eclipse but is much simpler, cleaner and more thought-out to my taste.

Spyder stands for Scientific PYthon Development EnviRonment and as expected is best suited for scientific tasks such as researching. So, it handles small and informal scripts quite well for performing data transformations, evaluation and plotting diagrams.

Spyder works reliably given you've installed all necessary third-party dependencies such as pyflakes and rope. An up-to-date list can be obtained from here. Furthermore, if you are inclined to use numpy and scipy to live up to Spyder's name, you also need compiling tools available (at least my machine does it with Ubuntu 14.04 installed). So, the out-of-the-box experience, somewhat impaired, is still way above most multi-purpose editors.

Further not required but nice-to-have features are available: an integrated profiler, static code analysis custom color/font schemes and an object inspector (aka "show me the doc string").

After a year or so working with Spyder, the journey resumed to satisfy also the following emerging requirements:

  • integration of version control (such as local history and svn+git)
  • better usability and more convenience
  • integrated bash

Third Stop

Another colleague of mine showed that JetBrains (the maker of ReSharper) open-sourced their community edition of PyCharm. So, since this was another requirement for me, I gave it a try and I fall in love with it instantly. The people at JetBrains just know how to do their craftsmanship. PyCharm is a beautiful IDE with literally tons of features. It can handle professional workloads with massive amounts of files, yet is usable and convenient.

It definitely brings you a solid out-of-the-box experience. Thus, if you don't care or don't want to bother with installing any third-party library just to get a decent IDE, PyCharm is your choice.

In fact, the first-mentioned colleague got so inspired by PyCharm that he went out to give every possible vim plugin a try to replicate PyCharm's productivity features. He has not given up yet, but his efforts brought him massive increase of productivity even though working on a regular terminal session.

This one also solved the missing SCM and local code history integration. Furthermore, its usability is beyond good and evil and anything I've seen so far. Using it makes me feel free and I have to admit not using it make me feel a lot slower. But don't forget about what I wrote about IDEs in general last time. Last but not least, if you ever need a terminal, it's right there at your fingertips running in the correct directory.

Fourth Stop

Quite recently, in an attempt of life-long learning I made a short trip to some interesting piece of technology: IPython notepad. It's not a traditional Python IDE but it can improve your productivity given the right workload.

Just think of it as an interactive Python session (where you can also execute blobs of Python code) which you be able to resume later. The notepad stores the Python source and its corresponding output (prints, tables, diagrams, ...) once executed. Thus you can examine the results later or re-execute the code if there's been some changes to the data.

This way, it makes it a perfect tool for scientific usage and because of its simplicity it's even more suitable than Spyder in my opinion. If you want to give it a try and see if it would complement your current workflows, have a look at this pandas cookbook for some wild number crunching experience.

See you next time around,
Sven

PS: After writing this post, I felt inclined to install a Spyder again to see where the project has come to. It turns out it is actively maintained and the folks of Spyder make great progress. Still, the installation procedure is still feels brittle and quite manual aka error-prone. So, I wish them good luck and hope we will see some serious competition in the Python IDE area.

No comments:

Post a Comment