cotainr.pack 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 packing of software into the container.
Classes#
- CondaInstall
A Conda installation in a container sandbox.
API reference#
- class cotainr.pack.CondaInstall(*, sandbox, prefix='/opt/conda', license_accepted=False, log_settings=None)#
Bases:
object
A Conda installation in a container sandbox.
Bootstraps a Miniforge based Conda installation in a container sandbox. As part of the bootstrapping of Miniforge, the user must accept the Miniforge license terms.
- Parameters:
- sandbox
SingularitySandbox
The sandbox in which Conda should be installed.
- prefixstr
The Conda prefix to use for the Conda install.
- license_acceptedbool, default=False
The flag to indicate whether or not the user has already accepted the Miniforge license terms.
- log_settings
LogSettings
, optional The data used to setup the logging machinery (the default is None which implies that the logging machinery is not used).
- sandbox
Notes
When adding a Conda environment, it is the responsibility of the user of cotainr to make sure they have the necessary rights to use the Conda channels/repositories and packages specified in the Conda environment, e.g. if using the default Anaconda repositories.
- Attributes:
- sandbox
SingularitySandbox
The sandbox in which Conda is installed.
- prefixstr
The Conda prefix used for the Conda install.
- license_acceptedbool
Whether or not the Miniforge license terms have been accepted.
- log_dispatcher
LogDispatcher
or None. The log dispatcher used to process stdout/stderr message from Singularity commands that run in sandbox, if the logging machinery is used.
- sandbox
Methods
add_environment
(*, path, name)Add an exported Conda environment to the Conda install.
Remove all unused Conda files.
- add_environment(*, path, name)#
Add an exported Conda environment to the Conda install.
Equivalent to calling “conda env create -f path -n name”.
- Parameters:
- path
os.PathLike
The path to the exported env.yml file describing the Conda environment to install.
- namestr
The name to use for the installed Conda environment.
- path
- cleanup_unused_files()#
Remove all unused Conda files.
Equivalent to calling “conda clean -a”.