• Python Application Development with Aptana PyDev

Python Application Development with Aptana PyDev
By Matthew Sacks

Before discussing Aptana Pydev, we need to cover the platform in which Aptana Pydev runs best on, Aptana Studio of course. Aptana Studio is a new web application IDE for dynamic scripting languages. Based on the open source Eclipse IDE, Aptana adds many features designed to assist with development of dynamic web applications, focusing heavily on Ajax/JavaScript libraries, Ruby on Rains, Python, Adobe AIR, and iPhone/Nokia mobile development. Aptana’s comfortable feel is particularly suited to its main audience—Ajax and JavaScript developers. Aptana Studio also supports Ajax development with the Aptana Jaxer (http://jaxer.org/) Ajax server, and provides native IDE support for many JavaScript libraries, such as Dojo (http://www.dojotoolkit.org/), MochiKit (http://www.mochikit.com/), and jQuery (http://jquery.com/).

Further distinguishing Aptana from traditional IDEs is its native functionality to deploy web applications instantly to the cloud. Through partnerships with cloud infrastructure providers such as Joyent, cloud servers are available starting at under $50 per month, directly integrated with the Aptana IDE. (This feature essentially adds value through convenience; however, applications can be deployed to any platform of choice).

Python Development in Aptana

Aptana is the official maintainer of the Pydev (http://aptana.com/python) project for Eclipse. Aptana Pydev is a Python development module that allows for better syntax checking and support for Python and Jython development.

Aptana Studio is a convenient all-around IDE for Java as well as for dynamic scripting languages such as Python/Ruby, because it extends the Eclipse project IDE. In addition to providing excellent Python development support, the professional version offers professional support on the IDE, something not currently available for the Eclipse project. The following tutorial describes how to set up the Aptana IDE for Python and Jython.

Note: The Aptana IDE works with all the major open source languages. I’ve already mentioned Ajax and JavaScript, and the following tutorial shows how to use Aptana with Python and Jython. Steps for installing and using Aptana will vary slightly, depending on which programming language of choice.

Configuring Aptana for Python and Jython Development

Step 1) On the My Aptana tab, click Plugins.
aptana-figure-5
Step 2) Click the Get It link for the Aptana Pydev module.
Step 3) In the Updates dialog, click the checkbox for Site Providing Aptana Pydev; then click the Next button.
aptana-figure-7
Step 4) Accept the license agreement by click the “I accept” radio button and then click Next.
Step 5) The Pydev module installation will now be prepared. Change the installation location as needed. When the correct version and installation path are listed in the Install dialog, click Finish to complete the module installation.
aptana-figure-9
Step 6) The Update Manager will install and configure the necessary files for the Pydev module. (To cancel the installation, click the Cancel button.)
aptana-figure-10
Step 7) In the Verification dialog, click Install or Install All to complete the installation.
aptana-figure-11
Step 8 ) Click the Yes button when prompted to restart Aptana.
aptana-figure-12

Once Aptana has restarted, the Pydev module will be installed.

Creating a Pydev Project

Pydev projects include Python projects as well as the ability to deploy directly to Google App Engine for Pydev projects.  A new project may include a single Python module, or a full suite of Python modules and dependencies. A project is the starting point for creating a Python application in Aptana Studio.

Step 1) To create a new Pydev project, click File > New Project. In the New Project dialog, select Pydev Project in the Pydev project folder; then click the Next button.
aptana-figure-13
Step 2) Enter the project name and then select the programming language of choice: Python, Jython, or Iron Python.
atpana-figure-14
Step 3) To select a Python interpreter to run the project, click the “Please configure an interpreter” link. A Preferences pane will appear requiring the configuration of the Python interpreter.
aptana-figure-15
Step 4) Click the Auto Config button to locate a Python interpreter in the default system path. To manually locate an interpreter, click New and specify the search location. After the Python interpreter is located, click OK to add it to the Preferences list.

aptana-figure-16
Step 5) The Python interpreter should now appear in the list of Python interpreters, click OK to save the configuration and return to the Pydev project
aptana-figure-17

Step 6) Click Finish button to create the new project.

Step 7) Right-click the project source folder and select New > Pydev Module.
aptana-figure-19

The base Pydev project has been created, along with a feature-rich Python and Jython development environment.

Some developers prefer simple text-file editing for creating Python applications, and may not wan’t a full IDE such as Aptana Studio. But for developers who are seeking source code management, syntax checking, debugging, and the ability to sync and deploy to the native Aptana cloud (which is available at a fee), Aptana Studio provides these features for more effective Python and Jython programming.

Using Aptana Studio to Write a Simple Python Web App

As a test of this capability, I wrote a simple Python web application and deployed it to Aptana’s integrated hosting platform. The process was quite simple and seamless.

First, install the CherryPy library (http://www.cherrypy.org/) on a local development machine—a matter of five quick steps:
Step 1) Download CherryPy
Step 2) Execute python setup.py install
Step 3) Deploy the demo application, or write a simple CherryPy test application ( As an option, deploy to the cloud)
Step 4) Modify network configuration in the CherryPy configuration file to make it publicly accessible
Step 5) Run and test the CherryPy Python Web application

For more details, I talked with Aptana’s CEO, Paul Colton, about how the Aptana Studio IDE was developed. Colton notes that much of PDT (PHP Development Tools) has been incorporated into Aptana’s PHP plug-in, but really convenient things like multiple-language support at edit time have also been added (PHP plus HTML, JavaScript, CSS, and so on), as well as a PHP server that’s ready to use out of the box.

