Skip to content

Instantly share code, notes, and snippets.

View pydanny's full-sized avatar

Daniel Roy Greenfeld pydanny

View GitHub Profile

This design follows FastAPI best practices:

import asyncpg
from contextlib import asynccontextmanager
from typing import Callable
from os import getenv # convert to pydantic_settings

import air
from typing import AsyncIterator
import asyncpg
from ..applications import Air
from contextlib import asynccontextmanager
from typing import Callable
from os import getenv
DATABASE_URL = getenv('DATABASE_URL')

Air Tags

Air Tags, sometimes shortened to Tags, are Python classes that render HTML. They can be combined to render web pages or small components. Air Tags are typed and documented, working well with any code completion tool. They are designed to be an easy to write and performant HTML content generation system using Python classes to render HTML.

!!! Note This document covers how Air Tags work. The full reference for them is the Air Tags reference.

How Air Tags work

Used individually or combined into a greater whole, every Air Tag includes a render() method. When the render() method is called it returns a HTML representation of the Air Tag, as well as all the children of the Air Tag.

/* Bonkers CSS Framework - Semantic HTML with style */
:root {
/* Light mode colors */
--bg-primary: #fafafa;
--bg-secondary: #ffffff;
--bg-tertiary: #f0f0f5;
--text-primary: #1a1a2e;
--text-secondary: #4a4a68;

ROADMAP

I'm really proud of what we've accomplished with Air. In a few short months we've taken a sketch of an idea and built out a new web framework that is both new and exciting, yet able to plug effortlessly into the FastAPI ecosystem.

Through our own experiences and feedback from users we can say the following is working out quite well:

  • Air Tags are really popular and most people enjoy the API. That it plugs so well into IDEs and LLMs is a super power.
  • AirResponse makes writing views powered by Jinja or Air Tags easy and fast
  • Examples in all the doc strings makes it much easier for both humans and LLMs
  • Jinja + Air Tags base templates for layout and Air Tags for content is a really sweet pattern we should talk about more
@pydanny
pydanny / main.py
Last active August 1, 2025 07:30
Air+FastAPI
# Dependency: air and "fastapi[standard]""
#
import air
from fastapi import FastAPI
app = air.Air()
api = FastAPI()
@app.page
@pydanny
pydanny / not-nulls.ipynb
Last active December 28, 2024 00:24
fasthtml/not-nulls.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pydanny
pydanny / check bools.ipynb
Created December 28, 2024 00:10
fasthtml/check bools.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pydanny
pydanny / check bools.ipynb
Created December 28, 2024 00:03
fasthtml/check-bools.ipynb
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@pydanny
pydanny / install-notes.md
Last active October 3, 2024 12:51
New mac installation

Terminal first!

  1. Try to avoid downloading anything directly. Rather, use homebrew, uv, and gh cli to install everything.
  2. At the end of each install, add the items suggested for going into the .zshrc

Install homebrew

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"