--- id: cornice version: "6.1.0" license: This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. license_treatment: copyleft maintenance: active --- # cornice — Define Web Services in Pyramid. License: copyleft · Maintenance: active · Downloads: 142.7K/mo ## What it is and what it does Cornice is a set of helpers built on top of Pyramid that simplifies defining REST web services. It provides decorators to attach HTTP methods to service endpoints, built-in validation and error handling, and tools to generate API documentation. The package is designed for developers who want to build web services within the Pyramid framework without writing boilerplate routing and validation code. Typically used by adding service definitions with decorators that specify HTTP methods, paths, and request/response schemas. Cornice handles the routing integration with Pyramid and provides utilities for common REST patterns like content negotiation and error responses. It depends only on Pyramid as a runtime dependency, making it lightweight to add to an existing Pyramid project. Use it for: - Build REST APIs with Pyramid using declarative service decorators instead of manual routing configuration. - Add automatic request validation and error handling to Pyramid endpoints without custom middleware. - Generate API documentation from service definitions and docstrings for client developers. - Define content-negotiated endpoints that serve different response formats based on client Accept headers. - Implement standardized HTTP error responses and status codes across multiple service endpoints. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Cornice provides decorators and utilities to build REST web services on top of Pyramid, with built-in support for request validation, error handling, and API documentation. Yes, if you are building REST services with Pyramid. Cornice is actively maintained, has no known vulnerabilities, and significantly reduces boilerplate for service definition and validation. The copyleft license is a consideration only if you plan proprietary use. Low install friction and a single dependency make it a practical addition to Pyramid projects. ## Install pip install cornice uv add cornice poetry add cornice ## Installing cornice Before you install: Low install friction with a single runtime dependency on pyramid. The project is actively maintained with recent commits and has been stable since its first release in 2011, indicating mature, well-tested code. License in practice: Licensed under Mozilla Public License 2.0 (copyleft), which requires derivative works to disclose source code and license under the same terms. Suitable for open-source projects but may constrain proprietary use. Quickstart: pip install cornice from cornice import Service hello = Service(name='hello', path='/hello', description='A hello service') @hello.get() def get_hello(request): return {'hello': 'world'} Requires Pyramid to be installed and configured; Cornice is an extension layer, not a standalone framework. Verify before relying: - Whether the package supports modern Python versions beyond what the fact sheet specifies. - The scope and maturity of built-in API documentation features compared to alternatives. ## Package facts - License: This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. (copyleft) - Python support: unspecified - Install friction: low - Maintenance: active - Downloads: 142.7K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags REST API framework pyramid, web service decorators, pyramid request validation, API documentation generation, REST endpoint helpers, pyramid web services, HTTP service building, rest-api, pyramid-extension, web-framework [View on SkillFed](https://skillfed.io/packages/cornice) · [View on PyPI](https://pypi.org/project/cornice/)