TurboGears
Encyclopedia
TurboGears is a Python
Python (programming language)
Python is a general-purpose, high-level programming language whose design philosophy emphasizes code readability. Python claims to "[combine] remarkable power with very clear syntax", and its standard library is large and comprehensive...

 web application framework
Web application framework
A web application framework is a software framework that is designed to support the development of dynamic websites, web applications and web services. The framework aims to alleviate the overhead associated with common activities performed in Web development...

 consisting of several WSGI components such as Pylons, SQLAlchemy
SQLAlchemy
SQLAlchemy is an open source SQL toolkit and object-relational mapper for the Python programming language released under the MIT License.SQLAlchemy provides "a full suite of well known enterprise-level persistence patterns, designed for efficient and high-performing database access, adapted into a...

, Genshi
Genshi (templating language)
Genshi is a template engine for XML-based vocabularies written inPython. Genshi is used to easily insert generated output into XML-based languages, usually HTML, and reuse elements between documents...

 and Repoze.

TurboGears is designed around the model-view-controller
Model-view-controller
Model–view–controller is a software architecture, currently considered an architectural pattern used in software engineering. The pattern isolates "domain logic" from the user interface , permitting independent development, testing and maintenance of each .Model View Controller...

 architecture, much like Struts
Apache Struts
Apache Struts is an open-source web application framework for developing Java EE web applications. It uses and extends the Java Servlet API to encourage developers to adopt a model-view-controller architecture. It was originally created by Craig McClanahan and donated to the Apache Foundation in...

 or Ruby on Rails
Ruby on Rails
Ruby on Rails, often shortened to Rails or RoR, is an open source web application framework for the Ruby programming language.-History:...

, designed to make rapid web application development in Python easier and more maintainable.

TurboGears components

TurboGears is built on top of numerous disparate libraries and middleware. The default tools have changed between the 1.x and 2.x series, but most of these components can be used in either as there is support for many alternate configurations. The following are the primary components a developer would interact with.

TurboGears 2.x components

  • SQLAlchemy
    SQLAlchemy
    SQLAlchemy is an open source SQL toolkit and object-relational mapper for the Python programming language released under the MIT License.SQLAlchemy provides "a full suite of well known enterprise-level persistence patterns, designed for efficient and high-performing database access, adapted into a...

     (Model) - defines the table structures of the user's database and how to link them to Python objects the user's controller can interact with.
  • Genshi
    Genshi (templating language)
    Genshi is a template engine for XML-based vocabularies written inPython. Genshi is used to easily insert generated output into XML-based languages, usually HTML, and reuse elements between documents...

     (View) - defines templates for the HTML or XHTML the user will generate. This is where the user defines the user's front-end the client will interact with.
  • Pylons (Controller) - this middleware handles all the user's back-end logic and connects to the user's webserver to offer up data to the web. By default, the Paster
    Python Paste
    Python Paste, often simply called paste, is a set of utilities for web development in Python. Paste has been described as "a framework for web frameworks".-Python Paste:...

     webserver is used, but the user can also connect to Apache
    Apache HTTP Server
    The Apache HTTP Server, commonly referred to as Apache , is web server software notable for playing a key role in the initial growth of the World Wide Web. In 2009 it became the first web server software to surpass the 100 million website milestone...

    , Nginx
    Nginx
    nginx is a Web server and a reverse proxy server for HTTP, SMTP, POP3 and IMAP protocols, with a strong focus on high concurrency, performance and low memory usage. It is licensed under a BSD-like license and it runs on Unix, Linux, BSD variants, Mac OS X, Solaris, and Microsoft Windows.- Overview...

    , or any other WSGI-compatible webserver.
  • Repoze - Repoze.who & Repoze.what are used to handle security (authentication & authorization respectively). When defining elements of the user's controller to be exposed to the web, repoze predicates define who can access them and under what conditions.
  • Tosca Widgets - is the primary widget library for creating forms and complex GUIs. Tosca by default will generate simple HTML forms, but can also be used as a middleware to connect to more advanced JavaScript widgets and toolkits. Unlike TurboGears 1.x, there is no longer a preferred/integrated JavaScript library .

