pecan
A WSGI object-dispatching web framework, designed to be lean and fast, with few dependencies.
What it is and what it does
Pecan is a WSGI web framework that maps HTTP requests directly to Python object hierarchies, making URL structure mirror your application's class structure. Instead of defining routes as strings, you organize controller classes and methods that correspond to URL paths. It depends on WebOb for request/response handling and Mako for templating, keeping the dependency footprint small.
The framework is designed for developers who prefer explicit, object-oriented routing over convention-based or decorator-heavy approaches. It has been in production use since 2012 and maintains active development. The project supports modern Python versions and is suitable for building REST APIs, web services, and traditional web applications where you want direct control over URL-to-code mapping.
Use it for:
- Build REST APIs where URL structure naturally maps to resource hierarchies and controller classes.
- Create web services where explicit object dispatch is clearer than string-based routing patterns.
- Develop applications requiring minimal framework overhead and few external dependencies.
- Prototype or migrate from other WSGI frameworks while maintaining object-oriented design.
- Build admin interfaces or internal tools where object hierarchy routing simplifies code organization.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Pecan is a WSGI web framework that routes HTTP requests to Python objects based on URL structure, designed to be lightweight with minimal dependencies.
Yes, if you prefer object-oriented URL routing and want a lightweight WSGI framework with low dependency overhead. The permissive BSD license, active maintenance, and support for current Python versions (3.10–3.13) make it a solid choice. Not recommended if you need a large ecosystem of third-party extensions or prefer convention-over-configuration frameworks like Flask or Django.
Install
pecan on PyPI
pip
pip install pecanuv
uv add pecanpoetry
poetry add pecanInstalling pecan
Before you install
Low install friction with only three runtime dependencies (WebOb, Mako, setuptools). The package is actively maintained with a recent commit on 2026-03-12 and supports current Python versions (3.10 through 3.13).
License in practice
BSD license is permissive, allowing use in commercial and proprietary projects with minimal restrictions beyond attribution.
Quickstart
pip install pecan
from pecan import App, expose
class RootController:
@expose()
def index(self):
return 'Hello, World!'
app = App(RootController())
Requires Python 3.10 or later.
Verify before relying
- Whether Pecan's object-dispatch model is suitable for your routing needs compared to path-based routing frameworks.
- Performance characteristics and scalability limits for production deployments.
- Community size and availability of third-party extensions or middleware.
Package facts
| License | BSD (permissive) |
| Python support | supports the current Python release (>=3.10) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 3 — WebOb, Mako, setuptools |
| Maintenance | actively maintained — 155 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 182,446/month — #10,098 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: pecan-1.8.0-py3-none-any.whl
Keywords: web, framework, wsgi, object-dispatch, http
Tags
More Application Frameworks packages
FastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
textualTextual is a Python framework for building…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
mcpBuild and connect to Model Context Protocol…
permissive · top 1,000 on PyPI
WerkzeugWerkzeug is a WSGI utility library providing…
permissive · top 1,000 on PyPI
bottleBottle is a lightweight WSGI microframework for…
permissive · top 5,000 on PyPI
appierAppier is a lightweight Python web framework…
permissive · top 5,000 on PyPI
FlaskFlask is a lightweight WSGI web application…
permissive · top 1,000 on PyPI
toolA compact modular framework for building WSGI…
copyleft · top 15,000 on PyPI
webapp2A lightweight Python web framework designed for…
permissive · top 15,000 on PyPI
pyramidPyramid is a Python web framework for building…
permissive · top 5,000 on PyPI
HypercornHypercorn is an ASGI and WSGI web server…
permissive · top 5,000 on PyPI
CherryPyCherryPy is an object-oriented HTTP framework…
permissive · top 5,000 on PyPI
dulwichDulwich provides pure Python access to Git…
unclear · top 1,000 on PyPI