Pyramid is a great framework for developing web applications that also supports the development of “Extensible” and “Pluggable” ones based on certain rules. However, there is no much documentation on how to create such type of applications.

CKAN is an excellent example of a web application that can be extended or modified using plugins. It relies on PyUtilib Component Architecture (PCA) to declare a series of interfaces and extension points that then are used by plugins to hook in. It also implements a series of Jinja2 extension (notably CKAN_EXTENDS) that allows easily template inheritance between CKAN and connected plugins.

CKAN however is developed using Pylons which is now superseded by Pyramid and coupled to its complexity makes it difficult to grasp how to apply such extensibility to Pyramid web applications.

I took the time to look into the CKAN code, the PCA documentation and Jinja2 and I came with an example that applies a modified version of CKAN extensible system to a simple Pyramid application. It can be used as a starter to develop more complex extendable web applications. The example (pcaexample) is based on a “pyramid-cookiecutter-alchemy” Cookiecutter. The code also includes an example of a plugin that is based on a “pyramid-cookiecutter-starter”. It uses Pyramid 1.8.3 with PyUtilib 5.4.1.

You can get the code here.