TurboGears 1.x components

  • SQLObject
    SQLObject
    SQLObject is a Python object-relational mapper between a SQL database and Python objects. It is currently experiencing community popularity, and forms a part of many applications...

     (Model) - data backend that can create a database or interface with existing data on many database servers.
    • SQLAlchemy
      SQLAlchemy
      SQLAlchemy is an open source SQL toolkit and object-relational mapper for the Python programming language released under the MIT License.SQLAlchemy provides "a full suite of well known enterprise-level persistence patterns, designed for efficient and high-performing database access, adapted into a...

       is slated to become the default in TurboGears >= 1.1.
  • Kid
    Kid (Templating Language)
    Kid is a simple template engine for XML-based vocabularies written in Python. Kid claims to have many of the best features of XSLT, TAL, and PHP, but "with much of the limitations and complexity stamped out"....

     (View) - XHTML frontend templating engine where all templates are valid XHTML or XML files that are usually made in a way that allows opening these templates as simple XHTML files to check the design. At the same time features are provided to embed snippets of Python in a XMLish manner.
    • Genshi
      Genshi (templating language)
      Genshi is a template engine for XML-based vocabularies written inPython. Genshi is used to easily insert generated output into XML-based languages, usually HTML, and reuse elements between documents...

       is the successor to Kid and will replace it as the default templating engine in TurboGears >= 1.1. It is nearly 100% syntax-compatible to Kid.
  • CherryPy
    CherryPy
    CherryPy is an object-oriented web application framework using the Python programming language. It is designed for rapid development of web applications by wrapping the HTTP protocol but stays at a low level and does not offer much more than what is defined in RFC .CherryPy can be a web server...

     (Controller) - middleware that allows web applications to be programmed by writing event handlers that return data to (in TurboGears case) templates. The same data can also be received in Ajax
    Ajax (programming)
    Ajax is a group of interrelated web development methods used on the client-side to create asynchronous web applications...

     fashion as a JSON
    JSON
    JSON , or JavaScript Object Notation, is a lightweight text-based open standard designed for human-readable data interchange. It is derived from the JavaScript scripting language for representing simple data structures and associative arrays, called objects...

     data stream.
  • MochiKit
    MochiKit
    MochiKit is a light-weight JavaScript library written and maintained by Bob Ippolito.Inspired by the Python networking framework, Twisted, it uses the concept of deferred execution to allow asynchronous behaviour...

     is the preferred, but optional JavaScript library for TurboGears 1.x. It is a designed to make programming in JavaScript more Pythonic. It is mostly used for implementing Ajax
    Ajax (programming)
    Ajax is a group of interrelated web development methods used on the client-side to create asynchronous web applications...

     features and widgets as it provides an interface to get JSON data streams in asynchronous manner.

Template plugins

Templating languages other than Genshi
Genshi (templating language)
Genshi is a template engine for XML-based vocabularies written inPython. Genshi is used to easily insert generated output into XML-based languages, usually HTML, and reuse elements between documents...

 can be used through the user's app's configuration file. Plugins currently supported in 2.1 are Myghty, Jinja2
Jinja (Template engine)
Jinja is a template engine for the Python programming language. It is similar to the Django template engine but provides Python-like expressions while ensuring that the templates are evaluated in a sandbox. It's a text-based template language and thus can be used to generate any markup as well as...

, Mako, Cheetah
CheetahTemplate
Cheetah is a template engine that uses the Python programming language. It can be used standalone or combined with other tools and frameworks. It is often used for server-side scripting and dynamic web content by generating HTML, but can also be used to generate source code...

, and Kajiki. Kid support is not currently planned as Genshi is virtually identical. This list may continue to change in future versions.

Project history

TurboGears was originally created in 2005 by Kevin Dangoor as the framework behind the as yet unreleased Zesty News product. When he released it as an open source
Open source
The term open source describes practices in production and development that promote access to the end product's source materials. Some consider open source a philosophy, others consider it a pragmatic methodology...

 framework in the end of September 2005, it received more than 30,000 screencast
