CLI
launcher
¶
This module defines the Click
CLI application to automatically
setup the Mirumoji
Docker Compose application.
build(gpu, no_clear)
¶
Build local images only, but don't run application
build_imgs_locally(use_gpu)
¶
Click command helper which runs the docker build command for the frontend and backend images based on whether CPU or GPU version is chosen.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
use_gpu
|
bool
|
True to use GPU version, False to use CPU version |
required |
check_docker_running()
¶
Click command helper which checks if the Docker service/daemon is currently running
check_env_file(expected_vars, env_file_path)
¶
check_git_installed()
¶
Click command helper which checks if git
is installed
in the system.
clear_wrapper(func, no_clear)
¶
Decorator to call a helper function and clean the terminal after execution.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
no_clean
|
bool
|
If True, function is run without cleaning terminal |
required |
func
|
Callable[P, R]
|
Helper function object |
required |
Returns:
Type | Description |
---|---|
Callable[P, R]
|
Callable[P,R]: Wrapped function with clear choice applied |
cli()
¶
Mirumoji Launcher: Setup and run Mirumoji with Docker.
configure_repo()
¶
Click command helper which displays a header, sets up the local repository path, clones or updates the repository, sets the working directory to the local repository path.
Returns:
Type | Description |
---|---|
Tuple[Path, Path]
|
Tuple[Path]: contains both the local repository path and the original working directory. |
ensure_repo(repo_url, repo_path)
¶
get_build_locally()
¶
Click command helper which asks for user input on whether to build images locally or pull pre-built images.
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True for building locally, False for using pre-built images. |
get_gpu_cpu()
¶
Click command helper which asks for user input on whether to use GPU or CPU version of backend.
Returns:
Name | Type | Description |
---|---|---|
bool |
bool
|
True for GPU version, False for CPU version |
get_host_lan_ip()
¶
Click command helper which returns the primary LAN IPv4 address of the host machine and loads it as an environment variable.
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
The Primary LAN IPv4 address of the host machine |
get_registry()
¶
Click command helper which asks for user input on whether to use pull pre-built images from GitHub Registry or from Docker Hub Registry.
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
|
gui()
¶
Start a GUI launcher.
launch(build, gpu, github_pull, no_clear)
¶
Guides through the Mirumoji application setup with Docker
launch_local(gpu, no_clear)
¶
Launch Mirumoji with previously built local images
run_command(command_list, cwd=None, check=True, shell=False, stream=True)
¶
Click command helper which runs a command as a subprocess, streams its output and handles errors.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
command_list
|
List[str]
|
List of command arguments to be executed |
required |
cwd
|
Path
|
Path in which to execute the command from |
None
|
check
|
bool
|
When True, if the command returns an error status code an exception is propagated. Defaults to True |
True
|
shell
|
bool
|
When True, concatenate the list of arguments into a string and run in shell mode. Defaults to False |
False
|
stream
|
bool
|
When True, stream command output to |
True
|
Returns:
Type | Description |
---|---|
Popen[str]
|
Subprocess object with |
Raises:
Type | Description |
---|---|
CalledProcessError
|
If command raises an error and
|
Exception
|
If an unexpected Exception occurs while running the command. |
shutdown(clean, no_clear)
¶
Stops application by running Docker Compose Down.