Skip to content

write_jinja_template

kedro_dagster.utils.write_jinja_template(src, dst, **kwargs)

Render and write a Jinja template to a destination file.

Parameters

Name Type Description Default
src str or Path

Path to the template file.

required
dst str or Path

Path to the output file.

required
**kwargs Any

Variables to pass to the template.

{}

See Also

kedro_dagster.utils.render_jinja_template : Renders a template without writing to disk.

Source Code

Show/Hide source
def write_jinja_template(src: str | Path, dst: str | Path, **kwargs: Any) -> None:
    """Render and write a Jinja template to a destination file.

    Parameters
    ----------
    src : str or Path
        Path to the template file.
    dst : str or Path
        Path to the output file.
    **kwargs
        Variables to pass to the template.

    See Also
    --------
    `kedro_dagster.utils.render_jinja_template` :
        Renders a template without writing to disk.
    """
    dst = Path(dst)
    parsed_template = render_jinja_template(src, **kwargs)
    with open(dst, "w") as file_handler:
        file_handler.write(parsed_template)