Pillars of Python: Pyramid Web framework

Built on the foundation of repoze.bfg, Pyramid is powerfully flexible but takes time to figure out

Pyramid is a Python Web framework being developed as part of the Pylons Project. Pyramid 1.0 was released this year. Prior to that, the Pylon Project's Web framework was, not surprisingly, Pylons. But Pylons has now entered legacy mode; the project website promises that Pylons will "continue to be maintained, but not enhanced."

Pyramid will run on any 2.x Python that is later than version 2.4. In addition, Pyramid can be run on the Java-based Python variant, Jython. The framework is based on the repoze.bfg framework -- sometimes simply called BFG -- with some additions. Pyramid incorporates concepts inspired by Zope, Pylons, and Django. It's important to note that Pyramid is not an update of Pylons; the two frameworks share no common code. Pylons programmers need not be left out in the cold, however. The Pylons Project provides a fallback wrapper that allows Pylons applications to run inside Pyramid, thus permitting Pylons developers to incrementally port their applications to Pyramid.

Pyramid is "policy free," meaning that Pyramid makes no assertions about the database you should use or place any strict requirements on the templating system employed. In fact, documentation says that Pyramid's template system is included only for convenience. Nor does Pyramid fit neatly into the MVC paradigm -- as with Django, there's no clear controller component. However, Pyramid goes a step further with its policy-free attitude: It's hard to find a model component.

Pyramid provides two mechanisms for mapping an URL to executable code. The first is a simple dispatch system that matches an URL -- or a set of URLs, as determined by some mechanism such as a regular expression -- to executable code. This technique is used in many frameworks, such as the Rails system and its Python implementation, Routes.

The second is a technique called traversal that uses a specific kind of Python object that Pyramid calls a resource. Every application includes a resource tree, a collection of resource objects anchored to a root. Even an application that does not use traversal includes resources, though in that case, the tree has a single level.

Test Center Scorecard
  40% 25% 25% 10%  
Pyramid 1.0 8 7 8 8



1 2 3 Page 1
Page 1 of 3
How to choose a low-code development platform