law.cli.software#

“law sw” cli subprogram.

setup_parser(sub_parsers: _SubParsersAction) None[source]#

Sets up the command line parser for the software subprogram and adds it to sub_parsers.

execute(args: Namespace) int[source]#

Executes the software subprogram with parsed commandline args.

build_software_cache(sw_dir: str | Path | None = None, dep_names: list[str] | None = None) None[source]#

Builds up the software cache directory at sw_dir by simply copying all required python modules identified by dep_names, defaulting to a predefined list of package names. sw_dir is evaluated with get_sw_dir().

remove_software_cache(sw_dir: str | Path | None = None) None[source]#

Removes the software cache directory at sw_dir which is evaluated with get_sw_dir().

reload_dependencies(force: bool = False, dep_names: list[str] | None = None) None[source]#

Reloads all python modules that law depends on, idenfied by dep_names and defaulting to a predefined list of package names. Unless force is True, multiple calls to this function will not have any effect.

use_software_cache(sw_dir: str | Path | None = None, reload_deps: bool = False) None[source]#

Adjusts sys.path so that the cached software at sw_dir is used. sw_dir is evaluated with get_sw_dir(). When reload_deps is True, reload_dependencies() is invoked.

get_sw_dir(sw_dir: str | Path | None = None) str[source]#

Returns the software directory defined in the core.software_dir config. When sw_dir is not None, it is expanded and returned instead.