Template models.

class renku.domain_model.template.RenderedTemplate(path, template, metadata)[source]

Bases: object

A rendered version of a Template.


Return all files in a rendered renku template.

class renku.domain_model.template.Template(id, name, description, parameters, icon, ssh_supported, aliases, immutable_files, allow_update, source, reference, version, path, templates_source)[source]

Bases: object

Template files and metadata from a template source.


Return all available references for the template.


Return all files in a rendered renku template.


Render template files in a new directory.

property templates_source

Return template’s source.

validate(skip_files, raise_errors=True)[source]

Validate a template.

class renku.domain_model.template.TemplateMetadata(metadata, immutable_files)[source]

Bases: object

Metadata required for rendering a template.

property allow_update

Is template updatable.

classmethod from_dict(metadata)[source]

Return an instance from a metadata dict.

classmethod from_project(project)[source]

Return an instance from reading template-related metadata from a project.

property id

Template id.

property reference

Template reference.

property source

Template source.


Update metadata from a template.

property version

Template version.

class renku.domain_model.template.TemplateParameter(name, description, type, possible_values, default)[source]

Bases: object

Represent template variables.


Convert a given value to the proper type and raise if value is not valid.

classmethod from_dict(name, value)[source]

Create an instance from a dict.

property has_default

Return True if a default value is set.


Validate manifest content.

class renku.domain_model.template.TemplatesManifest(content, skip_validation=False)[source]

Bases: object

Manifest file for Renku templates.

classmethod from_path(path, skip_validation=False)[source]

Extract template metadata from the manifest file.

classmethod from_string(content, skip_validation=False)[source]

Extract template metadata from the manifest file.


Return raw manifest file content.

property templates

Return list of available templates info in the manifest.


Validate manifest content.

class renku.domain_model.template.TemplatesSource(path, source, reference, version, skip_validation=False)[source]

Bases: object

Base class for Renku template sources.

abstract classmethod fetch(source, reference)[source]

Fetch an embedded or remote template.

abstract get_all_references(id)[source]

Return all available versions for a template id.

abstract get_latest_reference_and_version(id, reference, version)[source]

Return latest reference and version number of a template.

abstract get_template(id, reference)[source]

Return a template at a specific reference.

is_update_available(id, reference, version)[source]

Return True if an update is available along with the latest reference of a template.

property templates

Return list of templates.

renku.domain_model.template.calculate_dockerfile_checksum(*, dockerfile=None, dockerfile_content=None)[source]

Calculate checksum for the given file or content.

NOTE: We ignore empty lines and whitespace characters at the end of the lines when calculating Dockerfile checksum if it has Renku-specific section markers.


Return start and end line numbers of the Renku-specific section.


Return the Renku-specific section of the Dockerfile or the whole Dockerfile if it doesn’t exist.

renku.domain_model.template.hash_template_file(*, relative_path, absolute_path)[source]

Use proper hash on a template file.

renku.domain_model.template.update_dockerfile_content(source, destination)[source]

Update the Renku-specific section of the destination Dockerfile with the one from the source Dockerfile.