spack.container.writers package

Writers for different kind of recipes and related convenience functions.

class spack.container.writers.PathContext(config, last_phase)[source]

Bases: Context

Generic context used to instantiate templates of recipes that install software in a common location and make it available directly via PATH.

property bootstrap

Information related to the build image.

property build

Information related to the build image.

context_properties = ['depfile', 'run', 'build', 'strip', 'paths', 'manifest', 'os_packages_final', 'os_packages_build', 'os_package_update', 'labels', 'bootstrap', 'render_phase']
property depfile
property labels
property manifest

The spack.yaml file that should be used in the image

property os_package_update

Whether or not to update the OS package manager cache.

property os_packages_build

Additional system packages that are needed at build-time.

property os_packages_final

Additional system packages that are needed at run-time.

property paths

Important paths in the image

property render_phase
property run

Information related to the run image.

property strip

Whether or not to strip binaries in the image

template_name: str | None = None
spack.container.writers.create(configuration, last_phase=None)[source]

Returns a writer that conforms to the configuration passed as input.

Parameters:
  • configuration (dict) – how to generate the current recipe

  • last_phase (str) – last phase to be printed or None to print them all

spack.container.writers.recipe(configuration, last_phase=None)[source]

Returns a recipe that conforms to the configuration passed as input.

Parameters:
  • configuration (dict) – how to generate the current recipe

  • last_phase (str) – last phase to be printed or None to print them all

spack.container.writers.writer(name)[source]

Decorator to register a factory for a recipe writer.

Each factory should take a configuration dictionary and return a properly configured writer that, when called, prints the corresponding recipe.

Submodules

spack.container.writers.docker module

class spack.container.writers.docker.DockerContext(config, last_phase)[source]

Bases: PathContext

Context used to instantiate a Dockerfile

context_properties = ['manifest', 'depfile', 'run', 'build', 'strip', 'paths', 'os_packages_final', 'os_packages_build', 'os_package_update', 'labels', 'bootstrap', 'render_phase']
property manifest

The spack.yaml file that should be used in the image

template_name: str | None = 'container/Dockerfile'

Name of the template used for Dockerfiles

spack.container.writers.singularity module

class spack.container.writers.singularity.SingularityContext(config, last_phase)[source]

Bases: PathContext

Context used to instantiate a Singularity definition file

context_properties = ['runscript', 'startscript', 'test', 'help', 'depfile', 'run', 'build', 'strip', 'paths', 'manifest', 'os_packages_final', 'os_packages_build', 'os_package_update', 'labels', 'bootstrap', 'render_phase']
property help
property runscript
property singularity_config
property startscript
template_name: str | None = 'container/singularity.def'

Name of the template used for Singularity definition files

property test