template_helpers
Utilities for loading and managing Jinja2 templates used in code generation.
It generates the templates/template_enum.py file which contains an enumeration of all templates.
-
boto3_dataclass.templates.template_helpers.load_template(relpath: str) → Template[source]
Load a Jinja2 template by relative path from the templates directory.
- Parameters:
relpath – The relative path of the template to load, using ‘/’ as the separator.
Example: type_defs/module.jinja
-
class boto3_dataclass.templates.template_helpers.TemplateMetadata(path: ~pathlib.Path = <factory>)[source]
Data container for metadata about a Jinja2 template file.
-
property relpath: str
The path of the template file relative to the templates directory.
-
property name: str
A valid Python identifier derived from the template’s relative path.
-
boto3_dataclass.templates.template_helpers.gen_code()[source]
Generate the templates/template_enum.py file containing an enumeration of all templates.