most Python web frameworks i’ve tried feel like they are built for web dev 10 years ago, everything is very backend heavy packed with features, most come with templating engines and are overkill - the last time I built a web server that actually served HTML was a long time ago…

I wanted something that is minimal and built from the ground up to create an API, so I came up with PyAPI. (git) (docs)

Framework Features References to ‘html’ (lower is better)
flask some (~10) 73
django a load (~50) 849
bottle a couple (~20) 85
pyramid not many (~5) 231
pyapi practically none (1-2) 5

(note: feature count is accurate to +-50)

PyAPI uses the Werkzeug utility library as a base (the same library that Flask uses). It is designed to be minimal and extensible, with more advanced features available through extensions.

core values of PyAPI:

  • JSON responses - others are possible, but JSON is first class
  • Middleware syntax that makes sense - (wtf Flask, Pyramid and Bottle - so weird, Django is on point for this)
  • TOML for config - its awesome
  • Explicit patterns - should always be obvious whats going on
  • Minimal core features - extensions can do anything
  • Adhere to standards - (wherever possible)

minimal app

from pyapi import PyAPI

app = PyAPI()

@app.route("GET", "/hello")
def hello_world():
    return {"Hello": "world!"}