gfw.common.jinja2.EnvironmentLoader#

class EnvironmentLoader(**defaults)[source]#

Helper to instantiate jinja2.Environment with sensible defaults.

This class centralizes configuration for Jinja2 environments, including trimming blocks, left-stripping whitespace, and disabling autoescape (useful for SQL templates). Defaults can be overridden when instantiating the class or when creating an environment.

Methods

from_package

Creates a jinja2.Environment for a given package and template path.

from_package(package, path)[source]#

Creates a jinja2.Environment for a given package and template path.

Parameters:
  • package (str) – The Python package where the templates are located.

  • path (str) – The path to the templates inside the package.

Returns:

A configured jinja2.Environment instance ready to load templates.

Return type:

Environment