This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

Tawdry is a Type Annotated Web framework which emphasizes Dont Repeat Yourself

More specifically, Tawdry is a “microframework” similar to flask or somewhat less similar to Pyramid or Django. It tries to get out of your way by requiring the absolute minimal amount of boilerplate or extra code of any kind.

Tawdry also aims to improve the clarity of the code you do write by centralizing and localizing the information about your server and its routes.

Example Application

import tawdry

def hello(request, publisher):
    return 'World!'

app = tawdry.Tawdry({'hello': hello})

if __name__ == '__main__':
    app.serve()

Once run, it will create a single route at /hello, on localhost by default.

$ curl localhost:5000/hello
World!

Installation

pip install tawdry

Requires Python 3 (and you’re best off with 3.5)

Type Annotations

The above example doesn’t really do much to show the purpose of Tawdry though. The whole point here is to use type annotations, as they are the mechanism through which Tawdry does its stuff! So lets look at a slightly more complex example.

import tawdry

def exclaim(request, exclamation: str) -> Response:
    return exclamation + '!'

sitemap = {
    'exclaim': {
        '{exclamation}': exclaim,
    },
}
app = tawdry.Tawdry(sitemap)

if __name__ == '__main__':
    app.serve()
$ curl localhost:5000/exclaim/wahhoooo
wahhoooo!

Of note in the above example:

  • An argument type annotation will convert the argument to the annotated type before calling the function.
  • A return type, type annotation will convert the function’s return value after it returns.
  • The sitemap is a dict given in the form where:
    • The values are the functions which will be called in the event of a match.
    • The keys match a url segment with the same string, so nested dictionaries result in matches to subsequent nested segments.
    • Any key enclosed in curly braces is given as a parameter to the function given as a value, as well as any parameters leading up to it.

So in the above example:

  1. the sitemap defines a single manifested route in the form /exclaim/{paramerer}.
  2. parameter will be converted (in this case unnecessarily) to a string before being passed to exclaim.
  3. The return value of exclaim will be converted to a Response object (note Response is applied by default, but other return types exist, such as JsonResponse and XmlResponse)
  4. The Response object is wsgi compatible and will return the result to the caller
Release History

Release History

0.0.2

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.0.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
tawdry-0.0.2.tar.gz (6.4 kB) Copy SHA256 Checksum SHA256 Source Sep 25, 2016

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting