spyce
home
license
community
download
examples
resources
wishlist
contrib (@sf)
documentation
intro
lang
runtime
modules
tags
install
exits
sourceforge
statistics
freshmeat

Documentation - Introduction
[[ Spyce ]]
Python Server Pages
by Rimon Barr

Prev: 1 - Introduction Up: 1 - Introduction Next: 1.2 - Design Goals

1.1. Rationale

A natural question to ask is why one would choose Spyce, over JSP, ASP, PHP and a handful of other popular HTML scripting languages or technologies that perform a similar function. We compare Spyce with an array of exising tools (chosen for their interesting points of comparison, not completeness):

  • Java Server Pages, JSP, is a widely popular, effective and well-supported solution based on Java Servlet technology. Spyce differs from JSP in that it embeds Python code among the HTML, thus providing a number of advantages over Java. First, Python is a high-level scripting language, where rapid prototyping is syntactically easier to perform. Second, Python is interpreted and latently typed, which can be advantageous for prototyping, especially in avoiding unnecessary binary incompatibility of classes for minor changes. Third, Spyce code is of first-order in the Spyce language, unlike JSP, which allows you to create useful Spyce lambda functions. And, lastly, creating new active tags and modules is simpler in Spyce than in JSP. Like Java, Python is portable.
  • PHP is another popular webserver module for dynamic content generation. The PHP interpreter engine and the language itself were explicitly designed for the task of dynamic HTML generation, while Python is a general-purpose scripting language. Spyce borrows from the extensive development effort in Python: since any Python library can be imported and reused, Spyce does not need to rebuild many of the core function libraries that have been implemented by the PHP project. Moreover, the use of Python often simplifies integration of Spyce with existing system environments. Spyce code is also first-order in the Spyce language and Spyce supports active tags, unlike PHP. Lastly, Spyce is modular in its design, allowing users to easily extend its base functinality with add-on modules. Spyce, like PHP, can run entirely within the process space of a webserver or via CGI (as well as other web server adapters), and has been benchmarked to be competitive in performance. In addition, the Spyce engine can be run from the command-line, which allows Spyce to be used as an HTML preprocessor.
  • Active Server Pages, ASP, is a Microsoft technology popular with Microsoft Internet Information Server (IIS) users. The default and most common language embedding is Visual Basic. Stated briefly, the author strongly prefers the language design and syntax of Python over VB. Secondly, ASP is not well-supported outside the IIS environment. Spyce can currently run under mod_python (Apache), as well as under CGI and FastCGI, or as a proxy server, which is supported in the majority of web server environments. Adapters have also been written for Xitami, Coil, Cheetah -- other web servers and frameworks. Lastly, Spyce is open-source, and free.
  • WebWare with Python Server Pages, PSP, is a recent Python-based open-source development. PSP is similar in design to the Spyce language, and shares many of the same benefits. However, Spyce supports both Python chunks (indented Python) as well as PSP-style statements (braced Python). Spyce code is also first-order in the Spyce language, as discussed above, and supports active tags, unlike PSP. PSP is also an integral part of WebWare, an application-server framework similar to Tomcat Java-based application server of the Apache Jakarta project. Spyce is to WebWare as JSP is to Tomcat. Spyce is far simpler to install and run than WebWare (in the author's humble opinion), and does not involve notions such as application contexts. It aims to do only one thing well: provide a preprocessor and runtime engine for the dynamic generation of HTML using embedded Python.
  • Zope is an object-oriented open-source application server, specializing in "content management, portals, and custom applications." It is more mature than WebWare, but also attacks a much larger problem than Spyce. Zope provides a scripting language called DHTML and can call extensions written in Perl or Python. Spyce embeds Python directly in the HTML, and only Python. It is an HTML-embedded language, not an application server.
In summary, the most popular of these solutions seem to be the solutions (JSP, PHP and ASP) that focus on the smaller problem of embedding a language within HTML. Spyce embeds Python in HTML, and no more. Many users have said that this is "exactly what they have been waiting for". Hopefully, this is the correct point in the design space for your project as well. You really just have to try it and see whether it suits your needs.


Prev: 1 - Introduction Up: 1 - Introduction Next: 1.2 - Design Goals


© 2002-05 Rimon Barr
email: rimon@acm.org
Spyce Powered SourceForge Logo [[ Spyce ]]
Python Server Pages
version 1.3.13