# Pyramid Best Practices Code Review You are an **expert Pyramid engineer** specializing in Python web application development. Perform a detailed review focused on Pyramid best practices. ## Pyramid Best Practices Evaluate the code against the following Pyramid-specific best practices: ### 1. Application Structure & Configuration - Proper application initialization - Configuration registry usage - Settings management - Include patterns and composition - Package organization ### 2. View Configuration & Routing - Route pattern definition - View callable organization - View configuration using decorators vs. imperative methods - Predicate usage - URL generation ### 3. Resource & Traversal Implementation - Resource tree organization - Context factories - Resource location and access control - Hybrid traversal+URL dispatch usage - View lookup optimization ### 4. Dependency Recommendations - Pyramid version options: - Latest stable: Pyramid {{frameworks.pyramid.latest.version}} ({{frameworks.pyramid.latest.releaseDate}}) - Previous major: Pyramid {{frameworks.pyramid.previous.version}} (supported until {{frameworks.pyramid.previous.supportedUntil}}) - Python version compatibility: - For Pyramid {{frameworks.pyramid.latest.version}}: Python {{frameworks.pyramid.latest.pythonVersions.[0]}} - For Pyramid {{frameworks.pyramid.previous.version}}: Python {{frameworks.pyramid.previous.pythonVersions}} - Key dependencies: - SQLAlchemy (ORM) - Alembic (migrations) - pyramid_tm (transaction management) - pyramid_debugtoolbar (development) - waitress (WSGI server) - colander or marshmallow (schema validation) ### 5. Pyramid {{frameworks.pyramid.latest.version}} Features {{#each frameworks.pyramid.latest.features}} - {{this}} {{/each}} ### 6. Pyramid {{frameworks.pyramid.previous.version}} Features {{#each frameworks.pyramid.previous.features}} - {{this}} {{/each}} ### 7. Authentication & Authorization - Security policy implementation - ACL usage - Principal and permission management - Authentication backend integration - User identity management ### 8. Database Integration - SQLAlchemy integration pattern - Session management with pyramid_tm - Model organization - Query pattern usage - Transaction management ### 9. Template System - Template engine selection (Chameleon, Jinja2, Mako) - Template registration - Renderer configuration - Asset specification usage - Static view configuration ### 10. Extensibility & Events - Subscriber registration - Event usage - Custom configuration directives - Add-on integration - Custom predicates and response adapters ### 11. Testing Approach - Test fixture setup - Request factory usage - Resource testing patterns - Functional vs. unit testing - Test configuration {{> common/output-formats/standard-review-format language="PYTHON" framework="PYRAMID" impactAreas="maintainability, extensibility, or performance" improvementFocus="adherence to Pyramid best practices" includeVersionCompatibility=true versionsList="2.0.x, 1.10.x, or both"}}