Skip to main content

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 .html templates 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 |markdown filter.
  • 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 .html directly from DIR_SRC and other assets from DIR_DEST.
  • Watches DIR_SRC for .html/.md changes, applies the same copy/exclude rules as build, and mirrors deletions.
  • --watch-add accepts additional regex patterns (relative to the current working directory) whose changes are forwarded to clients as type='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 .md snippets.
  • 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

engrave-3.2.0.tar.gz (85.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

engrave-3.2.0-py3-none-any.whl (19.4 kB view details)

Uploaded Python 3

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

Hashes for engrave-3.2.0.tar.gz
Algorithm Hash digest
SHA256 1962e048b44d0f8c9e9d71d82cdba9fbdb0865281703df475ab08409d3889403
MD5 0d83a30c5c8548f8ddea49740d065e03
BLAKE2b-256 a7b95b7fbf63661cebb1cfaef8679f8fac05de52ce8f6aa4f9668fcf0044d868

See more details on using hashes here.

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

Hashes for engrave-3.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 20898b98e220d3959d294a66f02848a16ec166c370dd40d524974039577d077a
MD5 d97cbe5dcfecf53baddd4f67f587cba7
BLAKE2b-256 063e2c44f64e29973c585db195942360e3cb6fcae2460c632caf923b149ed98d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page