In addition to turning plug-ins into projects, Colton says, Aptana is really just trying to create a better web application development experience for developers. If an existing Eclipse plugin can do the job, great, but if it falls short of the expectations of the developer, then Aptana will consider updating or even rewriting it, as it has done with its JavaScript, HTML, and CSS editors. Nearly all of the Aptana Studio source code is open source, and Aptana also has contributed various technologies as Eclipse projects.

One interesting option to consider is running Aptana Studio as an Eclipse plug-in (http://www.aptana.com/docs/index.php/Plugging_Aptana_into_an_existing_Eclipse_configuration). When might one want to do this? When using Aptana Studio for Java Development, or if already utilizing Eclipse, plugging Aptana Studio into Eclipse makes for simple integration with an existing Eclipse IDE. Aptana Studio’s standalone version is Eclipse-based RCP  with the Aptana plug-ins for the web, the cloud, and Ajax pre-installed, and add Rails and PHP as modules.

I asked Colton to tell me a little about the history of the company, which seems to be thriving, and he quoted some of the usual staggering open source numbers: On the third day after Aptana Studio was launched, the product was downloaded 50,000 times. A great start—but Studio has already exceeded 4 million downloads. Why is it so popular? Because it encompasses leading tools and services for web development using Ajax, HTML, CSS, JavaScript, and choice of proramming languages: PHP, Rails, Python, Jaxer, and Java.

Like most organizations that produce software for open source developers, Aptana has had to struggle with the issues of Free Software versus proprietary. Aptana can completely give Studio away for free because Aptana’s primary business model focuses on providing free tools paired with the ability to deploy, manage, and scale web applications (PHP and Ruby on Rails today, with Java and Python potentially in the future) in the cloud atop leading cloud infrastructure providers, via their Aptana Cloud service. These these scalable app environments are available any time for full production, or for staging, testing, and development. Integration with Aptana Studio is an added efficiency, since Studio can work with the remote databases, files, and hosted source control for projects. However, users of Aptana Cloud aren’t required to use Studio—cloud sites are also accessible via SFTP and SSH.
Note: You may have heard of “team mode” in Aptana Cloud Connect. What is it? This feature lets the site owner and administrators add/remove other developers and administrators of a cloud-hosted site. It’s just one feature among many for the cloud sites in the Aptana Cloud Connect service.

Aptana Cloud Connect is architected to work with multiple cloud service providers. OpenSolaris is the operating system that Aptana’s cloud service partner Joyent uses. Amazon and Rackspace are also on Aptana’s roadmap for the future, along with Linux and full Integration for Python. Pydev supports Jython in the same way, running in parallel to Aptana Studio. The ultimate vision is to integrate the two, so that Aptana’s Ajax and web editing capabilities can also work within the context of Python language editing.

Aptana is an excellent environment for writing Python applications, but is not limited to only Python and Jython development. Consider the following information about development in these languages with Aptana:

HTML, CSS and JavaScript are core features of Aptana Studio —they’re technologies used by any web developer to create websites and apps. Aptana’s support for CSS, JavaScript, HTML, and Ajax is renowned. When coding for the web, usually  these languages are used simultaneously, so Aptana gives provides the tools to do just that—without having to use different editors for each programming language.

RadRails is the leading Ruby on Rails development environment for Eclipse. Like other Aptana products, it comes ready to use, versus having to do lots of manual setup. Rails is preinstalled, and  software developers can be creating apps in just minutes, and then extend and modify the environment as desired. RadRails is great for beginners and experts alike, since it provides the command-line interface for experts, but also delivers easy-to-use GUI controls for people who are just learning Rails.. When using the GUI, the user sees the commands sent to the command line, so the user learn how to execute commands directly to increase efficiency with Rails.

RadRails also comes with the Ruby Development Tools (RDT), an Eclipse project to which Aptana leads and has been a contributor.

Conclusions

By adding features and support to standard Eclipse plug-ins such as Pydev, Aptana’s quality assurance (QA) team turns these plug-ins into projects. Aptana now manages the Pydev project, which is certainly the most popular Python development project at the moment—within the Eclipse community, at least.

Aptana Studio has proven to be a complete solution for the development and testing of a simple Python web application. I found it to be a seamless process for installing and configuring the Pydev module into the IDE, writing the application, and deploying the application to the cloud using the IDE’s native hosting support.

Aptana Studio is a valuable addition to the available IDEs on the market. As part of the Eclipse project and offering professional support for those requiring it, it also makes a compelling addition to any developer’s toolset.

Further Reading

The Eclipse Project
Aptana PyDev
PyDev on SourceForge
CherryPy Python Web Application Framework

Eclipse Plugin Central

Share and Enjoy:
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DZone
  • E-mail this story to a friend!
  • FriendFeed
  • HackerNews
  • LinkedIn
  • Reddit
  • StumbleUpon
  • Suggest to Techmeme via Twitter
  • Technorati
  • Twitter
  • FSDaily
  • Ping.fm

This website uses IntenseDebate comments, but they are not currently loaded because either your browser doesn't support JavaScript, or they didn't load fast enough.

  1. uberVU - social comments Says:

    Social comments and analytics for this post…

    This post was mentioned on Twitter by thebitsource: #
    #Python #Application #Development with Aptana PyDev http://bit.ly/SC60p...

Leave a Reply

You must be logged in to post a comment.