Skip to content

Commit 714fa48

Browse files
committed
add a scriptlet to put cuopt_grpc_server on the default path
1 parent 24fdb60 commit 714fa48

4 files changed

Lines changed: 50 additions & 0 deletions

File tree

conda/recipes/cuopt-server/recipe.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@ tests:
4848
imports:
4949
- cuopt_server
5050
pip_check: false
51+
- package_contents:
52+
files:
53+
- bin/cuopt_grpc_server
5154

5255
about:
5356
homepage: ${{ load_from_file("python/cuopt_server/pyproject.toml").project.urls.Homepage }}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
import os
5+
import subprocess
6+
import sys
7+
8+
9+
def main():
10+
"""
11+
Wrapper that launches the cuopt_grpc_server binary from the libcuopt package.
12+
"""
13+
import libcuopt
14+
15+
server_path = os.path.join(
16+
os.path.dirname(libcuopt.__file__), "bin", "cuopt_grpc_server"
17+
)
18+
sys.exit(subprocess.call([server_path] + sys.argv[1:]))
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2+
# SPDX-License-Identifier: Apache-2.0
3+
4+
import shutil
5+
import subprocess
6+
7+
8+
def test_cuopt_grpc_server_on_path():
9+
assert shutil.which("cuopt_grpc_server") is not None, (
10+
"cuopt_grpc_server should be on PATH after installing cuopt-server"
11+
)
12+
13+
14+
def test_cuopt_grpc_server_help():
15+
result = subprocess.run(
16+
["cuopt_grpc_server", "--help"],
17+
capture_output=True,
18+
text=True,
19+
timeout=10,
20+
)
21+
assert result.returncode == 0, (
22+
f"cuopt_grpc_server --help failed (rc={result.returncode}): {result.stderr}"
23+
)
24+
assert "cuopt_grpc_server" in result.stdout, (
25+
f"Expected 'cuopt_grpc_server' in --help output, got: {result.stdout}"
26+
)

python/cuopt_server/pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,9 @@ test = [
5252
"requests",
5353
] # This list was generated by `rapids-dependency-file-generator`. To make changes, edit ../../dependencies.yaml and run `rapids-dependency-file-generator`.
5454

55+
[project.scripts]
56+
cuopt_grpc_server = "cuopt_server._grpc_server_wrapper:main"
57+
5558
[project.urls]
5659
Homepage = "https://docs.nvidia.com/cuopt/introduction.html"
5760
Source = "https://github.com/nvidia/cuopt"

0 commit comments

Comments
 (0)