Next Up on the System i: Python
April 17, 2006 Timothy Prickett Morgan
Strictly speaking, the popular open source software stack that is abbreviated as LAMP should really be shortened to LAMPPP, since the stack is comprised of the Linux operating system, the Apache Web server, the MySQL database, and the three programming languages made popular for Web programming: Perl, Python, and PHP. While the OS/400 platform has informally supported Perl for years, and is just now getting official support for PHP, what you might not know is that two Python variants also run natively on the box.
Of course, running and having support–which means IBM‘s official blessing and tight integration into the unique features of the OS/400 platform–are two different things. With some notable exceptions like relational database technology, single-level store main memory (which no other computers has, as yet), and logical partitioning (which most computers now have), IBM has always taken its time supporting new software ideas on its midrange platforms. That’s because the companies that buy midrange boxes want stable, easy-to-use platforms, and they, like IBM, do not like change for change’s sake. This conservative stance makes for a very stable platform. But it also means that innovations occurring outside the OS/400 platform that are allowing companies to deploy new kinds of applications and often with less effort do not come to the OS/400 platform quick enough. Stability can lead to stagnation.
IBM’s support of Perl was never more than the bare necessity. If you want to run Perl on the AS/400, iSeries, or System i, you grab the Perl source code and compile it for AIX or grab the binaries for AIX and then run Perl in the PASE AIX runtime environment that has been embedded in OS/400 for many years. (The third iteration of the TCP/IP stack that IBM created for OS/400 is actually the TCP/IP stack from AIX running inside PASE, and Tivoli Storage Manager and a bunch of other programs, like the OpenSSH shell, run inside PASE, too.) If you wanted to run a hybrid AIX-OS/400 or Linux-OS/400 environment, you could also run Perl in an AIX or Linux partition and then have it talk back to the database and applications running on the OS/400 and i5/OS partitions on your IBM midrange box. But this is not exactly native support. You can get more details about supporting Perl on the System i in this document and you can get the latest ports for OS/400 right here. Larry Wall created Perl in 1987, and the interpreted programming language was designed to scan text and print out reports, but was also used as the system management scripting language; eventually, it became a sort of glue between various pieces of a Web application (technically known as a Common Gateway Interface, or SGI script). But Perl predates the commercialized Web by a decade.
Like many of you, I have been banging the drum to get the PHP interpreted language supported natively on the iSeries platform, and as I explained a few weeks ago, IBM and Zend Technology are working right now to get an officially supported version of the commercial Zend software stack integrated on the System i platform and distributed for free to customers buying new machines. (See “PHP Will Soon Be Native on the System i5” from two weeks ago for more on the official PHP support.)
Getting PHP support for the System i is made easier in many respects because Zend already exists as a company dedicated to providing commercialized versions of the PHP platform with enterprise-class technical support. Zend also has tight partnerships with operating system platform providers, which allows Zend to ensure that features specific to a given platform are woven into the commercialized versions of PHP. Technically speaking, getting official PHP support should not have taken very long, but it has been years in the making.
I know more about PHP than I do about Python, and what little I do know comes from hunting around for a content management system (CMS) for the IT Jungle site. There are scads of open source CMS programs built in PHP, and quite a number that are built in Python, too. Zope and Plone are the two biggies, and while they are interesting, they are not exactly what I am looking for to display our newsletters. Another popular program written in Python is Mailman, the listserver and email sending program.
In any event, my main reason for arguing for support of Python is the same reason I have argued for support of Perl and PHP on the iSeries: Any language that has millions of newbie and professional developers using it has to be on the iSeries if the iSeries, and now the System i, is not only to adapt to the modern IT world, but thrive in it. I don’t care one little bit about instigating a war between RPG, Java, PHP, and Python programmers. That is like arguing over what is the better tool–a hammer, a screwdriver, a saw, or a staple gun. A toolbox has all of these tools, and more, and you use the right tool for the right job.
Python: A Quick History
Like Perl, Python predates the commercialized Internet, but has been widely adopted because of the desire to make Web pages and applications that are native to the Web browser interface, more flexible and more easily programmed.
Over the Christmas holiday in December 1989, hacker Guido van Rossum of the Netherlands was bored, so he created a descendant of the ABC scripting language for the Unix platform, dubbing it Python, from the British comedy troop Monty Python’s Flying Circus (who also brought us the wonderful term “spam” in its Web usage, not meat usage). Python has been controlled by various organizations throughout its history, but van Rossum, who is known as Benevolent Dictator For Life, or BDFL, has remained the spiritual and technical leader of the project until he created the Python Software Foundation in 2001. At that time, van Rossum and his cohort at PythonLabs were finishing up Python 2.0 and were also getting jobs in the commercial software field. (van Rossum eventually took a job for three years at Zope, the CMS company, and then left to join Elemental Security, a security and risk assessment software company based in San Francisco.) Since Python 2.1, all intellectual property relating to Python has been owned and controlled by this non-profit foundation, and the Python license was tweaked to be compatible with the GNU General Public License (GPL). In December 2005, search engine giant Google hired van Rossum, and paid him to dedicate half of his time to Python development.
The latest Python release is Python 2.4.3, which is brand-spanking-new, having hit the Web on March 29. Python is an interesting language in a number of ways, mainly because it was designed to use as much English as possible and have a very simple, easy-to-read syntax. And, for you die-hard coders in card-walloper languages like RPG and COBOL, white space and columns mean something in Python, and the Python crowd doesn’t go into this whole free-form, new-fangled approach because Python coders believe that indenting means something and makes code more readable. (I could not agree more, and I don’t have to look at anything but HTML code all day.)
It is hard to reckon how many Python programmers there are worldwide, if that is any measure of the importance of any language. In September 2003, the Python Software Foundation estimated that there were roughly 175,000 to 200,000 Python programmers worldwide, with about half of them being in Europe, based on sales of Python books. It is hard to say how the Python installed base has grown over the past three years, but it could have easily doubled or tripled.
There isn’t just one Python, by the way. There are a few different Pythons. The core Python created by the foundation and written in C runs on Linux, Windows, Mac OS X (which has a variant of the open source BSD Unix platform underneath its pretty Mac windows). Python is often distributed with commercial link distributions. There are special ports of Python for AIX and Linux on IBM’s Power processors as well as a port to the AS/400-iSeries-System i platform, which was created from the Python 2.3.1 source code and moved to the OS/400 platform by Per Gummedal. (This project has its own site, called iSeriesPython.) The latest Python release supported is 2.3.3 on the iSeries, and it is available on OS/400 V4R5 and V5R2. Presumably it will also work on other V5 releases. The C source code is also available at the site, which means you can compile your own Python interpreter if you have the ILE C compiler on your box. Gummedal has created specific modules to interface Python with OS/400’s file system and the DB2/400 database. And, if I may be so bold, it looks to me like Gummedal could use a little help with the OS/400 ports. Anyway, there are also ports for z/OS and S/390 on IBM mainframes, OS/2 (if you can believe it), as well as for obscure operating systems such as Aros for Amiga PCs and BeOS, the failed but technically elegant platform made for Apple Macs before Apple moved to BSD. There are even versions for PDAs and cell phones.
The other Pythons are also very interesting. Jython is a version of the Python programming language that is written in Java rather than C, which means it can run in any machine that supports a Java Virtual Machine–such as the OS/400 platform. Interestingly, Jython can be semi-compiled down into Java bytecodes to boost performance, just like Java itself can be. Jython is at the Python 2.1 release level right now, and has been in alpha for the Python 2.2 level since last July. IronPython is an implementation of Python created by Jim Hugunin that is written in Microsoft‘s C# language that can run in the .NET Common Language Runtime or in the open source Project Mono clone of the .NET runtime. (Mono was created by a company called Ximian, which was founded by Miguel de Icaza, the creator of the Gnome graphical user interface for Linux who is now the vice president of developer platforms at Novell.) There is even a project called PyPy, which is an implementation of Python that is written in Python rather than C that is being done by Armin Rigo. He created a just-in-time compiler for Python called Psyco, which can significantly boost the performance of Python.
Why i for Python?
While PHP arguably has an order of magnitude more programmers than Python, the size of the programmer installed base is not everything. More importantly, the System i platform is in no position to limit itself. It needs all the help it can get to extend its reach in the data center, and I think that Python support can help, particularly when it comes to CMS software for automating Web sites.
The one thing that Python needs is a commercial organization to provide installation and technical support for Python, like PHP has with Zend. While many Python-based programs have this type of support–Zope and Plone certainly do–this is a serious shortcoming for Python. This could turn out to be an opportunity for some intrepid Four Hundred gurus. So if you are bored and you feel like build a new business, this might be just such an opportunity.
I know that many of you die-hard RPGers and COBOLers have very little or no use for Perl, PHP, or Python. But this isn’t about you. It’s about the millions of newbies in the world who do have uses for Perl, PHP, and Python and can me it do things. The System i needs them as much as it needs you. I have a few other ideas for what should be included in the System i, and I will share those with you in the coming weeks.