Skip to content

Templates

templates

Template path resolution for Copier scaffold templates.

TemplateInfo

Bases: BaseModel

Template metadata.

Note: type: ignore[explicit-any] flags pydantic BaseModel internals (third-party).

Source code in packages/axm-init/src/axm_init/core/templates.py
Python
class TemplateInfo(BaseModel):  # type: ignore[explicit-any]
    """Template metadata.

    Note: ``type: ignore[explicit-any]`` flags pydantic ``BaseModel``
    internals (third-party).
    """

    name: str
    description: str
    path: Path

    model_config = ConfigDict(extra="forbid")

TemplateType

Bases: StrEnum

Available scaffold template types.

Source code in packages/axm-init/src/axm_init/core/templates.py
Python
class TemplateType(StrEnum):
    """Available scaffold template types."""

    STANDALONE = "standalone"
    WORKSPACE = "workspace"
    MEMBER = "member"

get_template_path(template_type=TemplateType.STANDALONE)

Return path to a bundled Copier template.

Parameters:

Name Type Description Default
template_type TemplateType

Type of template to look up.

STANDALONE

Returns:

Type Description
Path

Path to the bundled template directory.

Source code in packages/axm-init/src/axm_init/core/templates.py
Python
def get_template_path(
    template_type: TemplateType = TemplateType.STANDALONE,
) -> Path:
    """Return path to a bundled Copier template.

    Args:
        template_type: Type of template to look up.

    Returns:
        Path to the bundled template directory.
    """
    dir_name = _TEMPLATE_DIRS[template_type]
    return Path(str(TEMPLATES_PKG / dir_name))