NVIDIA-Omniverse / kit-app-template

Omniverse Kit App Template
Other
180 stars 48 forks source link

Automatic Launch of Single Application #14

Closed und-miller closed 3 weeks ago

und-miller commented 1 month ago

Feature Request: Automatic Launch of Single Application

Overview

I propose an enhancement to the kit-app-template\tools\repoman\launch.py script to automatically launch the application if only one application is available. This improvement will streamline the developer experience by removing the unnecessary prompt when there is only one application to choose from.

Current Behavior

When a developer runs .\repo.bat launch, they are prompted to select an application, even if there is only one option:

Select with arrow keys which App would you like to launch:

Proposed Change

Modify the select_kit method in kit-app-template\tools\repoman\launch.py to automatically launch the application without prompting the developer to select from an option of one.

Current Code

def select_kit(target_directory: Path) -> str:
    # Get list of kit apps on filesystem.
    app_names = discover_kit_files(target_directory)
    if len(app_names) == 0:
        repo_cmd = Path(_get_repo_cmd()).name
        err_msg = f"There were no apps discovered in the default Kit App Path: {target_directory}. You must create an app first via `{repo_cmd} template new` and then build via `{repo_cmd} build`."
        _quiet_error(err_msg)
        # perform a select to set app_name
        app_name = _select(app_names)
        return app_name

New Code

def select_kit(target_directory: Path) -> str:
    # Get list of kit apps on filesystem.
    app_names = discover_kit_files(target_directory)
    if len(app_names) == 0:
        repo_cmd = Path(_get_repo_cmd()).name
        err_msg = f"There were no apps discovered in the default Kit App Path: {target_directory}. You must create an app first via `{repo_cmd} template new` and then build via `{repo_cmd} build`."
        _quiet_error(err_msg)
    if len(app_names) == 1: # <-- new code
        logger.info("Launching ${app_names[0]}")
        return app_names[0]
    else:
        # perform a select to set app_name
        app_name = _select(app_names)
        return app_name

Benefits

SchultzC commented 1 month ago

Thank you for this feature request.

It has been implemented internally and will be staged for a future release.

We will keep this issue open until this has been added to a public release.

SchultzC commented 3 weeks ago

This feature has been implemented as of the latest update.

By default, most application templates will now render with multiple .kit files. This is intentional as we transition many of the templates to be streaming-ready by default.

To see this feature in action, we recommend creating a Kit Service from a fresh clone of the repository. The Service template is not configured (in the templates/templates.toml file) to render a streaming .kit file and will therefore only create a single .kitfile. Running ./repo.sh launch with only the Service template rendered will start the service immediately without prompting for .kit file selection.

Thank you for the feature request!