Python Development Environment – IDE

About a year ago I spent some time doing C and Java development but these days I spend my life working in Python. If you haven’t given it a try yet I would definitely recommend it, its fast, simple and powerful. Obviously there are some restrictions but you’d be surprised how much you can achieve with it!

A change of language does mean a change of IDE however, or at least I thought it might. My IDE of choice has always been Eclipse and I was keen to keep it this way, over this post I  will outline how you can get Eclipse setup for Python development and some extra pointers that I have found useful during my short time developing in Python. There are always mixed comments and feelings about python development environments but I have found Eclipse fits all my needs.

Through this I am going to assume you already have Eclipse installed and setup, I work on Linux but the steps should be identical regardless of OS (Sorry if you find slight differences! Just leave a comment and I’ll update the steps).

You can get Eclipse from http://www.eclipse.org/downloads/. The classic version will be fine, you can install different workspaces as needed if you want to develop in other languages. I am using Eclipse 3.7.1.

Installing PyDev for Eclipse

First step is to get PyDev installed on your Eclipse install. Head up to Help in the top right and select “Install New Software…”.

Eclipse Install New Software ScreenNow on the top right click on the “Add…” button to add a new package site and fill in the details like so;

Name – PyDev
Address – http://pydev.org/updates

PyDev DetailsClick OK and it returns you to the previous Install new software screen but this time it will already have selected the PyDev location and be downloading a list of available packages at that update site.

Select the PyDev option as per the screenshot below, don’t worry about the PyDev Mylyn  integration unless you use it, if you do then I can’t help you with that sorry! 🙂

Click next and have a read of any licenses it throws at you, accept them if you wish or if you don’t agree then hit cancel and stop reading! This will start it installing and it will probably need a restart afterwards.

Now for this next part I’m going to cheat a bit, you can get PyDev to auto configure the interpreter location which is quite nice (given its usually in a fairly standard location anyway). If you head to “Window” in the toolbar and select “Preferences” at the bottom of the list you can then navigate along the left through the following, PyDev -> Interpreter Python and then select Auto Config from the top right.

Hopefully it will find the right path for it and PYTHONPATH is ok. If it doesn’t you can always run a whereis python in a terminal window to try and find the location and add it manually through the “New…” button.

Thats it! You now have Eclipse setup to develop in Python. If you head back to the toolbar and select “New” -> “PyDev Project” you can get started! You might have to select Other and then PyDev Project depending on what version of Eclipse you have installed, it might also ask to restart to switch perspective to PyDev. Handy tip, to switch perspective (or workspace, language) in Eclipse a quick way is to select an icon in the top right that looks like this; 

From there you can select Other and it gives you a list of all the perspectives available to you! In the next post I will talk about changing the colours, tab size and how to make installing themes simple because if you’re anything like me you prefer to work with a dark background and small text. With Eclipse vanilla you don’t have many options to adjust this sort of stuff but I will show you a fantastic plugin that makes it simple and has hundreds of ready made themes to use!

For reference, if you are looking for a decent book to get started with on Python development then have a look at the link to the right, its a book I bought off Amazon when I was getting started and its still my only actual physical reference (plus a few hundred post-it notes sticking out of it everywhere)

Read More