FastAPI-like decorators for Pyramid - Build type-safe REST APIs with automatic validation, serialization, and OpenAPI documentation.
pyramid-capstone enhances Pyramid’s already excellent foundation with modern developer conveniences. Built on Pyramid’s proven architecture of robustness, flexibility, and enterprise-grade security, it adds automatic validation, serialization, and documentation generation while preserving Pyramid’s minimalist philosophy.
from pyramid.config import Configurator
from pyramid_capstone import api
@api.get('/users/{user_id}')
def get_user(request, user_id: int) -> dict:
return {"id": user_id, "name": "John Doe"}
@api.post('/users')
def create_user(request, name: str, email: str) -> dict:
# Parameters automatically extracted and validated from JSON body
return {"message": "User created", "name": name, "email": email}
# Pyramid app setup
def main(global_config, **settings):
config = Configurator(settings=settings)
config.include('pyramid_capstone')
config.scan()
return config.make_wsgi_app()
That’s it! No manual schema definitions, no boilerplate validation code.
Ready to start building type-safe APIs? Check out our Getting Started Guide for installation instructions and your first API endpoint.
pyramid-capstone combines Pyramid’s enterprise-grade foundation with modern developer experience:
| Feature | pyramid-capstone | Pure Pyramid | Pure Cornice |
|---|---|---|---|
| Developer Experience | ✅ Modern + Simple | ✅ Minimal | ⚠️ Schema-heavy |
| Auto Validation | ✅ Type-hint based | ❌ Manual setup | ✅ Schema-based |
| OpenAPI Docs | ✅ Auto-generated | ❌ Manual | ⚠️ Limited |
| Production Readiness | ✅ Pyramid foundation | ✅ Battle-tested | ✅ Pyramid foundation |
| Security & Auth | ✅ Full Pyramid power | ✅ Comprehensive | ✅ Full Pyramid power |
| Flexibility | ✅ Pyramid’s strength | ✅ Maximum | ✅ Pyramid’s strength |
| Learning Curve | ✅ Gentle enhancement | ⚠️ Framework mastery | ⚠️ Schema complexity |
The Best of Both Worlds: Get Pyramid’s proven robustness, security, and flexibility with the convenience of automatic validation and documentation.
We welcome contributions! Please see our Contributing Guide for details.
This project is licensed under the MIT License - see the LICENSE file for details.