Build static sites with Python code instead of templates
Project description
Nitro CLI
A static site generator that lets you build websites using Python and nitro-ui.
Features
- Python-Powered - Write pages in Python with nitro-ui instead of template languages
- Live Reload - Development server with automatic browser refresh
- Incremental Builds – Only rebuild changed pages
- Dynamic Routes – Generate pages from data with
[slug].pypattern - Image Optimization – Responsive images with WebP/AVIF conversion
- Islands Architecture - Partial hydration for interactive components
- One-Click Deploy – Netlify, Vercel, or Cloudflare Pages
Installation
pip install nitro-cli
AI Assistant Integration
Add Nitro CLI knowledge to your AI coding assistant:
npx skills add nitrosh/nitro-cli
This enables AI assistants like Claude Code to understand Nitro CLI and generate correct nitro-ui code.
Quick Start
nitro new my-site
cd my-site
nitro dev
Visit http://localhost:3000. Build for production with nitro build.
Writing Pages
Pages are Python files in src/pages/ that export a render() function:
# src/pages/index.py
from nitro_ui import HTML, Head, Body, H1, Title
from nitro import Page
def render():
return Page(
title="Home",
content=HTML(
Head(Title("Home")),
Body(H1("Welcome!"))
)
)
Output paths mirror the file structure: src/pages/about.py → build/about.html
Dynamic Routes
Generate multiple pages from data using [param].py naming:
# src/pages/blog/[slug].py
from nitro import Page
from nitro_datastore import NitroDataStore
def get_paths():
data = NitroDataStore.from_file("src/data/posts.json")
return [{"slug": p["slug"], "title": p["title"]} for p in data.posts]
def render(slug, title):
return Page(title=title, content=...)
Commands
| Command | Description |
|---|---|
nitro new <name> |
Create new project |
nitro dev |
Start dev server with live reload |
nitro build |
Build for production |
nitro preview |
Preview production build |
nitro clean |
Remove build artifacts |
nitro deploy |
Deploy to hosting platform |
Run nitro <command> --help for options.
Configuration
# nitro.config.py
from nitro import Config
config = Config(
site_name="My Site",
base_url="https://mysite.com",
renderer={"minify_html": True}
)
Ecosystem
Nitro isn’t just one library – it’s a growing toolkit of focused building blocks you can mix and match to ship faster:
- nitro-ui - Generate clean, reusable HTML with a lightweight, developer-friendly API
- nitro-datastore - Load and access data effortlessly using simple dot-notation paths
- nitro-dispatch - A flexible plugin system to extend features without touching core code
- nitro-validate - Fast, reliable data validation to keep your inputs and payloads rock-solid
License
MIT
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file nitro_cli-1.0.0.tar.gz.
File metadata
- Download URL: nitro_cli-1.0.0.tar.gz
- Upload date:
- Size: 52.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6eb34e261f6cb67103bee24f38a31c921846817af1b58f83f4a712f271ca368a
|
|
| MD5 |
e7a24feb0a431d613d4e361ae776163c
|
|
| BLAKE2b-256 |
9bd75b44801d6cc69831b9ced8e888759beb6a13e004a195d187b124a2797d58
|
File details
Details for the file nitro_cli-1.0.0-py3-none-any.whl.
File metadata
- Download URL: nitro_cli-1.0.0-py3-none-any.whl
- Upload date:
- Size: 56.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c07da6dfc4099fee7d953a54f62322909dcb4af76f0a23f2429b78167fe9947c
|
|
| MD5 |
e0210ad61641eeb7f562684bd91de238
|
|
| BLAKE2b-256 |
d286e76537488a745a02a459f28555dd29c567a1caf144caf7659b98a4b99841
|