A Glance at PyDev

by Jeremy Jones

I just happened across a mesage in the IPython mailing list where a user was trying to get IPython working with PyDev. This message sparked my interest again in PyDev. (For anyone who doesn't know, PyDev is an extension to the Eclipse IDE which focuses on Python coding.) I've tried Eclipse several times over the past few years and have never been impressed with it. I've also tried PyDev a couple of times and never felt that it would benefit me much. However, in the spirit of openness and discovery, I'm giving it another go.

I checked my system (Ubuntu Dapper) and found that I had Eclipse 3.1.2 and PyDev 1.0.3 installed, so I fired it up. I had apparently created a workspace and project some time back since the project and workspace appeared when Eclipse came up. The first thing I was interested in was how well the code completion worked. (Maybe I've been brainwashed with my recent exposure to Visual Studio.) I imported the "os" module and tried to complete on "os.lis". Ugghh. Why isn't this working?? I went to the PyDev site and noticed that the most recent version was 1.0.6, so I updated my PyDev to that version. (Side note: Eclipse's extension system is really slick, especially how easy it is to install and keep extensions updated.) That update certainly didn't help at all. Then I noticed that I was trying to edit Python files in a Java project. User error! I quickly created a PyDev project and a Python source file. My "import os", "os.lis"<CTRL><SPACE> came back with the exact results I was looking for. I found completion worked for global variables, functions, and classes as well as "self." for attributes and methods. Very nice.

I then tried some of the items under the "Source" menu, such as commenting and uncommenting code blocks. Commenting code blocks with <CTRL>3 works great. Uncomenting with <CTRL><SHIFT>3 doesn't seem to work for me, though. Auto-indenting works great. The refactoring seems to work pretty well. I tested it by writing a little piece of code and telling it to refactor out a method and it seemed to do so pretty cleanly. The "code collapse"ing works pretty nicely as well. You can (un)collapse with keyboard shortcuts or by clicking on the +/- in the gutter next to the appropriate pieces of code. There are a number of other utilities under the "Source" menu that I haven't yet touched. There also appear to be some capabilities to script things with Jython. I'm also trying to get the debugger working. PyDev doesn't appear to have a shortage of features.

I'm definitely going to have to install the SVN plugin for Eclipse and play around a little more with this. When I first tried out Eclipse, I remember it being sluggish and bloated feeling. The version I have installed is actually quite responsive. It's hogging down a good bit more memory than I'd like, but I pretty much expect that with a tool like this. Overall, I'm really impressed with what I see with PyDev. I'm not sure I'll be switching away from my beloved vim, but I'm sure some folks will find PyDev and Eclipse an excellent development environment. Good work, Fabio!

1 Comments

translated
2006-05-02 16:21:41
PyDev might not be the best environment for Python, or phpeclipse the best for Php, or Radrails the best for Rails, or the web dev plugins the best css, javascript, xml editors, but it's very enjoyable to have it all in one place!
Off course no language is better integrated in Eclipse than Java, but all these plugins are getting better at an impressive pace.
The fact that Java doesn't have duck typing at all and its strict parsing probably makes things a lot easier for IDE designers.