cotainr.cli module#
cotainr - a user space Apptainer/Singularity container builder.
Copyright DeiC, deic.dk Licensed under the European Union Public License (EUPL) 1.2 - see the LICENSE file for details.
This module implements the command line main command and subcommands.
Classes#
- CotainrSubcommand(ABC)
Abstract base class for CotainrCLI subcommands.
- Build
Build a container. (The “build” subcommand.)
- CotainrCLI
Build Apptainer/Singularity containers for HPC systems in user space. (The main CLI command.)
- Info
Obtain info about the state of all required dependencies for building a container. (The “info” subcommand.)
Functions#
- main(*args, **kwargs)
Main CLI entrypoint.
API reference#
- class cotainr.cli.Build(*, image_path, base_image=None, conda_env=None, system=None)#
Bases:
CotainrSubcommandBuild a container.
The “build” subcommand.
- Parameters:
- image_path
os.PathLike Path to the built container image.
- base_imagestr
Base image to use for the container which may be any valid Apptainer/Singularity <BUILD SPEC>.
- conda_env
os.PathLike, optional Path to a Conda environment.yml file to install and activate in the container.
- systemstr
Which system/partition you will be running the container on, will set base image and other parameters for a simpler container creation. Running the info command will tell you more about the system and what is available.
- image_path
Methods
add_arguments(*, parser)Add arguments to the "build" subcommand subparser.
execute()Execute the "build" subcommand.
- classmethod add_arguments(*, parser)#
Add arguments to the “build” subcommand subparser.
- execute()#
Execute the “build” subcommand.
- class cotainr.cli.CotainrCLI(*, args=None)#
Bases:
objectBuild Apptainer/Singularity containers for HPC systems in user space.
The main cotainr CLI command.
- Parameters:
- argslist of str, optional
The input arguments to the CLI (the default is None, which implies that the input arguments are taken from sys.argv).
- Attributes:
- args
types.SimpleNamespace The namespace holding the converted arguments parsed to the CLI.
- subcommand
CotainrSubcommand The subcommand to run.
- args
- class cotainr.cli.CotainrSubcommand#
Bases:
ABCAbstract base class for CotainrCLI subcommands.
Methods
add_arguments(*, parser)Add command line arguments to arguments parser.
execute()Execute the subcommand.
- classmethod add_arguments(*, parser)#
Add command line arguments to arguments parser.
- Parameters:
- parser
argparse.ArgumentParser The argument parser to add arguments to.
- parser
- abstract execute()#
Execute the subcommand.
- class cotainr.cli.Info#
Bases:
CotainrSubcommandObtain info about the state of all required dependencies for building a container.
The “info” subcommand.
Methods
add_arguments(*, parser)Add command line arguments to arguments parser.
execute()Execute the "info" subcommand.
- execute()#
Execute the “info” subcommand.
- cotainr.cli.main(*args, **kwargs)#
Construct the main CLI entrypoint.