Screencast
A screencast is a digital recording of computer screen output, also known as a video screen capture, often containing audio narration. The term screencast compares with the related term screenshot; whereas screenshot is a picture of a computer screen, a screencast is essentially a movie of the...

 downloads in the first 3 months.

January 2007 Kevin Dangoor retired as project leader and Alberto Valverde managed the project as his successor, but subsequently stepped down due to other personal commitments. Alberto is still involved in the TurboGears community through his ToscaWidgets project. The TurboGears project is now managed jointly by a group of about half a dozen core developers under the leadership of Mark Ramm (as the TurboGears 2 development lead) and Florent Aide (as the Turbogears 1.x release manager).

In June 2007 the community began experiments to put the TurboGears API on top of components and protocols used in Pylons and there was speculation that the two frameworks may finally be merging. However, the official TurboGears 2 documentation states that this is unlikely to happen, due to the "different, but compatible priorities" of both projects. Pylons wanted to stay focused on low level, extensible design while Turbogears was focused on offering a complete, user-friendly package, and so the two work together much in the same way Debian and Ubuntu do now. The new 2.x branch had its first stable release in May 2009.

As of Fall 2008, TurboGears has a large and healthy community with over 3000 users on the TurboGears mailing list, a book from Prentice Hall
Prentice Hall
Prentice Hall is a major educational publisher. It is an imprint of Pearson Education, Inc., based in Upper Saddle River, New Jersey, USA. Prentice Hall publishes print and digital content for the 6-12 and higher-education market. Prentice Hall distributes its technical titles through the Safari...

 published in Nov. '06, and a number of open source
Open source
The term open source describes practices in production and development that promote access to the end product's source materials. Some consider open source a philosophy, others consider it a pragmatic methodology...

 and proprietary TurboGears applications deployed to the real world. The development progresses at a moderate but steady pace and was also newly fueled by a successful participation of the project as a Google Summer of Code
Google Summer of Code
The Google Summer of Code is an annual program, first held from May to August 2005, in which Google awards stipends to hundreds of students who successfully complete a requested free or open-source software coding project during the summer...

 mentoring organization in 2008 and 2009. TurboGears 1.1, aimed at helping legacy sites make the transition to 2.x, was released in October 2009. A new revision of the book is in the works to update it in line with the changes TurboGears 2 has brought.

In 2010, the project faltered somewhat. The lead developers were called away due to real life issues. By the end of Jan, 2011, though, the project had begun reorganizing and working on getting back on track. After several months getting infrastructure in order and working through coding issues, TurboGears has managed to release new versions (2.0.4 and 2.1.2).

Future of TurboGears

TurboGears development is now focused primarily on the new 2.x branch, with version 2.1.3 recently released. The 1.x branch will continue to receive security and maintenance releases for the next few years. A future 1.1 release will change the default ORM and templating language to match the 2.x series as a means of transition. The planned 1.5 release that would update CherryPy to version 3 has now been canceled to make it clear to new users that 2.x is the future, and 1.x is merely maintained for the convenience of existing users. For users interested in continuing down the path of 1.x and wanting to use CherryPy3 a friendly fork has emerged in the GearShift http://code.google.com/p/python-gearshift project.

The lead developers of TurboGears are now in talks with the Pylons project to join forces with them and Repoze.BFG's developers as a new unified project called Pyramid. The idea is that Pyramid will act as the core base, with minimal dependencies and then TG 3 or TurboPyramid or Orion (name still being discussed) will be a full-stack option built on top of Pyramid. If the merger does occur, it will mean a much larger development community for Turbogears and the current team has promised to make the transition from TG2 as easy as possible.

Until TG3 / TurboPyramid / Orion come to pass, though, the TurboGears community continues work on the TurboGears 2 project.

Further reading

Ramm, M; Dangoor, K; Sayfan, G (November 7, 2006). Rapid Web Applications with TurboGears, Prentice Hall. ISBN 0132433885

See also

  • Django
  • Comparison of web application frameworks
    Comparison of web application frameworks
    This is a comparison of notable web application frameworks.-Perl:-PHP:-Java:-Python:-Ruby:-CFML :-ASP.NET:-Other:-ASP.NET:-C++:-CFML:-Python:-Java:-PHP:-Ruby:-Others:...


External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK