cli.conda_env
cli.conda_env#
- showyourwork.cli.conda_env.parse_syw_spec(syw_spec)#
- showyourwork.cli.conda_env.run_in_env(command, **kwargs)#
Run a command in the isolated showyourwork conda environment.
This function creates and activates an isolated conda environment and executes
command
in it, with optionalkwargs
passed tosubprocess.run
. The conda environment is specified inshowyourwork/workflow/envs/environment.yml
and consists primarily of the dependencies needed to executeSnakemake
, includingmamba
. To this environment we add the specific version ofshowyourwork
requested in the article repository’sshowyourwork.yml
file.Note that this ensures that the article is built with the version of
showyourwork
specified by the workflow, and not the version the user currently has installed.To speed things up on future runs, we cache the environment in the temporary folder
~/.showyourwork/env
.- Parameters
command (str) – The command to run.
kwargs – Keyword arguments to pass to subprocess.run.
- Returns
The result of the command.
- Return type
subprocess.CompletedProcess
- Raises
exceptions.CondaNotFoundError – If conda is not found.
exceptions.ShowyourworkException – If the cwd is not the top level of a showyourwork project.
exceptions.ShowyourworkNotFoundError – If the requested version of showyourwork in the config file cannot be found.