Skip to main content
Help us improve PyPI by participating in user testing. All experience levels needed!

Routes for speed

Project description

# Autoroutes

Routes for speed.

## Install

pip install autoroutes

## API

# Create a Routes instance
from autoroutes import Routes
routes = Routes()

# Register a new path
routes.connect('path/to/resource/{id}', something='value', anything='else')

# Try to match a path
> ({'something': 'value', 'anything': 'else'}, {'id': '1234'})

### Placeholders

Placeholders are defined by a curly brace pair: `path/{var}`. By default, this
will match any character but the slash ('/') (`[^/]+`).

It's possible to control the placeholder type, either by:
- using a named type: `w`/`word`, `i`/`int`, `*`/`path`, `s`/`string`:


- using a simple (optimizable) pattern: `\w+`, `[0-9a-z]+`, `[a-z0-9]+`,
`[a-z]+`, `\d+`, `[0-9]+`, `[^-]+`, `.+`


- using a normal regex (slower; also note that regex containing curly braces is
not yet supported)


Placeholders can appear anywhere in the path


## Building from source

pip install cython
make compile
python develop

## Tests

make test

## Benchmark


See [Benchmark]( for more

## Acknowledgements

This package has been first made as a Cython port of the [R3](
C router.
See also [python-r3](, which was a first
attempt to wrap R3. I was unhappy with the stability, and more curious about
Cython, so I tried to make a first POC port, and was happy with it.

Project details

Release history Release notifications

History Node


History Node


This version
History Node


History Node


History Node


Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
autoroutes-0.0.3.tar.gz (64.8 kB) Copy SHA256 hash SHA256 Source None Sep 13, 2017

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page