spack.container package
Package that provides functions and classes to generate container recipes from a Spack environment
- spack.container.recipe(configuration, last_phase=None)[source]
Returns a recipe that conforms to the configuration passed as input.
- spack.container.validate(configuration_file)[source]
Validate a Spack environment YAML file that is being used to generate a recipe for a container.
Since a few attributes of the configuration must have specific values for the container recipe, this function returns a sanitized copy of the configuration in the input file. If any modification is needed, a warning will be issued.
- Parameters:
configuration_file (str) – path to the Spack environment YAML file
- Returns:
A sanitized copy of the configuration stored in the input file
Submodules
spack.container.images module
Manages the details on the images used in the various stages.
- spack.container.images.all_bootstrap_os()[source]
Return a list of all the OS that can be used to bootstrap Spack
- spack.container.images.build_info(image, spack_version)[source]
Returns the name of the build image and its tag.
- spack.container.images.checkout_command(url, ref, enforce_sha, verify)[source]
Return the checkout command to be used in the bootstrap phase.
- spack.container.images.commands_for(package_manager)[source]
Returns the commands used to update system repositories, install system packages and clean afterwards.
- Parameters:
package_manager (str) – package manager to be used
- Returns:
A tuple of (update, install, clean) commands.
- spack.container.images.data()[source]
Returns a dictionary with the static data on the images.
The dictionary is read from a JSON file lazily the first time this function is called.
- spack.container.images.os_package_manager_for(image)[source]
Returns the name of the OS package manager for the image passed as argument.
- Parameters:
image (str) – image to be used at run-time. Should be of the form <image_name>:<image_tag> e.g. “ubuntu:18.04”
- Returns:
Name of the package manager, e.g. “apt” or “yum”
spack.container.writers module
Writers for different kind of recipes and related convenience functions.
- class spack.container.writers.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
- 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
- class spack.container.writers.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
- spack.container.writers.create(configuration, last_phase=None)[source]
Returns a writer that conforms to the configuration passed as input.