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.1.6dev

๐Ÿš€ 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

๐Ÿ“„ 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.1.6.tar.gz (682.5 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.1.6-py3-none-any.whl (19.2 kB view details)

Uploaded Python 3

File details

Details for the file engrave-3.1.6.tar.gz.

File metadata

  • Download URL: engrave-3.1.6.tar.gz
  • Upload date:
  • Size: 682.5 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.1.6.tar.gz
Algorithm Hash digest
SHA256 01ae84247716de9d09b54a7222b8022d6c511a1fd9786dfa3d84089a0918404e
MD5 486758f4551a60eff8d62b2889ab0c51
BLAKE2b-256 43f82a785a8c69d0f208ab596c567f159841a78c0362e8d627f50905efbd7c23

See more details on using hashes here.

File details

Details for the file engrave-3.1.6-py3-none-any.whl.

File metadata

  • Download URL: engrave-3.1.6-py3-none-any.whl
  • Upload date:
  • Size: 19.2 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.1.6-py3-none-any.whl
Algorithm Hash digest
SHA256 4b409f53aafd6d26fb355a43648ac31f7c4154c02eeea54249b5e3967b0f62e5
MD5 67e9879452addc0a24274888bbdd1396
BLAKE2b-256 c881aac3f683ae2ee714e97fb285eeece6644396ff3ca4a4d285095ec89dc5d2

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