• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

nvidia-holoscan / holoscan-cli / 14098815580

27 Mar 2025 04:22AM UTC coverage: 85.6% (-0.2%) from 85.772%
14098815580

Pull #33

github

mocsharp
Cache bulds with actions/cache

Signed-off-by: Victor Chang <vicchang@nvidia.com>
Pull Request #33: Enable test-app with nv-gha-runner

40 of 51 new or added lines in 8 files covered. (78.43%)

3 existing lines in 3 files now uncovered.

1712 of 2000 relevant lines covered (85.6%)

0.86 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/holoscan_cli/packager/package_command.py
1
# SPDX-FileCopyrightText: Copyright (c) 2023-2025 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2
# SPDX-License-Identifier: Apache-2.0
3
#
4
# Licensed under the Apache License, Version 2.0 (the "License");
5
# you may not use this file except in compliance with the License.
6
# You may obtain a copy of the License at
7
#
8
# http://www.apache.org/licenses/LICENSE-2.0
9
#
10
# Unless required by applicable law or agreed to in writing, software
11
# distributed under the License is distributed on an "AS IS" BASIS,
12
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
# See the License for the specific language governing permissions and
14
# limitations under the License.
15
import argparse
×
16
import logging
×
17
from argparse import ArgumentParser, _SubParsersAction
×
18

19
from packaging.version import Version
×
20

21
from ..common.argparse_types import (
×
22
    validate_host_ip,
23
    valid_dir_path,
24
    valid_existing_dir_path,
25
    valid_existing_path,
26
    valid_platforms,
27
    valid_sdk_type,
28
)
29
from ..common.constants import SDK
×
30

31
logger = logging.getLogger("packager")
×
32

33

34
def create_package_parser(
×
35
    subparser: _SubParsersAction, command: str, parents: list[ArgumentParser]
36
) -> ArgumentParser:
37
    parser: ArgumentParser = subparser.add_parser(
×
38
        command, formatter_class=argparse.HelpFormatter, parents=parents, add_help=False
39
    )
40

41
    parser.add_argument(
×
42
        "application",
43
        type=valid_existing_path,
44
        help="Holoscan application path: Python application directory with __main__.py, "
45
        "Python file, C++ source directory with CMakeLists.txt, or path to an executable.",
46
    )
47
    parser.add_argument(
×
48
        "--config",
49
        "-c",
50
        required=True,
51
        type=valid_existing_path,
52
        help="Holoscan application configuration file (.yaml)",
53
    )
54
    parser.add_argument(
×
55
        "--docs",
56
        "-d",
57
        type=valid_existing_dir_path,
58
        help="path to a directory containing user documentation and/or licenses.",
59
    )
60
    parser.add_argument(
×
61
        "--models",
62
        "-m",
63
        type=valid_existing_path,
64
        help="path to a model file or a directory containing all models as subdirectories",
65
    )
66
    parser.add_argument(
×
67
        "--platform",
68
        type=valid_platforms,
69
        required=True,
70
        help="target platform(s) for the build output separated by comma. "
71
        f"Valid values: {str.join(', ', SDK.PLATFORMS)}.",
72
    )
73
    parser.add_argument(
×
74
        "--add",
75
        action="append",
76
        dest="additional_libs",
77
        type=valid_existing_dir_path,
78
        help="include additional library files, python files into the application directory.",
79
    )
80
    parser.add_argument(
×
81
        "--timeout", type=int, help="override default application timeout"
82
    )
83
    parser.add_argument(
×
84
        "--version", type=Version, help="set the version of the application"
85
    )
86

87
    advanced_group = parser.add_argument_group(title="advanced build options")
×
NEW
88
    advanced_group.add_argument(
×
89
        "--add-host",
90
        action="append",
91
        dest="add_hosts",
92
        type=validate_host_ip,
93
        help="Add a custom host-to-IP mapping (format: host:ip).",
94
    )
UNCOV
95
    advanced_group.add_argument(
×
96
        "--base-image",
97
        type=str,
98
        help="base image name for the packaged application.",
99
    )
100
    advanced_group.add_argument(
×
101
        "--build-image",
102
        type=str,
103
        help="container image name for building the C++ application.",
104
    )
105
    advanced_group.add_argument(
×
106
        "--includes",
107
        nargs="*",
108
        default=[],
109
        choices=["debug", "holoviz", "torch", "onnx"],
110
        help="additional packages to include in the container.",
111
    )
112
    advanced_group.add_argument(
×
113
        "--build-cache",
114
        type=valid_dir_path,
115
        default="~/.holoscan_build_cache",
116
        help="path of the local directory where build cache gets stored.",
117
    )
118
    advanced_group.add_argument(
×
119
        "--cmake-args",
120
        type=str,
121
        help='additional CMAKE build arguments. E.g. "-DCMAKE_BUILD_TYPE=DEBUG -DCMAKE_ARG=VALUE"',
122
    )
123
    advanced_group.add_argument(
×
124
        "--holoscan-sdk-file",
125
        type=valid_existing_path,
126
        help="path to the Holoscan SDK Debian or PyPI package. "
127
        "If not specified, the packager downloads "
128
        "the SDK file from the internet based on the SDK version.",
129
    )
130
    advanced_group.add_argument(
×
131
        "--monai-deploy-sdk-file",
132
        type=valid_existing_path,
133
        help="path to the MONAI Deploy App SDK PyPI package. "
134
        "If not specified, the packager downloads "
135
        "the SDK file from the internet based on the SDK version.",
136
    )
137
    advanced_group.add_argument(
×
138
        "--no-cache",
139
        "-n",
140
        dest="no_cache",
141
        action="store_true",
142
        help="do not use cache when building image",
143
    )
144
    advanced_group.add_argument(
×
145
        "--sdk",
146
        type=valid_sdk_type,
147
        help="SDK for building the application: Holoscan or MONAI-Deploy. "
148
        f"Valid values: {str.join(', ', SDK.SDKS)}.",
149
    )
150
    advanced_group.add_argument(
×
151
        "--source",
152
        type=str,
153
        help="override Debian package, build container image and run container image from a "
154
        "JSON formatted file or a secured web server (HTTPS).",
155
    )
156
    advanced_group.add_argument(
×
157
        "--sdk-version",
158
        type=Version,
159
        help="set the version of the SDK that is used to build and package the application. "
160
        "If not specified, the packager attempts to detect the installed version.",
161
    )
162

163
    output_group = parser.add_argument_group(title="output options")
×
164
    output_group.add_argument(
×
165
        "--output",
166
        "-o",
167
        type=valid_existing_dir_path,
168
        help="output directory where result images will be written.",
169
    )
170
    output_group.add_argument(
×
171
        "--tag",
172
        "-t",
173
        required=True,
174
        type=str,
175
        help="name of the image and a optional tag (format: name[:tag]).",
176
    )
177

178
    user_group = parser.add_argument_group(title="security options")
×
179
    user_group.add_argument(
×
180
        "--username",
181
        type=str,
182
        default="holoscan",
183
        help="username to be created in the container execution context.",
184
    )
185
    user_group.add_argument(
×
186
        "--uid",
187
        type=str,
188
        default=1000,
189
        help="UID associated with the username.  (default:1000)",
190
    )
191
    user_group.add_argument(
×
192
        "--gid",
193
        type=str,
194
        default=1000,
195
        help="GID associated with the username. (default:1000)",
196
    )
197
    parser.set_defaults(no_cache=False)
×
198
    return parser
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc