Radio as a Python IDE

The Python Tool allows Radio UserLand to be used as a Python IDE. Radio's integrated outliner turns out to be a wonderful tool for Python editting, and the Tool provides an efficient way to write, debug, and deploy Python code.

After dropping the python.root file into your Tools directory (Macintosh users see additional information below) and restarting Radio, you will find a new menu in the Tools menu.



Select 'Open Code Outline.'

If this is the first time you've run the Python Tool, you will be prompted to locate your copy of Python. Use the standard folder selection dialog to navigate to your copy of Python, and accept it. If you do not have a copy of Python, you can hit 'cancel,' and you will be given the option of having your Web Browser openned to a page that will allow you to download the proper Python interpreter for your platform.

Once the tool has been configured, an outline of all the Python source files being managed by the Python Tool will be displayed. If this is the first time you've run the tool, your code outline will look similar to this (this is on OS X, the Python Tool has also been tested on Windows XP, not yet on 2K/NT/95).



These files are mirrored into a 'Python' folder in your Radio UserLand application directory. The Python Tool expects to control all activity that happens in the Python directory. It stores all Python Source code internally, and echos it onto the disk for execution. If you edit any of the generated Python source files in an external editor, your edits will be lost the next time the Python Tool regenerates the source code.

Double-click on 'phi.py.'



This is an example Python source file being editted in Radio UserLand. It is a simple program that shows how the Fibonacci Sequence relates to the Golden Mean (phi).

Notice that the outline indentation mirrors the source code indentation in the Python code. You can use all of the outliner's functionality to manipulate Python code. You can even use comments in the same way you would use them in UserTalk. Just hit ctrl/cmd-, and the line (plus any children) are commented out. When writing out the code to be executed, the Python Tool automatically converts the outline comments into Python comments.

To run the Python script, hit the 'Run' toolbar button.



The output appears in an outline window.

Using the Code Outline, you can create more scripts and packages. Currently that is all the functionality that exists. More example code is needed. There are some rpc responders that allow Python Scripts to use Radio's file dialog functionality. There will soon be a Python Web Services framework, as well as some UserTalk glue code that allows Python access to Radio's unique ODB.

I'm sure that Murphy has provided some road blocks that limit the kinds of scripts that you can develop in this IDE, but I can't think of any. When a script is executed, it is executed in a Radio thread, so you could even do wxPython programming if you wanted. If it runs on Python, it should run in the IDE. I can see even doing ZODB development with it.

It excites me that Radio allows me to develop an IDE that feels as useful as a Smalltalk IDE. For me, that is high praise.

Mac Tips: You must grab this archive of icon files and unpack it in 'Radio Userland/Appearance/Icons' to see the icons. I'm not sure how to read in and write out a resource file, so I have to pack them separately.

screenshot