Skip to main content

routr – lightweight request routing for WebOb

Just a small example:

from routr import route, GET, POST
from routr.schema import form, String

def create_user(username=None):
  ...

def get_user(id):
  ...

routes = route("/users",
  route(POST, "/",          form(username=String), create_user),
  route(GET,  "/{id:int}",  get_user)
  )

Docs are hosted at excellent readthedocs project.

0.6.2

  • Trace.annotation(name, default=None) method to retrieve annotation from routes.

0.6.1

  • routr.static.static accepts annotations

  • routr.static.static returns Response subclass’ object

0.6

  • schema validation and doc generation moved to separate packages

0.5.1

  • fix bug with trace.args/kwargs updates

0.5

  • use schemify for schema validation

  • remove routr.schema completely

  • remove routr.schema2 – qs and form guards are now can be imported directly from routr module

0.4.2

  • routr.schema2: opt now can provide default value

  • routr.schema2: allow namedtuple-based schemas

0.4.1

  • HTTP methods constants now can be used to define routes

0.4

  • allow setting custom class for URL matching – use url_pattern_cls keyword argument for route directive

  • lightweight schema validation package routr.schema2

0.3.4

  • URL pattern type str now has re arg – allows to validate string via regexp

0.3.3

  • fix url pattern matching for labels with numbers, like /{id1}

0.3.2

  • routr.static.static routes now can be distinguished via static_view annotation instead of view attribute (still here for backward compatibility)

0.3.1

  • fix routr.static behaviour

0.3

  • get rid of Configuration, now route is just a plain function – this allows better composability w/o requirement to share configuration object between different parts of the app

  • add routr.static for serving static files

  • add routr.utils.positional_args for introspection of positional arguments of different types of objects and routr.utils.inject_args for injecting positional arguments based on introspection

0.2.1

  • bugfixes to DSL

0.2

  • [not backward compatible] new DSL – got rid of guards keyword argument which is too noisy

0.1.7

  • [bugfix] incorrect reversal of urls with more than one param

0.1.6

  • [bugfix] fix bug with RouteGuarded poped up in RouteGroup match

  • add ‘_’ to allowed args in URLPattern

0.1.5

  • introduced RequestParams.exception_factory which abstracts away HTTPBadRequest raise in case of invalid data being supplied

  • [bugfix] RouteGuarded.response now installed correctly, previously it sometimes contained NoUrlMatched objects which are not responses

0.1.4

  • RequestParams.post_processor now also can be accumulated via addition

  • fix bug in RequestParams which prevented Option wrap SchemaNode objects directly

0.1.3

  • fix broken 0.1.2 release by including CHANGES file in dist

0.1.2

  • trace factory made configurable via Configuration.trace attribute

  • method and PATH_INFO extraction delegated to configuration, allows implementing routing for other request wrapper (werkzeug or django’s request for example)

  • routes now have access to configuration object via cfg attribute

0.1.1

  • allow guards return None (routing doesn’t break on this and proceed with old trace)

  • RequestParams now can accept colander.SchemaNode directly (allows to supply validators)

0.1

  • initial release

Metadata

Release files for routr 0.6.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for routr 0.6.2
File Size Uploaded Provenance Actions
routr-0.6.2.tar.gz 14.1 kB Without provenance Details for routr-0.6.2.tar.gz

Release files / routr-0.6.2.tar.gz

Download URL routr-0.6.2.tar.gz
Size 14.1 kB
Tags Source
SHA-256 checksum
How to use checksums
3cf7f70c157761689bff63a926e3430eb579833552cdf3e8b8ebb3934919d1f6
BLAKE2b-256 checksum
How to use checksums
96d0d547473cfba618596c09d2da68803bb15db5d9c6dd8279194d4864a6a345
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for routr 0.6.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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