After working for over a year as the only tech guy in our little start-up company, we brought another developer on to help with some of the reporting tasks. In an effort to mitigate the damage a contracted hit-man could do to our collective efforts (the hit-by-a-bus metaphor is so passé), I have been trying make sure my new teammate is familiar with the development tools I have been using.
We are from two very different worlds. I have been comfortable doing all of my development in Vim, though I occasional use Qt Designer for complex form layout and Eric IDE for visual debugging. My teammate found the Vim plus shell toolset to have too steep a learning curve, so I started a quest to find an IDE that we could both use comfortably.
My first attempt was with Eric. It is a decent, open-source PyQt IDE. It is a snap to install on Ubuntu, but my teammate got frustrated installing the various dependencies for development on Windows. Though Eric is an adequate IDE for my purposes, it is very cluttered and has a confusing interface. Given how clumsy it can be to navigate, I didn’t feel good about pushing my team member to get it working. Eric does however have excellent integration with the Qt tools. I was a little nervous to move away from Eric until I realized that most of the magic is done by calling pyuic4 on the back-end.
Eclipse and PyDev
My next experiment was with Eclipse. I used Eclipse plus PyDev long ago, and found it adequate though I reverted back to Vim. When I gave it a fresh look, I was encouraged that PyDev was no longer half-proprietary and had lots of new features. Eclipse also has a lot of database plugins which might help my teammate visualize the structure of our embedded SQLite data store.
Installation on Linux was a single aptitude command, but it proved to be a complex IDE to set up. Learning how to install plugins wasn’t bad, but the selection was confusing. I’m still not sure which Qt plugins are necessary for PyQt development—I erred on the side of installing extra. Then I had to wrap my brain around perspectives, and configure them to be logical (Mylyn looks to address some of these problems, but it was yet another new paradigm that had to be grasped before I could get any work done). I also had to find a supported Mercurial plugin and figure out how to get my existing code into a project—a process which was not very intuitive. Riddle me this: Do you create a Mercurial Project or a PyDev project? Answer: Create a PyDev project and give it your existing Mercurial repo as the home directory, then right click on the folder in the project explorer, go to “Team”, and select “Share Project”. At that point you can tell it that you are using Mercurial. After all this work, I still felt like it was a clunky IDE with no good Vi keybindings (though the reasonably priced proprietary viPlugin might have solved that one). My other big gripe is that when stepping through my Python application, the integrated Python shell does not see the current debugging stack—a feature of Eric that I found to be extremely valuable. My teammate spent a little bit of time trying to install Eclipse and found it to have more dependencies than Eric.
At the end of the day, I think I like Eclipse but I don’t think it will work for my current project. It compares favorably with Visual Studio (which is also a bear to setup for an existing project, especially with a heterogeneous tool set), but it will take a lot of effort to get my team productive in it. Though I expect it would eventually prove adequate, I decided to explore alternatives before settling.
NetBeans Plus nbPython
At some point last month I came across a blog posting about the NetBeans Python plugin. It looked like it might meet our needs, so I decided to give it a shot. I think it is the most complete solution I have come across so far, though it currently has some annoying bugs.
My first impression is that NetBeans is ugly. I mean the kind of ugly that gets
kids sent home from school. Yeah, it is Java Swing ugly. Swing’s default look
and feel (Metal) payed more homage to Motif than to the competing toolkits of
1995. Metal is so ugly that it single-handedly prevented developers from
adopting Java on the desktop (that and the fact that early expectations for Java
far exceeded reality, oh and Microsoft’s abusive tactics). But enough ranting,
because Sun finally sort of fixed it. To get NetBeans to use the not-so-ugly
Nimbus look and feel, simply copy “/etc/netbeans.conf” into your local .netbeans
folder, and add
--laf Nimbus to the
- NetBeans is pretty usable by default. It is much quicker to get started with than Eclipse.
- NetBeans appears customizable enough for my needs. It is much more configurable than it at first appears.
- The options dialog is very poorly organized and hard to use.
- My Dansguardian setup was blocking the automatic download and installation of updates
and some plugins, so I had to add
- I turned off the additional update check in the plugins dialog; it was annoying me.
- There are some decent dark themes, but it doesn’t look like it because the option window doesn’t change the background color.
- I installed the “Extra Color Schemes” package under the “Ruby” Category, and settled on “Dark Pastels”. I then changed the default to a fixed-width font (Lucida Sans Typewriter). It looks much better.
- Unfortunately, I don’t see how to change any window except for the editor window to be dark.
- The jVi plugin is awesome. It is everything you would expect an embedded Vi plugin to be. Manually installing plugins was a little tricky: Under the “Tools” menu, select “Plugins” then select the “Downloaded” tab and click “Add Plugins”
- The Mercurial plugin was already installed in the Ubuntu package. It works okay. It is straight-forward to use.
- It reduced confusion for me to disable the plugins that I am not using (like CVS). The menus are less cluttered now.
- The Python plugin works good. The Python shell is aware of the symbols in the debugger. There doesn’t appear to be a command history in the python shell, which is annoying.
- There is a nice SqlBrowser plugin. It’s pretty basic, but it is useful. To
hook it up to SQLite, you need to install the JDBC Sqlite Driver plugin, which
is downloadable from http://plugins.netbeans.org. Once it is installed, go to the
“Window” menu and select “Services”. Then in the Services explorer, you can
configure an SQLite Driver data source. Leave the username and password blank.
Specify the jdbc connection like so:
jdbc:sqlite://home/<dir>/<dbfilename>.dbThe SqlBrowser does not provide any visual view of tables with foreign key relationships mapped out. But there is a tree view of the database schema and you can execute SQL line-by-line and browse the results.
- There are some cool tools. It says that I don’t have a very consistent coding style. That is true, and useful. I wish I had started the project with a good coding style and then followed it’s warnings—for new I just have to turn it off.
- PyLint appears to be integrated already. I don’t see any pylint configuration, but it is giving me warnings that I usually expect from that tool (unused import, etc).
- I didn’t need to do anything special to work with a PyQt application.
- It is not saving the Python Platform setting. I have to reselect Python 2.6 (instead of Jython 2.5) each time I open NetBeans. I am hitting the “Make Default” button, but it forgets every time it is closed.
- Debugging seems kind of buggy. It has problems with my signal handling (the error message says “ValueError: signal only works in main thread”). I commented out the signal assignment for now, and I’ll detect when I’m in debug mode in the future. Now the debugger runs the application alright (don’t be weirded out because it stops on the first line—that’s configurable), but once it hits the first breakpoint it doesn’t want to resume code stepping (though the application GUI is still responsive). I can’t get it to break at a second breakpoint. It sounds like this bug to me: https://netbeans.org/bugzilla/show_bug.cgi?id=169757
- The UI is sometimes laggy.
Summary: NetBeans is really close to being an excellent Python development environment. I think I’ll nudge my team in this direction and hope that the next release addresses the bugginess that I’m struggling with.