Skip to main content

Routes for speed

Project description


Routes for speed.


pip install autoroutes


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

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

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


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: alnum, digit, alpha, path (matches everything), any (matches everything, including empty string), string (default):

      path/to/{var:string}  # Same as path/to/{var}
  • 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


make test


See Benchmark for more details.


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

Download files

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

Source Distribution

autoroutes-0.3.5.tar.gz (80.4 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page