The new web framework that breathes fresh air into Python web development. Built with FastAPI, Starlette, and Pydantic.
Project description
Air
The new web framework that breathes fresh air into Python web development. Built with FastAPI, Starlette, and Pydantic.
[!CAUTION] Air is currently in an alpha state. While breaking changes are becoming less common, nevertheless, anything and everything could change.
We ask that you hold off on contributing mostly for now, to give us space to focus on getting our ideas down. If you happen to fix a bug, though, little PRs for that are welcome.
Why use Air?
- Powered by FastAPI - Designed to work with FastAPI so you can server your API and web pages from one app
- Fast to code - Tons of intuitive shortcuts and optimizations designed to expedite coding HTML with FastAPI
- Air Tags - Easy to write and performant HTML content generation using Python classes to render HTML
- Jinja Friendly - No need to write
response_class=HtmlResponse
andtemplates.TemplateResponse
for every HTML view - Mix Jinja and Air Tags - Jinja and Air Tags both are first class citizens. Use either or both in the same view!
- HTMX friendly - We love HTMX and provide utilities to use it with Air
- HTML form validation powered by pydantic - We love using pydantic to validate incoming data. Air Forms provide two ways to use pydantic with HTML forms (dependency injection or from within views)
- Easy to learn yet well documented - Hopefully Air is so intuitive and well-typed you'll barely need to use the documentation. In case you do need to look something up we're taking our experience writing technical books and using it to make documentation worth boasting about
Documentation: https://feldroy.github.io/air/
Source Code: https://github.com/feldroy/air
Installation
Install using pip install -U air
or conda install air -c conda-forge
.
For uv
users, just create a virtualenv and install the air package, like:
uv venv
source .venv/bin/activate
uv add air
uv add fastapi[standard]
A Simple Example
Create a main.py
with:
import air
app = air.Air()
@app.get("/")
async def index():
return air.Html(air.H1("Hello, world!", style="color: blue;"))
[!NOTE]
This example uses Air Tags, which are Python classes that render as HTML. Air Tags are typed and documented, designed to work well with any code completion tool.
Example using Jinja2
from air import Jinja2Renderer
jinja = Jinja2Renderer(directory="templates")
@app.get("/test")
def index(request: Request):
return jinja(
request,
name="home.html",
context={"title": "Hello World Page"}, content="Hello, World",
)
Contributing
For guidance on setting up a development environment and how to make a contribution to Air, see Contributing to Air.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file air-0.12.0.tar.gz
.
File metadata
- Download URL: air-0.12.0.tar.gz
- Upload date:
- Size: 24.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
e77970c2850592789318f7544ebf4eba5e7676f593684e9421b184008b5239cf
|
|
MD5 |
687fb77b2e4af06e139ed90732c72308
|
|
BLAKE2b-256 |
ed20319c58ec5c78d4676b00d4b30f65bc7f5e2f22854229b6b6aff9ae3fdb35
|
File details
Details for the file air-0.12.0-py3-none-any.whl
.
File metadata
- Download URL: air-0.12.0-py3-none-any.whl
- Upload date:
- Size: 19.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.7.20
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
9ab49b2ffe1467a099c6cee9200b1b5821c0e3e34a1b33125a2e06237624acbc
|
|
MD5 |
a8d6c0fdb58f8ae8bfe364b141bf9822
|
|
BLAKE2b-256 |
3ed807ab86488be064d3f76562988a98c357dae2c6772c386214939197b1f385
|