FastHTML CLI
Fastest way to scaffold FastHTML apps!
📦 Package Name Change: This package was previously named
fh-initbut has been renamed tofh-clifor consistency. Both commands (fh-cliandfh-init) work during the transition period. We recommend usingfh-cligoing forward.
Usage
To create a new FastHTML application, use the fh-cli command. Make sure uv is installed before running uvx:
uvx fh-cli [OPTIONS] NAME
Arguments
NAME: The name of your FastHTML application (required).
Options
--template, -tp TEXT: The name of the FastHTML template to use (default:base).--reload, -r: Enable live reload.--pico, -p: Enable Pico CSS (default:True).--uv / --no-uv: Use uv to manage project dependencies (default:uv).--tailwind, -t: Enable Tailwind CSS.--deps, -d TEXT: Space-separated list of Python dependencies to add (e.g.,pandas numpy requests).--gallery, -g TEXT: Use a FastHTML Gallery example (e.g.,todo_series/beginner). When used, other template options are ignored.--version: Show version and exit.--install-completion: Install tab completion for the current shell (run once to enable auto-completion).--show-completion: Show completion script to copy or customize the installation.--help: Show the help message and exit.
Examples
# Create a basic app
uvx fh-cli my_awesome_app
# Create an app with live reload and Tailwind CSS
uvx fh-cli my_awesome_app --reload --tailwind
# Create an app with additional Python dependencies
uvx fh-cli data_app --deps "pandas numpy matplotlib"
# Create an app from the FastHTML Gallery
uvx fh-cli my-todo --gallery todo_series/beginner
uvx fh-cli my-viz --gallery visualizations/observable_plot
Then to run the FastHTML app:
cd my_awesome_app
uv run main.py
Shell Completion
For a better CLI experience, you can enable tab completion:
# Install completion for your current shell (run once)
fh-cli --install-completion
# After installation, you can use tab completion
fh-cli <Tab> # Shows available commands and options
fh-cli --<Tab> # Shows all available flags
FastHTML Gallery Integration
Bootstrap your projects with real-world examples from the official FastHTML Gallery:
# Browse examples at https://gallery.fastht.ml/
# Use the format: category/example_name
# Todo applications
uvx fh-cli my-todo --gallery todo_series/beginner
# Data visualizations
uvx fh-cli my-charts --gallery visualizations/observable_plot
# Interactive applications
uvx fh-cli my-app --gallery applications/csv_editor
Gallery Features:
- Complete Examples: Get fully working FastHTML applications instantly
- Auto Dependencies: Required packages automatically added to
pyproject.toml - No Modifications: Gallery code copied exactly as-is for authentic examples
- Exclusive Mode: When using
--gallery, other template options (--tailwind,--deps, etc.) are ignored
Available Categories:
applications/- Full-featured apps (csv_editor, tic_tac_toe, etc.)todo_series/- Todo app examples of varying complexityvisualizations/- Data visualization exampleswidgets/- Reusable UI componentssvg/- SVG and graphics examplesdynamic_user_interface_(htmx)/- Advanced HTMX interactions
Development
Initial Setup
For first-time setup:
-
Activate the virtual environment:
source .venv/bin/activate
-
Install the CLI locally in editable mode:
uv pip install -e .
Quick Development Workflow
After making any changes to code or pyproject.toml:
-
In the CLI root folder, run:
source .venv/bin/activate && uv pip install -e . --force-reinstall && uv cache clean
-
Use the local development CLI from any other folder:
# Check version uvx --from <path-to-local-cli-folder> fh-cli --version # Create a test project uvx --from <path-to-local-cli-folder> fh-cli test-app
Troubleshooting
- If uvx shows old version after changes, the single update command above should resolve it
- The
--versionflag reads from package metadata to ensure version consistency withpyproject.toml
Switching Back to PyPI Version
After local development, you may want to return to using the official PyPI version:
-
Deactivate the development environment:
deactivate
-
Use the official PyPI version:
# This will automatically use the latest PyPI version uvx fh-cli --version uvx fh-cli my-app
Notes:
uvxautomatically isolates package environments, so your local development doesn't affect the global PyPI version- The
--from <path>flag in development only affects that specific command - Once you deactivate the virtual environment,
uvx fh-cliwill use the official PyPI package - No need to uninstall anything -
uvxhandles package isolation automatically
Metadata
Release files for fh-cli 0.1.6
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 |
|---|---|---|---|---|
| fh_cli-0.1.6.tar.gz | 12.6 kB | Without provenance | Details for fh_cli-0.1.6.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| fh_cli-0.1.6-py3-none-any.whl | Python 3 | none | any | Details for fh_cli-0.1.6-py3-none-any.whl |
Total release size: 23.6 kB
Release files / fh_cli-0.1.6.tar.gz
| Download URL | fh_cli-0.1.6.tar.gz |
|---|---|
| Size | 12.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6b5dc0b7312b1594354d66c0cd4e460b22eedd1505cf23aab3ac6fa639120cd3
|
|
BLAKE2b-256 checksum How to use checksums |
1f7b9fc628f488415012d02ecce7fa6c65842650280bbb4b0eb46681370d9d2b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.14
|
Release files / fh_cli-0.1.6-py3-none-any.whl
| Download URL | fh_cli-0.1.6-py3-none-any.whl |
|---|---|
| Size | 11.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b5c760e38b5581ccae7befac5ed2fb2d18a0bb2e9e8eac3b174aac6bc9b3df32
|
|
BLAKE2b-256 checksum How to use checksums |
fe9742e9cbd53b1ba2ea161dce24afdf4bfae833a45c872578188143cdf474d4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.14
|
Security for fh-cli 0.1.6
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.