Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

tomb_routes

https://img.shields.io/pypi/v/tomb_routes.svg https://img.shields.io/travis/tomborine/tomb_routes.svg https://coveralls.io/repos/tomborine/tomb_routes/badge.png?branch=master

Intro

A set of simple defaults for Pyramid routing.

Pyramid’s URL dispatch has separate concepts for routes and views. This gives additional flexibility in that you can one route map to multiple views, using different predicates (e.g.: predicates depending on Accept header, whether request is XHR or not, etc.). In many applications, this flexibility is not needed and having both routes and views adds a bit of complexity and duplication, and reduces DRYness. This module implements some easy-to-use mechanisms that create a route and a view in one step, resulting in simpler, easier to understand code. This kind of makes Pyramid’s routing look a bit more like Flask, albeit without Flask’s controversial thread locals.

You can use simple_route as a decorator:

from tomb_routes import simple_route
from pyramid.response import Response

@simple_route('/hello/{name}')
def my_route(request, name):
    return Response('Hello %s' % name)

or you can use it from the configurator:

config.include('tomb_routes')
config.add_simple_route(
    '/hello/{name}', view_callable,
    renderer='json'
)

Inspirations

Frameworks with very simple routing (including so-called “microframeworks”) are nothing new. Here are a few in the Python world:

Pyramid is a very powerful and extensible web framework and it’s a framework that we love, but sometimes we want very simple routing. This package brings the simplified routing from microframeworks to Pyramid, so we can have our cake and eat it too.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tomb_routes-0.0.8.dev1.tar.gz (6.9 kB view details)

Uploaded Source

File details

Details for the file tomb_routes-0.0.8.dev1.tar.gz.

File metadata

File hashes

Hashes for tomb_routes-0.0.8.dev1.tar.gz
Algorithm Hash digest
SHA256 c7e18b681c54909fb140e94e102accff3153da845fb7dac16e2e9aad4f433cae
MD5 8d456a5b04a7469bc399de00ab231551
BLAKE2b-256 aaadaf3b516c66fb6689b8d43ac7ee2e8cb780afc5cf53ea7e90a30502730a49

See more details on using hashes here.

Release history Release notifications | RSS feed

0.0.8

1 file

This release

0.0.8.dev1 This release

1 file

0.0.7

1 file

0.0.6

1 file

0.0.5

1 file

0.0.4

1 file

0.0.2

1 file

0.0.1

1 file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page