Nitro CLI
A static site generator that lets you build websites using Python and nitro-ui.
Installation
pip install nitro-cli
AI Assistant Integration
Add Nitro CLI knowledge to your AI coding assistant:
npx skills add nitro-sh/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, Title, Meta, H1
from nitro import Page
def render():
return Page(
title="Home",
content=HTML(
Head(
Meta(charset="UTF-8"),
Meta(name="viewport", content="width=device-width, initial-scale=1.0"),
Title("Home"),
),
Body(H1("Welcome!"))
)
)
Output paths mirror the file structure: src/pages/about.py → build/about.html
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 - Draft Pages - Mark pages as drafts to exclude from production builds
- Environment Variables - Auto-load
.envfiles withfrom nitro import env - Image Optimization - Responsive images with WebP/AVIF conversion
- Islands Architecture - Partial hydration for interactive components
- Plugin System - Extend the build lifecycle with nitro-dispatch hooks
- One-Click Deploy - Netlify, Vercel, or Cloudflare Pages
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 init |
Initialize Nitro in current dir |
nitro dev |
Start dev server with live reload |
nitro build |
Build for production |
nitro preview |
Preview production build |
nitro routes |
List all routes |
nitro check |
Validate site without building |
nitro export |
Export site as zip archive |
nitro clean |
Remove build artifacts |
nitro deploy |
Deploy to hosting platform |
nitro info |
Show project and environment info |
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},
plugins=[],
)
Ecosystem
- nitro-ui - Build HTML with Python, not strings
- nitro-datastore - Schema-free JSON data store with dot notation access
- nitro-dispatch - Framework-agnostic plugin system
- nitro-image - Fast, friendly image processing for the web
- nitro-validate - Dependency-free data validation
License
This project is licensed under the BSD 3-Clause License. See the LICENSE file for details.
Metadata
Release files for nitro-cli 1.0.18
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 |
|---|---|---|---|---|
| nitro_cli-1.0.18.tar.gz | 83.4 kB | Without provenance | Details for nitro_cli-1.0.18.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| nitro_cli-1.0.18-py3-none-any.whl | Python 3 | none | any | Details for nitro_cli-1.0.18-py3-none-any.whl |
Total release size: 157.9 kB
Release files / nitro_cli-1.0.18.tar.gz
| Download URL | nitro_cli-1.0.18.tar.gz |
|---|---|
| Size | 83.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
12289aa577f5bf7e174e24a1a4c6a4f02bf3957504e4de368d2409ad08aebf6e
|
|
BLAKE2b-256 checksum How to use checksums |
e913530f1ecdac6d0e995be9d921f687887554d3ba875b0610bdba1fd5676da8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Release files / nitro_cli-1.0.18-py3-none-any.whl
| Download URL | nitro_cli-1.0.18-py3-none-any.whl |
|---|---|
| Size | 74.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b61de904b2f9957219de22d1ff85b5522996cedae7615c9fc4231ee47336160d
|
|
BLAKE2b-256 checksum How to use checksums |
ef4df32503ca568b2517b3d4eb45a2956ca323ac3cde51b359311bbabb114416
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Security for nitro-cli 1.0.18
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.