Cette page est affichée en anglais. Une traduction française est en cours.
ConfigsJul 1, 2026·3 min de lecture

Pyramid — Versatile Python Web Framework for Any Scale

Pyramid is a mature, general-purpose Python web framework that scales from single-file applications to large enterprise systems, offering traversal and URL dispatch routing, pluggable authentication, and deep extensibility.

Prêt pour agents

Installation agent prête

Cet actif peut être installé après choix du runtime, vérification du plan et exécution de la commande adaptée.

Native · 98/100Policy : autoriser
Surface agent
Tout agent MCP/CLI
Type
Skill
Installation
Single
Confiance
Confiance : Established
Point d'entrée
Pyramid Framework
Commande d'installation directe
npx -y tokrepo@latest install 7b4e6f2d-7569-11f1-9bc6-00163e2b0d79 --target codex

À exécuter après confirmation du plan en dry-run.

Introduction

Pyramid is a Python web framework from the Pylons Project that is designed to start small and grow with your application. It provides two routing mechanisms (URL dispatch and traversal), a flexible security system, and an extension architecture that allows developers to choose their own ORM, template engine, and session backend.

What Pyramid Does

  • Routes requests via URL dispatch (regex patterns) or traversal (resource trees)
  • Provides a pluggable authentication and authorization policy system
  • Supports view configuration via decorators, imperative calls, or ZCML
  • Offers asset specifications for locating templates, static files, and resources
  • Includes a scaffolding system (cookiecutter templates) for project bootstrapping

Architecture Overview

Pyramid is a WSGI framework built around a Configurator that registers routes, views, and policies. At request time, the router matches a URL to a route or traverses a resource tree, selects the appropriate view callable, applies security predicates, and returns a Response. The framework uses a component architecture (based on Zope interfaces) for extensibility, allowing add-ons to hook into nearly any processing stage.

Self-Hosting & Configuration

  • Requires Python 3.8 or later
  • Install with pip install pyramid or from a cookiecutter template
  • Configuration is done in Python via the Configurator object
  • Deploy with any WSGI server: Gunicorn, uWSGI, or Waitress (included)
  • Use pserve development.ini during development for auto-reload

Key Features

  • Dual routing system: URL dispatch for REST APIs, traversal for content-heavy apps
  • Security policies are pluggable and decoupled from views
  • Extensible via add-ons that hook into the configurator without monkey-patching
  • First-class support for internationalization and localization
  • Comprehensive test harness with pyramid.testing for unit and functional tests

Comparison with Similar Tools

  • Django — opinionated full-stack with built-in ORM; Pyramid is choose-your-own-components
  • Flask — micro framework for simple apps; Pyramid scales better to complex architectures
  • FastAPI — async-first API framework; Pyramid is WSGI-based with deeper extensibility
  • Tornado — async server with its own event loop; Pyramid runs on standard WSGI servers
  • web2py — batteries-included with admin UI; Pyramid favors explicit configuration

FAQ

Q: When should I choose Pyramid over Django? A: Choose Pyramid when you need flexibility in component selection (ORM, template engine) or when your routing needs go beyond simple URL patterns (traversal).

Q: Does Pyramid support async views? A: Pyramid 2.0 added initial async view support. For fully async applications, consider pairing with an ASGI adapter or using a dedicated async framework.

Q: What is traversal routing? A: Traversal walks a tree of resource objects using URL path segments as keys. It is useful for CMS-like applications where URL structure mirrors a content hierarchy.

Q: Is Pyramid still actively maintained? A: Yes. The Pylons Project maintains Pyramid with regular releases and security patches.

Sources

Fil de discussion

Connectez-vous pour rejoindre la discussion.
Aucun commentaire pour l'instant. Soyez le premier à partager votre avis.

Actifs similaires