Python static site generator for documentation, blogs, and product sites
Project description
ᓚᘏᗢ Bengal
A Python static site generator for documentation, blogs, and product sites
pip install bengal
bengal new site mysite && cd mysite && bengal serve
What is Bengal?
Bengal is a Python static site generator for documentation sites, blogs, knowledge bases, and product sites. It focuses on fast builds, strong defaults, and discovery-friendly output: sitemaps, feeds, canonical URLs, Open Graph tags, social cards, search indexes, and JSON/LLM exports.
Why people pick it:
- Search-friendly output — Sitemap, RSS, canonical URLs, Open Graph tags, social cards, Content Signals
- Fast builds — Parallel builds, incremental rebuilds, Zstandard-compressed caching
- Modern Python — Python 3.14+ with free-threading support, fully typed
- Content workflows — Native Jupyter
.ipynbrendering, Binder/Colab links - Batteries included — Auto-generated API docs, content validation, site analysis
- Extensible — Pluggable engines for templates, Markdown, and syntax highlighting
Use Bengal For
- Documentation sites — Versioned docs, API reference, search, and internal linking
- Blogs and journals — Tags, categories, feeds, related content, and social sharing
- Knowledge bases — Markdown-first publishing with validation and JSON search indexes
- Product and marketing sites — Landing pages, content collections, and social cards
Quick Commands
| Command | Description |
|---|---|
bengal build |
Production build |
bengal serve |
Dev server with live reload |
bengal validate |
Health checks and validation |
bengal fix |
Auto-fix common issues |
bengal graph report |
Site structure analysis |
Aliases: b (build), s (serve), v (validate)
Site Scaffolding
Interactive Wizard — Guided setup with presets
Run without arguments for a guided experience:
bengal new site
The wizard prompts for site name, base URL, and presents preset options:
🎯 What kind of site are you building?
📝 Blog - Personal or professional blog
📚 Documentation - Technical docs or guides
💼 Portfolio - Showcase your work
🛒 Product - Product site with listings and features
📄 Resume - Professional resume/CV site
📦 Blank - Empty site, no initial structure
⚙️ Custom - Define your own structure
Each preset creates a complete site with appropriate sections, sample content, and configuration.
Direct Template Selection — Skip prompts with explicit options
Create sites non-interactively with --template:
bengal new site my-docs --template docs
bengal new site my-blog --template blog
bengal new site portfolio --template portfolio
Available templates:
| Template | Description | Sections Created |
|---|---|---|
default |
Basic site structure | Home page only |
blog |
Personal/professional blog | blog, about |
docs |
Technical documentation | getting-started, guides, reference |
portfolio |
Showcase work | about, projects, blog, contact |
product |
Product site with listings | products, features, pricing, contact |
resume |
Professional CV | Single resume page |
landing |
Single-page landing | Home, privacy, terms |
changelog |
Release notes timeline | Changelog with versions |
Add Sections to Existing Sites — Expand without recreating
Add new content sections to an existing Bengal site:
# Add multiple sections
bengal init --sections docs --sections tutorials
# Add sections with sample content
bengal init --sections blog --with-content --pages-per-section 5
# Preview without creating files
bengal init --sections api --dry-run
Section type inference:
| Name Pattern | Inferred Type | Behavior |
|---|---|---|
| blog, posts, articles, news | blog |
Date-sorted, post-style |
| docs, documentation, guides, tutorials | doc |
Weight-sorted, doc-style |
| projects, portfolio | section |
Standard section |
| about, contact | section |
Standard section |
Custom Skeleton Manifests — YAML-defined site structures
For complex or repeatable scaffolding, define structures in YAML manifests:
# Preview what would be created
bengal project skeleton apply my-structure.yaml --dry-run
# Apply the skeleton
bengal project skeleton apply my-structure.yaml
# Overwrite existing files
bengal project skeleton apply my-structure.yaml --force
Example manifest (docs-skeleton.yaml):
name: Documentation Site
description: Technical docs with navigation sections
version: "1.0"
cascade:
type: doc # Applied to all pages
structure:
- path: _index.md
props:
title: Documentation
description: Project documentation
weight: 100
content: |
# Documentation
Welcome! Start with our [Quick Start](getting-started/quickstart/).
- path: getting-started/_index.md
props:
title: Getting Started
weight: 10
cascade:
type: doc
pages:
- path: installation.md
props:
title: Installation
weight: 20
content: |
# Installation
```bash
pip install your-package
```
- path: quickstart.md
props:
title: Quick Start
weight: 30
content: |
# Quick Start
Your first project in 5 minutes.
- path: api/_index.md
props:
title: API Reference
weight: 30
content: |
# API Reference
Complete API documentation.
Component Model:
path— File or directory pathtype— Component identity (blog, doc, landing)variant— Visual style variantprops— Frontmatter data (title, weight, etc.)content— Markdown body contentpages— Child components (makes this a section)cascade— Values inherited by all descendants
Features
| Feature | Description | Docs |
|---|---|---|
| SEO & Discovery | Sitemap, RSS, canonical URLs, Open Graph, social cards, search, JSON/LLM output, llms.txt, Content Signals | SEO & Discovery → |
| Directives | Tabs, admonitions, cards, dropdowns, code blocks | Content → |
| Notebooks | Native Jupyter .ipynb rendering, Binder/Colab links |
Notebooks → |
| Autodoc | Generate API docs from Python, CLI, OpenAPI | Autodoc → |
| Remote Sources | Pull content from GitHub, Notion, REST APIs | Sources → |
| Image Processing | Resize, crop, format conversion (WebP/AVIF), srcset generation | Images → |
| Content Collections | Type-safe frontmatter with dataclass/Pydantic schemas | Collections → |
| Theming | Dark mode, responsive, syntax highlighting, search | Theming → |
| Validation | Health checks, broken link detection, auto-fix | Building → |
| Performance | Parallel builds, incremental rebuilds, streaming | Large Sites → |
| Zero-Config Deploy | Auto-detects GitHub Pages, Netlify, Vercel | Deployment → |
📚 Full documentation: lbliii.github.io/bengal
Configuration
Single-file — Simple projects
# bengal.toml
[site]
title = "My Site"
baseurl = "https://example.com"
Directory-based — Multi-environment projects
config/
├── _default/ # Base configuration
│ ├── site.yaml
│ └── build.yaml
├── environments/ # Environment overrides
│ └── production.yaml
└── profiles/ # Build profiles
└── dev.yaml
bengal build -e production # Production environment
bengal build --profile dev # Development profile
📖 Configuration guide: Configuration →
Project Structure
mysite/
├── content/ # Markdown pages
├── templates/ # Custom templates (optional)
├── assets/ # Static files (CSS, JS, images)
├── data/ # YAML/JSON data files
├── config/ # Configuration directory
└── public/ # Build output
Theming
Bengal ships with a modern, accessible default theme:
- Dark mode with system preference detection
- Responsive design with mobile navigation
- Syntax highlighting with copy buttons
- Table of contents with scroll spy
- Full-text search (Lunr.js)
Customize templates:
{# templates/page.html #}
{% extends "base.html" %}
{% block content %}
<article class="prose">
<h1>{{ page.title }}</h1>
{{ content | safe }}
</article>
{% endblock %}
Pluggable Engines
Bengal follows a "bring your own" pattern — swap engines without changing your content.
Template Engine
| Engine | Description | Install |
|---|---|---|
| Kida | Bengal's native engine. AST-native, free-threading safe, Jinja2-compatible syntax | Built-in |
Kida is the built-in template engine. It uses Jinja2-compatible syntax, so existing Jinja2 templates generally work without changes. See the Kida migration guide if migrating from Jinja2.
Markdown Parsers
| Parser | Description | Install |
|---|---|---|
| Patitas (default) | Bengal's native parser. Typed AST, O(n) parsing, thread-safe | Built-in |
| Mistune | Fast, modern parser | Built-in |
| Python-Markdown | Full-featured, extensive extensions | Built-in |
# config/_default/content.yaml
markdown:
parser: patitas # default, or mistune (legacy), python-markdown
Syntax Highlighters
| Backend | Description | Install |
|---|---|---|
| Rosettes (default) | Lock-free, 55+ languages, O(n) guaranteed | pip install rosettes |
# config/_default/theme.yaml
highlighting:
backend: rosettes
Custom backends can be registered via register_backend().
Requirements
- Python 3.14+ (uses free-threading and PEP 784 compression)
- Linux, macOS, Windows
Philosophy
Bengal prioritizes correctness and clarity over backwards compatibility.
Each release represents the best solution we know how to deliver. When existing behavior no longer reflects the best design, it changes. Upgrades may require reading release notes and making adjustments.
- Fail loudly — Breaking changes produce clear errors
- User control — You choose when to upgrade; we choose what changes
- No hidden layers — No compatibility shims or deprecated code paths
If you need multi-year stability, pin your version.
Documentation
Development
git clone https://github.com/lbliii/bengal.git
cd bengal
uv sync --group dev
pytest
Multi-repo workspace: With bengal, patitas, rosettes, etc. as siblings, copy workspace-root.example/pyproject.toml to the parent directory and run uv sync from there. The workspace root overrides sources so all packages use local versions. CI and end users (no workspace root) use PyPI.
The Bengal Ecosystem
A structured reactive stack — every layer written in pure Python for 3.14t free-threading.
| ᓚᘏᗢ | Bengal | Static site generator ← You are here | Docs |
| ∿∿ | Purr | Content runtime | — |
| ⌁⌁ | Chirp | Web framework | Docs |
| =^..^= | Pounce | ASGI server | Docs |
| )彡 | Kida | Template engine | Docs |
| ฅᨐฅ | Patitas | Markdown parser | Docs |
| ⌾⌾⌾ | Rosettes | Syntax highlighter | Docs |
Python-native. Free-threading ready. No npm required.
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 bengal-0.2.6.tar.gz.
File metadata
- Download URL: bengal-0.2.6.tar.gz
- Upload date:
- Size: 3.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
549b2bbd9ec2ab76d29c6f7be1f50ee64a901101dd2ee5e55d75168917c70e4f
|
|
| MD5 |
ccc8944893ef276acb622de7ef1b45a5
|
|
| BLAKE2b-256 |
3c78bcb8fdd49a70c1fc3ff2cddd81ffee13033b40858cc3861d3794f1de052e
|
Provenance
The following attestation bundles were made for bengal-0.2.6.tar.gz:
Publisher:
python-publish.yml on lbliii/bengal
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bengal-0.2.6.tar.gz -
Subject digest:
549b2bbd9ec2ab76d29c6f7be1f50ee64a901101dd2ee5e55d75168917c70e4f - Sigstore transparency entry: 1134830042
- Sigstore integration time:
-
Permalink:
lbliii/bengal@220e7282de6422353c81125ae4bbb4fb67510950 -
Branch / Tag:
refs/tags/v0.2.6 - Owner: https://github.com/lbliii
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@220e7282de6422353c81125ae4bbb4fb67510950 -
Trigger Event:
release
-
Statement type:
File details
Details for the file bengal-0.2.6-py3-none-any.whl.
File metadata
- Download URL: bengal-0.2.6-py3-none-any.whl
- Upload date:
- Size: 3.9 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
824b0d511d925babf5b1b99aec5889da6d245665fcf81f289a7bd80d2c188205
|
|
| MD5 |
66f8ede966012bae4cb9bc386a5e1c16
|
|
| BLAKE2b-256 |
236db64f8baaf356fd9900a548f6dc449abd700a66d28fe9d9a29759270c602f
|
Provenance
The following attestation bundles were made for bengal-0.2.6-py3-none-any.whl:
Publisher:
python-publish.yml on lbliii/bengal
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
bengal-0.2.6-py3-none-any.whl -
Subject digest:
824b0d511d925babf5b1b99aec5889da6d245665fcf81f289a7bd80d2c188205 - Sigstore transparency entry: 1134830066
- Sigstore integration time:
-
Permalink:
lbliii/bengal@220e7282de6422353c81125ae4bbb4fb67510950 -
Branch / Tag:
refs/tags/v0.2.6 - Owner: https://github.com/lbliii
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-publish.yml@220e7282de6422353c81125ae4bbb4fb67510950 -
Trigger Event:
release
-
Statement type: