Manifest Templates

Some built-in resources have to reach the platform that they run on, rather than a fixed host. For example, the Smarter Project MCPClients read the Smarter Project MCP server of their own platform, and the Stackademy ApiConnection queries that platform’s Stackademy test api. A hard-coded host such as http://localhost:9357 only works in local development.

Such a manifest is a template: a *.yaml.tpl file, which is a Python string.Template whose placeholders are filled in from smarter_settings when it is applied.

  • ${environment_platform_scheme}: https, or http in local development.

  • ${environment_platform_domain}: e.g. alpha.platform.example.com, or localhost:9357 in local development.

spec:
  connection:
    baseUrl: ${environment_platform_scheme}://${environment_platform_domain}/api/v1/tests

manage.py add_builtin_mcpclients and manage.py create_stackademy fill in their templates with smarter.lib.manifest.template.render_manifest_template().

Manifest templates: built-in manifests that name the platform that applies them.

A manifest template is a *.yaml.tpl file, and a string.Template string, whose placeholders are filled in from smarter_settings when it is applied. A built-in resource can so reach the platform it runs on, e.g. the Smarter Project MCP server, or the Stackademy test api, at https://alpha.platform.example.com in one environment, and at http://localhost:9357 in local development, rather than at a hard-coded host.

smarter.lib.manifest.template.TEMPLATE_EXTENSION = '.yaml.tpl'

The extension of a manifest template.

smarter.lib.manifest.template.manifest_template_values()[source]

Return the values that fill in the manifest templates, *.yaml.tpl.

  • environment_platform_scheme: https, or http in local development, from smarter_settings.environment_url.

  • environment_platform_domain: smarter_settings.environment_platform_domain, e.g. alpha.platform.example.com, or localhost:9357 in local development.

Return type:

dict[str, str]

Returns:

The values, by placeholder name.

smarter.lib.manifest.template.render_manifest_template(template)[source]

Fill in a manifest template with manifest_template_values().

Parameters:

template (str) – The template.

Return type:

str

Returns:

The manifest.

Raises:

KeyError – If the template names a placeholder that has no value.