Why Pylons?

Pylons is made up of the best concepts from Python, Ruby, and Perl, delivering a structured and very flexible Python web framework.

It’s also one of the earliest projects to use the influence of the evolving WSGI standard, which permits wide-ranging re-use and flexibility – only if it’s required. The aim of Pylons, out of the box, is to improve the speed, flexibility, and ease of web development.


Works Well With Others

Pylons is developed from Paste, so it permits and supports the use of your beloved Python libraries and components:




Models

CouchDB, SQLObject, SQLAlchemy, or none




Templating

Genshi, Mako, Jinja2, your preferred choice




Helpers

FormAlchemy for generation of entire forms, WebHelpers for generation of small HTML snippets




Request Dispatching

By default Routes, or use your favorite



Pylons Web Framework

Pylons Framework is an open-source application framework for the Web, written in Python

It makes great utilization of the Web Server Gateway Interface standard to support reusability and to divide functionality into different modules.

It takes great influence from Ruby on Rails with Webhelpers and Routes which are two of its key components being Python reimplementation of features from Rails.


Structure

Pylons is well-known for possessing the almost-complete stack of third-party tools, thereby shunning the “not-invented-here” spectacle.


Dependencies, Setup, and Installation

Pylons is usually installed through EasyInstall through the Python Package Index (PyPI).

This is the official installation method through which a majority of the additional tools are usually installed. EasyInstall also takes care of package dependencies where necessary. Some distributions will also have Paste and Pylon packaged but these usually lag the official distribution packages. It is also possible to install Pylons by hand after renaming the .egg file to .zip and then extracting the contents.

Paste is useful in project testing, deployment, and setup. With the common ini configuration format, Paste permits multiple “profiles”, so that developers can make development and deployment setups using the same codebase without unveiling Pylons’ sensitive parts, like the interactive debugger, to production users.


URL Dispatch

Presently, Routes, a Python reimplementation of the URL dispatcher from Ruby on Rails, is the only extensively used Pylons URL dispatcher.

However, it is possible to use any WSGI-compatible URL dispatcher. Routes was specifically created for use within Pylons even though it is a separate library, and its development is still closely in sync with Pylons.


HTML Generation

WebHelpers is another part of Ruby on Rails that has been modified for Pylons.

It provides URL mapping depending on the configuration of the Routes. Webhelpers also offers some utility functions for creating JavaScript code utilizing the prototype libraries and script.aculo.us. FormBuild and FormEncode are used to generate and validate HTML form with Mako’s inheritance model also being used for form generation.


Templating

Myghty used to be the default templating language for Pylons, but it was replaced by Mako in version 0.9.6.

Both languages are text-based (not XML-based), and support consists of inheritance and embedding random Python code.

Due to the loosely coupled layers on Pylons, it is possible to use other templating languages. An XML-based templating language known as Genshi can be used in place of Myghty or Mako.


Object-relational mapping and Database Abstraction

There is no default database library in Pylons. Both SQLAlchemy and SQLObject can be used.


Creation of the Pyramid Web Framework

Pylons has advanced into the Pylons Project with the old Pylons 1.0 code in maintenance-only mode.

However, after the project’s merger with repose.bfg in November 2010, newer Pylons versions are distinct from the maiden Pylons 1.0. The initial plan from Pylons developers was to rewrite some parts of the code, but they found the new code approximating repose.bfg, which resulted in the merger leading to the rebranding and relaunching of repose.bfg to Pyramid web framework.


What is Pyramid?

This is an open source web framework based on WSGI and written in Python. It is minimalistic and inspired by Pylons, Zope, and Django.

Pyramid was more popular amongst the Plone and Zope communities after the KARL project of the Open Society Institute migrate from Plone to BFG. In 2010, an announcement was made about the Pylons framework moving over to making BFG a base for version 1.5 and this led to it being renamed as Pyramid.


What are Pyramid's Features?

Pyramid is a platform-independent, minimalistic web framework. It is persistence skeptical with integration to both SQL databases through SQLAlchemy and with

Zope Object Database, along with other NoSQL databases like CouchDB.

Pyramid lets developers define routes through the use of regular expressions mapping to objects. Pyramid, just like Zope its sister framework, also permits the transversal of hierarchical object, where every part of a URL tends to be an object enclosing other objects, just like filesystem folders.


Blog Posts