fasthtml-tailwindcss
Tailwind CSS for FastHTML with a persistent compiler across server reloads and watch mode for automatic CSS rebuilds.
Installation
Install with uv:
uv add fasthtml-tailwindcss
Or with pip:
pip install fasthtml-tailwindcss
On Alpine Linux, the standalone compiler also requires the system C++ runtime:
apk add --no-cache libstdc++ libgcc
Usage
from fasthtml.common import Div, FastHTML
from fasthtml_tailwindcss import TailwindHead
app = FastHTML(hdrs=[TailwindHead(watch=True)])
@app.route("/")
def get():
return Div("Hello", cls="rounded-lg bg-blue-500 p-4 text-white")
Run your application normally, for example with uv run uvicorn main:app --reload. The package bundles the official standalone Tailwind compiler: no Node.js, npm, CDN, CSS endpoint or additional command is needed.
TailwindHead builds CSS when the component is constructed, usually while importing your application module, and waits for the first successful compilation. It embeds the result in a <style> element. Each full page receives the latest completed CSS. Refresh the browser to see updates; automatic browser refresh and updating styles during HTMX fragment swaps are not included.
watch=True: compile once, then watch source files. The compiler survives application reloads.watch=False(default): compile once with minification, then reuse the result across reloads. Source changes do not rebuild CSS during that session.
A local helper keeps the session alive while applications renew a shared heartbeat file, and shuts down 15 seconds after the last heartbeat. A quick manual restart is treated like a reload. A later start creates a fresh session and builds again. The session stays active while the component exists in a running Python process; it does not depend on ASGI lifespan.
Options
All configuration is passed to TailwindHead:
TailwindHead(
watch=True,
sources=["app"],
css="@theme { --color-brand: #7854f7; }",
)
For a custom input stylesheet:
TailwindHead(watch=True, input="assets/app.css")
sources: source files or directories. Defaults to the project directory with the built-in input; with a custom input, its own source detection is used unless extra sources are supplied.input: optional stylesheet replacing the built-in@import "tailwindcss". Relative CSS imports resolve from that file.css: optional inline CSS appended after the input. Useful for@theme, variants and explicit@source inline(...)declarations.
Paths are resolved relative to the nearest pyproject.toml above the working directory, or the working directory if none exists. Sessions are shared by project, configuration and OS user. Reloads and application workers with identical options reuse the same session. Changing options, including watch, starts a separate session immediately; the unused session shuts down after 15 seconds.
Tailwind scans complete class names in source files. Use "bg-red-500" rather than constructing names such as f"bg-{color}-500". Classes inside installed component libraries need explicit sources or safelisting.
Generated files and compiler diagnostics (compiler.log) live in the OS user cache under fasthtml-tailwindcss. Nothing is written into your application or installed package. Inline CSS requires an appropriate Content Security Policy if your application sets one.
Development
uv sync --group test
uv run --group test pytest
uv build
Wheel builds download and verify the matching official standalone executable. Wheels target Linux x64/ARM64 (glibc 2.28+ or musl 1.2+), macOS 13+ (Intel/Apple Silicon), and Windows x64. Source distributions contain the build hook and checksum manifest; building one requires network access unless the verified compiler is already present locally.
The package version follows Tailwind, with .postN for Python-only fixes. The release workflow checks upstream daily, tests the platform wheels and publishes through PyPI Trusted Publishing. Configure the publisher for SpaceShaman/fasthtml-tailwindcss, workflow release.yml, environment pypi; allow workflow version commits on the default branch.
Links
License
The wrapper and Tailwind CSS are MIT licensed. Both license notices are included in distributions.
Metadata
Release files for fasthtml-tailwindcss 4.3.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| fasthtml_tailwindcss-4.3.3.tar.gz | 11.5 kB | Without provenance | Details for fasthtml_tailwindcss-4.3.3.tar.gz |
Built distributions (wheels)
Total release size: 271.4 MB
Release files / fasthtml_tailwindcss-4.3.3.tar.gz
| Download URL | fasthtml_tailwindcss-4.3.3.tar.gz |
|---|---|
| Size | 11.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6ef539af5e9cee705dd0d051294ce02221846d8c8ebea3be6adf88a6ccae957b
|
|
BLAKE2b-256 checksum How to use checksums |
b15a6acf38055796eafef529a198fcf5b1cb275b796b5a7a92506af2b0ac520b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / fasthtml_tailwindcss-4.3.3-py3-none-win_amd64.whl
| Download URL | fasthtml_tailwindcss-4.3.3-py3-none-win_amd64.whl |
|---|---|
| Size | 43.4 MB |
| Tags | Python 3 Windows x86-64 |
|
SHA-256 checksum How to use checksums |
ef0076655ca0884f4b33a05ce5d1865bcf6aabb86f007982aa28f4547197c1ad
|
|
BLAKE2b-256 checksum How to use checksums |
7df19aacaaea3897671aa076fe2c14265ea358a05dbc7b95280b66192ff70b6c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / fasthtml_tailwindcss-4.3.3-py3-none-musllinux_1_2_x86_64.whl
| Download URL | fasthtml_tailwindcss-4.3.3-py3-none-musllinux_1_2_x86_64.whl |
|---|---|
| Size | 41.1 MB |
| Tags | Linux musl 1.2+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
b65c6d50299c62db8b31b49b3043e8346d6e7f43c329a8d7b464825f17f70976
|
|
BLAKE2b-256 checksum How to use checksums |
8b785d182db8fcdb7c5addb9ac82a1525ef207ba4e6ad268ca04b6868a03cd87
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / fasthtml_tailwindcss-4.3.3-py3-none-musllinux_1_2_aarch64.whl
| Download URL | fasthtml_tailwindcss-4.3.3-py3-none-musllinux_1_2_aarch64.whl |
|---|---|
| Size | 40.5 MB |
| Tags | Linux musl 1.2+ ARM64 Python 3 |
|
SHA-256 checksum How to use checksums |
e8f988dbccc15b62c2e3c208502fa10b6be50b3c70fac397d2e70467c6500ed8
|
|
BLAKE2b-256 checksum How to use checksums |
1ad7bcfe27cc5dd244045f4b57bf216e45045be1c3747a12ea37de5515792adc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / fasthtml_tailwindcss-4.3.3-py3-none-manylinux_2_28_x86_64.whl
| Download URL | fasthtml_tailwindcss-4.3.3-py3-none-manylinux_2_28_x86_64.whl |
|---|---|
| Size | 42.3 MB |
| Tags | Linux glibc 2.28+ x86-64 Python 3 |
|
SHA-256 checksum How to use checksums |
809e9edde69f6078255a50eae4907056cfe0a744317c83a47b6c896150f5c9ab
|
|
BLAKE2b-256 checksum How to use checksums |
782638155c0f4e98583fa0e0393f569ac99d8418096e7b61f485b9555e293eb6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / fasthtml_tailwindcss-4.3.3-py3-none-manylinux_2_28_aarch64.whl
| Download URL | fasthtml_tailwindcss-4.3.3-py3-none-manylinux_2_28_aarch64.whl |
|---|---|
| Size | 41.9 MB |
| Tags | Linux glibc 2.28+ ARM64 Python 3 |
|
SHA-256 checksum How to use checksums |
1c0764c16371a646fe6b7b967a080edc5ecfbccdc915c54425e715dad0f00131
|
|
BLAKE2b-256 checksum How to use checksums |
e237157887b83aaaad742484d7d1d97ba2a0fd8fe71e0e2afde2887e4ed1adf8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / fasthtml_tailwindcss-4.3.3-py3-none-macosx_13_0_x86_64.whl
| Download URL | fasthtml_tailwindcss-4.3.3-py3-none-macosx_13_0_x86_64.whl |
|---|---|
| Size | 31.9 MB |
| Tags | Python 3 macOS 13.0+ x86-64 |
|
SHA-256 checksum How to use checksums |
716eaa7f9efa937079e059eb1b27d16b081e9287f43ff637c31d072db3310fee
|
|
BLAKE2b-256 checksum How to use checksums |
677da3690f79cbe21fa37969f53d3df555da80ec2bc384deae1b94a2fb86c062
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / fasthtml_tailwindcss-4.3.3-py3-none-macosx_13_0_arm64.whl
| Download URL | fasthtml_tailwindcss-4.3.3-py3-none-macosx_13_0_arm64.whl |
|---|---|
| Size | 30.2 MB |
| Tags | Python 3 macOS 13.0+ ARM64 |
|
SHA-256 checksum How to use checksums |
0a9e89ceb9ec0490c084fa872c7305ad8ee91a19dfec1c218a729ea69ca2d88f
|
|
BLAKE2b-256 checksum How to use checksums |
08b889d4a0f5d6acc17e13124320eed36956823e6431150d584ac059130bfd05
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.13.5 {"installer":{"name":"uv","version":"0.13.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for fasthtml-tailwindcss 4.3.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.