The simoc-sam script is used for various things, some of which need to work even when the deps are not installed. Other commands requires a venv with the deps and simoc_sam installed, in particular to access the default config file. In order to run even when the venv is not available, the script sets the config module and the jinja2 Template to None if they can't be imported.
The @needs_venv decorator is used to ensure that the venv is present when executing commands that require it, and it automatically sets up the venv before executing the command if it's not already set up.
After setting up the venv, the command could still fail because currently the config module and the Template are not reloaded after setting up the venv. The create_venv function should be updated to reload them to ensure that the command always works.
The
simoc-samscript is used for various things, some of which need to work even when the deps are not installed. Other commands requires a venv with the deps andsimoc_saminstalled, in particular to access the defaultconfigfile. In order to run even when the venv is not available, the script sets theconfigmodule and thejinja2TemplatetoNoneif they can't be imported.The
@needs_venvdecorator is used to ensure that the venv is present when executing commands that require it, and it automatically sets up the venv before executing the command if it's not already set up.After setting up the venv, the command could still fail because currently the
configmodule and theTemplateare not reloaded after setting up the venv. Thecreate_venvfunction should be updated to reload them to ensure that the command always works.