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

1 min read

pyssg.cli.scaffold

Site scaffolding for pyssg init and pyssg eject-layout.

init_site writes a minimal, ready-to-build site for a chosen preset (a one-line pyssg.config.py plus a little sample content), so a new user can go from nothing to pyssg build in one step. eject_layout copies a built-in theme into the site so it can be customized and pointed at via layout=.

Everything here is deterministic and reads no clock: sample dates are fixed literals, so scaffolding the same preset twice produces identical files.

init_site(site_dir: Path, *, preset: str, force: bool = False) -> list[Path]

Scaffold a new site for preset under site_dir; return new files.

Refuses to overwrite an existing pyssg.config.py unless force is set, so re-running init in a real site does not clobber it.

eject_layout(site_dir: Path, *, theme: str, dest: str) -> Path

Copy the built-in theme into site_dir/dest; return the destination.

Raises :class:LayoutError if the theme is unknown and :class:ConfigError if the destination already exists (to avoid clobbering a customized layout).

list_themes() -> list[str]

Names of the built-in themes (for CLI help / messages).