{"id":2709,"library":"pyramid","title":"Pyramid Web Framework","description":"Pyramid is a minimalistic, flexible, and open-source Python web framework that prioritizes simplicity, scalability, and ease of use. It is part of the Pylons Project and is currently at version 2.1, with releases typically following a maintenance and deprecation policy where deprecated features are kept for at least three minor releases before removal. [1, 2, 12, 16]","status":"active","version":"2.1","language":"en","source_language":"en","source_url":"https://github.com/Pylons/pyramid","tags":["web framework","pylons","wsgi","backend"],"install":[{"cmd":"pip install \"pyramid==2.1\"","lang":"bash","label":"Install specific version"},{"cmd":"pip install pyramid","lang":"bash","label":"Install latest"}],"dependencies":[],"imports":[{"symbol":"Configurator","correct":"from pyramid.config import Configurator"},{"symbol":"Response","correct":"from pyramid.response import Response"},{"symbol":"make_server","correct":"from wsgiref.simple_server import make_server"},{"note":"While older patterns might have used `pyramid.decorators`, `pyramid.view.view_config` is the standard and recommended import for view configuration decorators. [10]","wrong":"from pyramid.decorators import view_config","symbol":"view_config","correct":"from pyramid.view import view_config"}],"quickstart":{"code":"from wsgiref.simple_server import make_server\nfrom pyramid.config import Configurator\nfrom pyramid.response import Response\n\ndef hello_world(request):\n    return Response('Hello World!')\n\nif __name__ == '__main__':\n    with Configurator() as config:\n        config.add_route('hello', '/')\n        config.add_view(hello_world, route_name='hello')\n        app = config.make_wsgi_app()\n    server = make_server('0.0.0.0', 6543, app)\n    print('Serving on http://0.0.0.0:6543')\n    server.serve_forever()","lang":"python","description":"This minimal 'hello world' application demonstrates the core components of a Pyramid web application: `Configurator` for application setup, `add_route` to define a URL pattern, `add_view` to link a view callable to a route, and `Response` to return content. It uses `wsgiref.simple_server` to serve the application directly. [2, 5, 12]"},"warnings":[{"fix":"Ensure your project runs on Python 3.10 or newer, as required by Pyramid 2.1. [1, 14]","message":"Pyramid versions 2.0 and later are Python 3 only. Python 2.x is no longer supported. [3, 14]","severity":"breaking","affected_versions":">=2.0"},{"fix":"Migrate to the new single security policy using `pyramid.config.Configurator.set_security_policy()` and update session data to be JSON-serializable. Refer to the 'Upgrading Authentication/Authorization' and 'Upgrading Session Serialization' sections in the Pyramid 2.0 documentation for detailed migration steps. [14]","message":"The authentication and authorization policies from Pyramid 1.x have been merged into a single security policy in Pyramid 2.0. The `ISession` interface for sessions now only supports JSON-serializable data types for security reasons, which is a backward-incompatible change. [14, 15]","severity":"breaking","affected_versions":">=2.0"},{"fix":"Import equivalent ACL-related objects from the `pyramid.authorization` namespace instead. For example, `pyramid.security.Everyone` should now be `pyramid.authorization.Everyone`. [15]","message":"Several ACL-related constants previously imported from `pyramid.security` are now deprecated. [15]","severity":"deprecated","affected_versions":">=2.0"},{"fix":"Always follow the official 'Quick Tutorial' and 'Application Configuration with .ini Files' documentation. Use cookiecutters for project generation to set up a correct initial structure. Pay close attention to environment variables vs. `.ini` file settings. [3, 6, 13]","message":"Pyramid's configuration system, especially with `.ini` files and `pserve`, is powerful but can be a point of confusion for new users. Incorrect configuration paths or settings can lead to application startup issues. [10, 13]","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-04-10T00:00:00.000Z","next_check":"2026-07-09T00:00:00.000Z"}