Scaffolder#
flet_pkg.core.scaffolder
#
Jinja2-based project scaffolder.
Walks a template directory tree, resolves {{variable}} placeholders
in file and directory names, and renders .jinja files through
Jinja2 to produce a complete project skeleton.
Scaffolder
#
Render a project from a template directory.
Attributes:
| Name | Type | Description |
|---|---|---|
template_path |
Resolved path to the template directory. |
|
context |
Variable mapping used for name resolution and rendering. |
|
output_dir |
Root directory where the project will be created. |
|
env |
Jinja2 environment configured with strict undefined. |
Initialise the scaffolder.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
template_name
|
str
|
Name of the template ( |
required |
context
|
dict
|
Dictionary of variables for Jinja2 rendering. |
required |
output_dir
|
Path | None
|
Target directory. Defaults to the current working directory. |
None
|
Raises:
| Type | Description |
|---|---|
FileNotFoundError
|
If the template directory does not exist. |
Source code in src/flet_pkg/core/scaffolder.py
generate
#
Generate the project directory from the template.
Returns:
| Type | Description |
|---|---|
Path
|
Path to the created project directory. |
Raises:
| Type | Description |
|---|---|
FileExistsError
|
If the project directory already exists. |