pyssg is pre-1.0 and under active development - APIs, config, and themes may change.
pyssg.layout

1 min read

pyssg.layout

Layout package loading and validation.

A layout is a directory bundle the basic user customizes (templates + assets). Its layout.toml manifest declares the layout's name, version and default template; templates/ holds the Jinja2 templates and the optional assets/ holds css/js/fonts that get copied and content-hashed.

This loader only locates and validates the bundle into an immutable :class:Layout record. Reading the manifest is pure (stdlib tomllib); the record carries no mutable state so it is safe to share across builds.

class Layout

A validated layout package.

root is the package directory; templates_dir and assets_dir are resolved against it. assets_dir is None when the package ships no assets.

load_layout(path: Path) -> Layout

Load and validate the layout package rooted at path.

Raises :class:LayoutError if the directory, manifest, templates/ dir or the declared default template are missing.