i2py provides tools for converting programs and scripts written in the IDL programming language to Python. It is not an IDL-compatible front end for the Python interpreter, nor does it make any attempt to replicate the functionality of the IDL standard library. Rather, its only purpose is to perform source-to-source conversion of legacy IDL code to Python. Currently, it supports only procedural IDL, although support for object-oriented code may be added in the future.
i2py is implemented in pure Python and should run on any system for which the Python interpreter is available. It uses the excellent PLY package to handle lexing and parsing. (The needed modules are distributed with i2py, so there is no need to install PLY separately.)
Project Status
i2py is still in the alpha stage. Although the package is definitely usable, it may undergo extensive changes and will require a good deal of testing and debugging before it's ready for production use.
Here are some known issues with release 0.1 of i2py:
- The following IDL constructs cannot be converted yet, and i2py will signal an error and abort if it encounters any of them:
- extra keywords (_EXTRA)
- assignment and increment/decrement statements in expressions (e.g. b = 2 + (a = 3))
- structure definitions
- accessing structure fields by number (<struct>.(<field_index>))
- pointers
- There are only a few predefined mappings for IDL variables and subroutines. (These are in the file maplib.py.)
- The current mapping for IDL's WHERE function does not support its second parameter. (This is one example of the general problem of converting functions with output parameters to Python.)
- The package has undergone only limited testing (mostly on examples from the IDL Astronomy User's Library), so there are probably quite a few bugs lurking in the code.
- The author of i2py isn't actually an IDL programmer, so the package may not properly account for subtle (or perhaps not so subtle) differences between the semantics of IDL and Python.
