<< ALL BLOG POSTS

Intro to the Python Framework Pyramid

Table of Contents

 

We like Pyramid over Django, Flask, and Bottle for projects that require flexibility, scalability and speed. It gives us more control than Django and is easy to create a small app that can scale later without being rewritten. These are many of the same reasons for Why We Choose Python in general.

Recently we provided some training on how Pyramid works that was recorded. It provides a great overview of why Pyramid is ideal and how to setup a basic app with scaffolds, routes, and persistence. We also built a ToDo App for a web shootout we organized in Indianapolis through IndyPy. Putting these together turned out to be a great introduction to Pyramid, so I wrote this post.

To get a good understanding of the Pyramid framework and see how to implement a basic ToDo app from scratch:

  1. Watch our Intro to Pyramid video (21 min)
  2. Read the step by step instructions in the ToDo app README.md at https://github.com/indypy/todopyramid
  3. Check out the official documentation and tutorials at http://docs.pylonsproject.org/en/latest/docs/pyramid.html

If you would like to discuss Six Feet Up building your next web application, contact us or signup for our newsletter to get more articles like this.

If you are looking for an in-depth comparison of Pyramid vs. other frameworks check out Why We Choose Pyramid for Rapid Web Development Projects.

Intro to Pyramid

Pyramid is a Python based open source web framework. According to the project's website:

"As a framework, its primary job is to make it easier for a developer to create an arbitrary web application. The type of application being created isn’t really important; it could be a spreadsheet, a corporate intranet, or a social networking platform. Pyramid is general enough that it can be used in a wide variety of circumstances."

The Pyramid tenets are:

  • Simplicity
  • Minimalism
  • Documentation
  • Speed
  • Reliability
  • Openness

Pyramid is based on Zope, Pylons, and Django. It supports small and large projects so there is no need to rewrite like you would with small frameworks. It's also the fastest Python web framework.

The Pyramid Configuration Supports:

  • imperative configuration
  • conflict detection
  • extensibility
  • flexible authentication and authorization policies
  • programmatic introspection

Scaffolding and Templating

Pyramid comes with several basic scaffolds to get you started and lets you pick your preferred templating system. Chameleon, Mako, Jinja 2 and others are supported.

Persistence

Pyramid lets you pick whatever persistence method you prefer and supports ZODB and SQLAlchemy. You could also use MongoDB, PostgreSQL, and others.

Additional Resources

Pyramid 1.4 Docs - http://docs.pylonsproject.org/projects/pyramid/en/1.4-branch/
Pyramid Denials - http://docs.pylonsproject.org/en/latest/denials/pyramid.html

Want to learn more about Pyramid?

Related Posts
How can we assist you?
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.