A lightweight static-site generator built on Python and Jinja2
Project description
Engrave
A lightweight static-site generator using Python + Jinja2
Version: 3.2.0
๐ What is Engrave
Engrave turns a directory of HTML templates (plus optional Markdown snippets) into a ready-to-serve static site. It is ideal for documentation, simple marketing pages, or any static content that benefits from Jinja2 templating without adding a backend.
๐ Highlights
- Renders
.htmltemplates with Jinja2; path segments starting with_are ignored for HTML builds. - Built-in Markdown helpers: include Markdown files via
markdown('path.md')and render inline strings with the|markdownfilter. - Regex-driven asset copying (
--copy) and exclusion rules (--exclude) applied to both renders and copies. - Live preview server powered by FastAPI + Uvicorn with watchfiles + SSE for instant reload hooks.
- Simple Cyclopts-based CLI; works on Python 3.10+.
๐งฐ Installation
pip install engrave
๐ CLI Usage
Build
Render templates and copy assets from a source directory into an output directory.
engrave build -h
Usage: engrave build [ARGS] [OPTIONS]
Build static HTML files from templates.
โญโ Parameters โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ * --dir-src Source directory containing input files [required] โ
โ * --dir-dest Destination directory for build output [required] โ
โ --copy --empty-copy Path RegEx copy verbatim [default: []] โ
โ --exclude --empty-exclude Path RegEx to exclude from processing [default: []] โ
โ --log-level [choices: CRITICAL, FATAL, ERROR, WARNING, WARN, INFO, DEBUG, NOTSET] [default: INFO] โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
Development Server (auto-rebuild + SSE)
Run an initial build, start FastAPI/Uvicorn, and stream file-change events for live reload.
engrave server -h
Usage: engrave server [ARGS] [OPTIONS]
Start a development server with live preview.
โญโ Parameters โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ * --dir-src Source directory containing input files [required] โ
โ * --dir-dest Destination directory for build output [required] โ
โ --copy --empty-copy Path RegEx copy verbatim [default: []] โ
โ --exclude --empty-exclude Path RegEx to exclude from processing [default: []] โ
โ --host Host interface to bind the development server [default: 127.0.0.1] โ
โ --port Port number for the development server [default: 8000] โ
โ --watch-add --empty-watch-add โ
โ Additional path regex patterns to watch for changes (in addition to .html and patterns โ
โ matched by --copy). Matching paths will trigger Server-Sent Events (SSE). [default: []] โ
โ --sse-url SSE URL (Server Side Event) to emite watch event [default: __engrave/watch] โ
โ --log-level [choices: CRITICAL, FATAL, ERROR, WARNING, WARN, INFO, DEBUG, NOTSET] [default: INFO] โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
- Serves rendered
.htmldirectly fromDIR_SRCand other assets fromDIR_DEST. - Watches
DIR_SRCfor.html/.mdchanges, applies the same copy/exclude rules asbuild, and mirrors deletions. --watch-addaccepts additional regex patterns (relative to the current working directory) whose changes are forwarded to clients astype='watch'.- Add a reload hook in your page:
const source = new EventSource('/__engrave/watch');
source.addEventListener('change', () => window.location.reload());
๐งฑ Templates & Markdown helpers
markdown('path.md')loads a Markdown file relative to the current template (stays inside configured template roots).{{ content | markdown }}converts inline Markdown strings.- Markdown files are rendered as Jinja templates with the current context before Markdown conversion, so you can use template variables inside
.mdsnippets. - Markdown rendering uses Mistune by default and caches file reads/compilation by mtime; you can supply a custom parser via
get_template(..., markdown_to_html=...)if embedding Engrave programmatically. - Multiple template roots are supported by passing a list to
dir_src.
๐ ๏ธ Testing
python -m unittest
๐ฉโ๐ป Development
Build package artifacts
Build source and wheel distributions into dist/:
uv build
Build docs
Install docs dependencies:
uv sync --group dev
Build the documentation site:
uv run mkdocs build
Preview docs locally with live reload:
uv run mkdocs serve
๐ License
MIT โ see LICENSE.
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 engrave-3.2.0.tar.gz.
File metadata
- Download URL: engrave-3.2.0.tar.gz
- Upload date:
- Size: 85.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.30 {"installer":{"name":"uv","version":"0.9.30","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"43","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1962e048b44d0f8c9e9d71d82cdba9fbdb0865281703df475ab08409d3889403
|
|
| MD5 |
0d83a30c5c8548f8ddea49740d065e03
|
|
| BLAKE2b-256 |
a7b95b7fbf63661cebb1cfaef8679f8fac05de52ce8f6aa4f9668fcf0044d868
|
File details
Details for the file engrave-3.2.0-py3-none-any.whl.
File metadata
- Download URL: engrave-3.2.0-py3-none-any.whl
- Upload date:
- Size: 19.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.30 {"installer":{"name":"uv","version":"0.9.30","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Fedora Linux","version":"43","id":"","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
20898b98e220d3959d294a66f02848a16ec166c370dd40d524974039577d077a
|
|
| MD5 |
d97cbe5dcfecf53baddd4f67f587cba7
|
|
| BLAKE2b-256 |
063e2c44f64e29973c585db195942360e3cb6fcae2460c632caf923b149ed98d
|