Choosing a Python IDE, Part Six: Editra

filed under python-ide

Unscheduled and unexpected, I've been recommended to check out Editra, a cross-platform text editor that's great for Python development, and writing code in general, so I thought I'd write about it here.

As a bonus, it's even written in Python!

Editra

As I said, Editra is written in Python. It's developed mainly by one guy, Cody Precord, since the project's creation in 2005. It is intended to be used as a text editor, but with a few plugins it easily functions as an entire IDE.

Getting Started

The setup process is smooth - as long as you have the prerequisites (wxpython, as far as I can see), everything goes great and you're up and running in a minute. I just downloaded the source and ran it, and everything worked out great.

Initial configuration of Editra is basically zero - you can start using it right away. That said, if you want to tailor it as more of an IDE, you'll need to set it up as one. If this is what you're after, then the article on the wiki for Settings Editra Up as an IDE is what you're after. I like minimalism, but a bit of help getting started would have been nice. New users might be put off by having to fiddle around a lot to get a more IDE like setup going.

I installed and enabled the following plugins;

  • Projects, for creating "projects". Pretty straight forward. Also provides version control integration.
  • PyStudio, for a more complete IDE. Provides syntax checking, module searching and debugging.
  • PyShell, for an integrated Python shell.

Perhaps the most exciting for me, was that I don't need Java! This editor belongs to a rare class of IDEs, that are not implemented using Java.

On the setup page of the website, it details a few sets of installation instructions, with the only Linux install instructions being for Arch Linux. Sadly, this also installs an ancient version of the editor.

UI / Navigation

I'll be honest, Editra is not very pretty. Don't get me wrong, it's written by a programmer, for programmers, so all bets are off, and that's fine. Some people are attracted to editors like Sublime Text 2 because of how pretty it is, so I suppose it's important to some people.

Under the Advanced section of Editra's preferences, there's a large list of menu options and their associated keyboard shortcuts, which can be customised. There are, as I would have hoped, plugins and whatnot for running external processes, so everything you need for basic usage is included. Sadly however, there is no "fast open", i.e. a keyboard driven way to open a file up by name in a directory or version control system, which takes away quite a bit.

Underneath the Tools menu there's a Style Editor, for making your own colour schemes. If you're willing to put in the work there's pretty much no limit to the colour schemes you can generate, which is nice.

Code Editing

Editing code in Editra is a pretty straight forward experience. You type, words appear. There are no real highlights, and no real downsides either. There's no Vim mode, only Vi mode - which, amongst other things, means that you don't have visual mode. There are a few other quirks as well that kept disrupting and confusing me, namely;

  • a to go into insert mode after the current cursor position randomly wraps to the next line if you're at the end of a line.
  • dd with line wrapping deletes the first segment of the wrapped line.
  • Trying to enter visual mode actually just performs a paste, sometimes.

When eventually lead to me turning Vi mode off entirely.

Code completion is there, but I'm afraid I couldn't get it to work properly. From what I could see, it's trying to be "smart", only referencing variables it knows about, i.e. globals. Modules, classes and even local variables aren't detected, which is a big let down for me.

Plugin Management

Plugin management in Editra is not too bad, and quite straight forward. Select a plugin, download it, enable it and restart. It's annoying to have to restart each time you enable / disable some plugins, however. More than likely you'll have to also enable it in the UI, typically under the View menu. This proves to get annoying after a while - downloading, enabling, restarting, and then enabling it again. I feel as though this is a major area for improvement in the editor - as a user, I'd like to just download it and have it there, ready to use.

Integration is another problem with Editra plugins. Between each plugin, the level of integration varies greatly. Some plugins are passive and require no setup, they just work. Others add a new section to the UI, which can only be enabled via the View menu, as I mentioned earlier. Other plugins, notably the debugging features from PyStudio, add a heap of oddly named submenu items to the View menu, underneath "Shelf". I'm sure the developer has his reasons, it just leaves me wondering "where will the next plugin be?" everytime I install one.

They're nearly all written by Editra's main author, which I found surprising as I'd have thought they'd be integrated completely in that case. I'm sure he has his reasons, though.

That said, the API for writing your own plugin looks solid. It hasn't been updated or modified in years, which says something about the stability of the API. The documentation looks good too - it is quite thorough about how you write your own plugin. With the list of plugins that are available, there's no shortage of examples on structuring a plugin and extending the editor.

Documentation

The built in help with Editra is, lacking at best. If you like knowing what's going on with plugin installation, or want to install a new plugin, or even how to use a plugin you just installed, you're basically stuck hunting through the UI for it or resorting to the online documentation. Don't be fooled by the age of a lot of pages - they haven't been updated because they're still relevant.

I found the plugins the most difficult to handle. Whenever I downloaded and installed a plugin, I wasn't sure how to use it afterwards - there were no popups at all to indicate what I should do. It's a bit frustrating to have your flow broken repeatedly to look for a plugin in the menus, but hey, what can you do. It would be nice if there were some indication that a plugin has been installed, or what you can do to use it. Even enabling it in the UI by default would be nice.

Version Control Integration

Version Control integration comes as a part of the PyStudio plugin, and it's okay if you don't need to do much. There's menu support for committing, adding/reverting/updating files, but no support for branching. There's a text area you can enter commands into for the commands the UI doesn't handle, which feels a bit like a copout to me.

Interestingly though there are some pretty cool features here - Instead of commiting changesets, you can instead generate patches from them, which is a nice feature to have. The UI for viewing a patch even supports folding, at the hunk level. Pretty cool.

Misc

There are a few of other things that don't really fit in else where, so I'll write a bit about them here briefly.

The bug tracker has a fair few bugs in it - too many for one person to handle part time, I think. Some of the bugs are pretty old too, going back to 2007 for an improved help system. Chances are if you have a bug, you'll probably have to fix it yourself unless it's a crippling bug.

I think this project suffers a lot from a lack of visibility in the developer community - it's so hard to find anythingabout it in the past year or two, which really strikes me as odd considering the age of the project.

The fact that it's written in Python makes me feel guilty for all of its shortcomings. If I want the feature, or if the bug bothers me so much, I should fix it myself. But I suppose that's every open source project.

Conclusion

So, what's to say about Editra? If you need a simple text editor that can be extended easily enough in Python, or an IDE you could eventually turn into your own, inside and out, then Editra is definitely worth looking at. Similar to Wingware, it feels very limited as a full fledged IDE, and for the same reason; I believe the editor has been crafted to the developer's requirements, and he's been good enough to publish it for others to use, which is great.

It's open source, and free, so you don't lose anything by trying it out. I personally will continue using Vim, but that's just me.

Related Posts