GitHub - ZeroIntensity/view.py: The Batteries-Detachable Web Framework (original) (raw)

The Batteries-Detachable Web Framework

Tests Valgrind Build

Warning

view.py is currently in alpha, and may be lacking some features. If you would like to follow development progress, be sure to join the discord.

Features

See why I wrote it on the docs.

Examples

from view import new_app

app = new_app()

@app.get("/") async def index(): return await app.template("index.html", engine="jinja")

app.run()

routes/index.py

from view import get, HTML

Build TypeScript Frontend

@get(steps=["typescript"], cache_rate=1000) async def index(): return await HTML.from_file("dist/index.html")

from view import JSON, body, post

@post("/create") @body("name", str) @body("books", dict[str, str]) def create(name: str, books: dict[str, str]): # ... return JSON({"message": "Successfully created user!"}), 201

There's C code in here, how do I know it's safe?

view.py is put through rigorous testing, checked with Valgrind, and checks for memory leaks, thanks to Memray. See the testing badges at the top.

Installation

Python 3.8+ is required.

Development

$ pip install git+https://github.com/ZeroIntensity/view.py

PyPI

Pipx

view.py is distributed under the terms of the MIT license.