betty.generate module - Betty 0.4.0a1 documentation

Hide navigation sidebar
Hide table of contents sidebar
Skip to content
Back to top
View this page
Toggle table of contents sidebar

# betty.generate module

Provide the Generation API.

class betty.generate.GenerationContext

  Bases: `Context`

  A site generation job context.

  Parameters:

    app (`betty.app.App`)

  __init__(app: betty.app.App)
    Parameters:

      app (`betty.app.App`)

  property app: App

    The Betty application this job context is run within.

class betty.generate.Generator

  Bases: `object`

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

  async generate(job_context: betty.generate.GenerationContext) → None

    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]

  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]

  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]

  Create the file for a JSON resource.

  Parameters:

    path (`pathlib.Path`)

  Return type:

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

async betty.generate.generate(app: betty.app.App) → None

  Generate a new site.

  Parameters:

    app (`betty.app.App`)

  Return type:

    `None`