Molten: A modern Python (3.6+) web framework

Release v0.5.2. (Installation, Changelog, Discuss, Source Code)

molten is a minimal, extensible, fast and productive framework for
building HTTP APIs with Python.
Here’s a quick taste:
from molten import App, Route

def hello(name: str, age: int) -> str:
return f”Hi {name}! I hear you’re {age} years old.”

app = App(routes=[Route(“/hello/{name}/{age}”, hello)])

For more, take a look at the examples folder in the GitHub repo.

Here’s a selection of molten’s features that we’re most proud of.

Request Validation
molten can automatically validate requests according to predefined
schemas, ensuring that your handlers only ever run if given valid
from molten import App, Route, field, schema
from typing import Optional

class Todo:
id: Optional[int] = field(response_only=True)
description: str
status: str = field(choices=[“todo”, “done”], default=”todo”)

def create_todo(todo: Todo) -> Todo:
# Do something to store the todo here…
return todo

app = App(routes=[Route(“/todos”, create_todo, method=”POST”)])

Schemas are PEP484-compatible, which means mypy and molten go
hand-in-hand, making your code more easy to maintain. Schema
instances are automatically serializable and you can pick and
choose which

Original URL:

Original article

Comments are closed.

Proudly powered by WordPress | Theme: Baskerville 2 by Anders Noren.

Up ↑

%d bloggers like this: