NetBeans 6.7, released earlier this summer, has a pretty nifty Python editor. To give it a spin a decided to set up a project for the Image Packaging System. If you want to try it yourself, here's the steps I took:

Install NetBeans

bleonard@os200906:~$ pfexec pkg install netbeans DOWNLOAD PKGS FILES XFER (MB) Completed 19/19 5638/5638 165.54/165.54 PHASE ACTIONS Install Phase 6756/6756 Deleting content cache
Install the NetBeans Python Plugin


Start NetBeans (Applications > Developer Tools) and install the Python plugin (Tools > Plugins):


Create the IPS Project


The IPS Python sources are in /usr/lib/python2.4/vendor-packages/pkg, with the exception of the pkg script, which is in /usr/bin. To keep the NetBeans project simple, I copied the pkg script from /usr/bin to /usr/lib/python2.4/vendor-packages/pkg. I also renamed the script to pkg2.py. Adding the .py extension allows it to be recognized as a Python script by NetBeans. Changing the name to pkg2 prevents it from conflicting with the existing script in /usr/bin:

pfexec cp /usr/bin/pkg /usr/lib/python2.4/vendor-packages/pkg/pkg2.py
In NetBeans select File > New Project and then select Python Project with Existing Sources:

[IMG]file:///tmp/moz-screenshot-3.png[/IMG]

Give the project a name such as PKG or IPS and set the Python Platform to Python 2.4.4:






Then add /usr/lib/python2.4/vendor-packages/pkg as a source root folder:




To give the project a quick test drive, right-click it and select Properties. Then set the Main Module to pkg2.py and the Application Arguments to something like 'info netbeans':

Then select Run > Run Main Project. You'll see the result in the Output window:






Editor Features

Now that we've got the project set up, let's look at some of the features provided by the editor.


Syntax Highlighting

The code is easy to read.



Code completion

Ctrl+Space to activate.



Hover Documentation and Hyperlink Navigation


Holding down the control key and hovering over Classes and methods will also show you the documentation:



And clicking on the hyper-link will take you to the class or method.

Navigator Window

Also, the Navigator window is a quick way to find your way around a script:





Go to Type


And Go to Type (Ctrl + O) will quickly take you to any type:




Debugger

And finally, one of the coolest features is the debugger. Select Debug > Debug Main Project to start it:


Variables view:




You can find a summary of features on the NetBeans Python Wiki. Please file issues you find with the NetBeans Python Editor.









More...