betty.generate module

Provide the Generation API.

class betty.generate.GenerationContext[source]

Bases: Context

A site generation job context.

Parameters:

project (betty.project.Project)

__init__(project: betty.project.Project)[source]
Parameters:

project (betty.project.Project)

property project: Project

The Betty project this job context is run within.

class betty.generate.Generator[source]

Bases: ABC

An extension that generates (part of) projects’ sites.

abstract async generate(job_context: betty.generate.GenerationContext) None[source]

Generate (part of) a project’s site.

Parameters:

job_context (betty.generate.GenerationContext)

Return type:

None

async betty.generate.create_file(path: pathlib.Path) AsyncContextManager[aiofiles.threadpool.text.AsyncTextIOWrapper][source]

Create the file for a resource.

Parameters:

path (pathlib.Path)

Return type:

typing.AsyncContextManager[aiofiles.threadpool.text.AsyncTextIOWrapper]

async betty.generate.create_html_resource(path: pathlib.Path) AsyncContextManager[aiofiles.threadpool.text.AsyncTextIOWrapper][source]

Create the file for an HTML resource.

Parameters:

path (pathlib.Path)

Return type:

typing.AsyncContextManager[aiofiles.threadpool.text.AsyncTextIOWrapper]

async betty.generate.create_json_resource(path: pathlib.Path) AsyncContextManager[aiofiles.threadpool.text.AsyncTextIOWrapper][source]

Create the file for a JSON resource.

Parameters:

path (pathlib.Path)

Return type:

typing.AsyncContextManager[aiofiles.threadpool.text.AsyncTextIOWrapper]

async betty.generate.generate(project: betty.project.Project) None[source]

Generate a new site.

Parameters:

project (betty.project.Project)

Return type:

None