« IPS Cache | Main | OOW »

NetBeans Python Editor

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:

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.


« IPS Cache | Main | OOW »
Comments:

Is it also installable in Sun Studio?

Posted by Shmerl on September 10, 2009 at 08:35 PM GMT #

There is an older Python plugin for Sun Studio, however, to get the features you see here you'll have to wait until the next release of Sun Studio, which is scheduled for mid-2010.

Posted by Brian Leonard on October 02, 2009 at 10:26 AM GMT #

Post a Comment:
  • HTML Syntax: NOT allowed
About

The Observatory is a blog for users of Oracle Solaris. Tune in here for tips, tricks and more as we explore the Solaris operating system from Oracle.

Search

Archives
« August 2015
SunMonTueWedThuFriSat
      
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
     
Today