Gedit as a Python IDE?

Currently I’m working on a small utility that converts gams data files (.gdx) into open office spreadsheets. It’s meant to be a replacement of the gdx2xls utility that moves data from a .gdx file to an Excel spreadsheet, but only available on Windows machines (and MS Office must be installed).

The core of the software is a few hundred lines long python code that reads the gdx file content and write it into an open office spreadsheet. (Communication between python and open office is based on the ooolib library – thanks Joseph Colton for releasing it under the GNU Lesser GLP license).

For developing such a relatively small project you can simply use gnome’s built-in text editor – gedit. By default, only syntax highlighting is available in gedit. But, by installing some additional plugins, gedit can be turned into a fully functional IDE. Check out the screencast below:

The plugins you can see in action above are: Class Browser, Embedded Terminal, iPython Console, Python Code Completion, Python Indentation, External Tools and Bracket Completion

Basically, gedit plugins can be

  • shipped with the base package
  • included in the gedit-plugins package (sudo apt-get install gedit-plugins if it’s not already installed)
  • third-party plugins created by the community (install third-party plugins by downloading them from here and by extracting them into the ~/.gnome2/gedit/plugins folder).

gedit_plugins

Debugging. For a console based solution choose pdb. To use pdb in interactive mode start pdb from the embedded terminal (just as seen in the screencast) by typing:

python -m pdb your_python_script.py

If you prefer a gui for debugging choose winpdb. There is no debugger plugin for gedit yet, but winpdb can be used parallel with gedit. Start winpdb as a standalone application and load the python script you’re working on.

winpdb

About these ads

9 comments

  1. Hi,

    I’ve currently starting a (python) project where I will have to process a quite large number of gdx files. Do you intend to publish the code you’re mentionning in this post? If not, could you point me to the documentation you used to parse the gdx files?

    Thanks in advance,


    Alexandre

    1. Your question was the final incentive to publish my code at last. I’ve already registered the project on sourceforge.net, and as soon as the sourceforge team approves it, you’ll be able to download the source codes.

      Just to clarify: gdx files are first converted into text files with the gdxdump utility, and then these text files (so called dump files) are parsed. Gdxdump is part of the standard gams distribution and available for all platforms including Linux.

    1. That was back in 2009, I can not even remember… The indentation plugin I used was the one you can simply install or activate in the preferences/plugins tab.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s