From 714fa480a134483e399f5290c5bd16a6da76e795 Mon Sep 17 00:00:00 2001 From: Trevor McKay Date: Tue, 14 Apr 2026 11:52:33 -0400 Subject: [PATCH 1/4] add a scriptlet to put cuopt_grpc_server on the default path --- conda/recipes/cuopt-server/recipe.yaml | 3 +++ .../cuopt_server/_grpc_server_wrapper.py | 18 +++++++++++++ .../tests/test_grpc_server_entry_point.py | 26 +++++++++++++++++++ python/cuopt_server/pyproject.toml | 3 +++ 4 files changed, 50 insertions(+) create mode 100644 python/cuopt_server/cuopt_server/_grpc_server_wrapper.py create mode 100644 python/cuopt_server/cuopt_server/tests/test_grpc_server_entry_point.py diff --git a/conda/recipes/cuopt-server/recipe.yaml b/conda/recipes/cuopt-server/recipe.yaml index 58227487f8..91bee36bc0 100644 --- a/conda/recipes/cuopt-server/recipe.yaml +++ b/conda/recipes/cuopt-server/recipe.yaml @@ -48,6 +48,9 @@ tests: imports: - cuopt_server pip_check: false + - package_contents: + files: + - bin/cuopt_grpc_server about: homepage: ${{ load_from_file("python/cuopt_server/pyproject.toml").project.urls.Homepage }} diff --git a/python/cuopt_server/cuopt_server/_grpc_server_wrapper.py b/python/cuopt_server/cuopt_server/_grpc_server_wrapper.py new file mode 100644 index 0000000000..5a1386d76b --- /dev/null +++ b/python/cuopt_server/cuopt_server/_grpc_server_wrapper.py @@ -0,0 +1,18 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +import os +import subprocess +import sys + + +def main(): + """ + Wrapper that launches the cuopt_grpc_server binary from the libcuopt package. + """ + import libcuopt + + server_path = os.path.join( + os.path.dirname(libcuopt.__file__), "bin", "cuopt_grpc_server" + ) + sys.exit(subprocess.call([server_path] + sys.argv[1:])) diff --git a/python/cuopt_server/cuopt_server/tests/test_grpc_server_entry_point.py b/python/cuopt_server/cuopt_server/tests/test_grpc_server_entry_point.py new file mode 100644 index 0000000000..957af7bf4b --- /dev/null +++ b/python/cuopt_server/cuopt_server/tests/test_grpc_server_entry_point.py @@ -0,0 +1,26 @@ +# SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +import shutil +import subprocess + + +def test_cuopt_grpc_server_on_path(): + assert shutil.which("cuopt_grpc_server") is not None, ( + "cuopt_grpc_server should be on PATH after installing cuopt-server" + ) + + +def test_cuopt_grpc_server_help(): + result = subprocess.run( + ["cuopt_grpc_server", "--help"], + capture_output=True, + text=True, + timeout=10, + ) + assert result.returncode == 0, ( + f"cuopt_grpc_server --help failed (rc={result.returncode}): {result.stderr}" + ) + assert "cuopt_grpc_server" in result.stdout, ( + f"Expected 'cuopt_grpc_server' in --help output, got: {result.stdout}" + ) diff --git a/python/cuopt_server/pyproject.toml b/python/cuopt_server/pyproject.toml index ce96c884be..da89a4f1bd 100644 --- a/python/cuopt_server/pyproject.toml +++ b/python/cuopt_server/pyproject.toml @@ -52,6 +52,9 @@ test = [ "requests", ] # This list was generated by `rapids-dependency-file-generator`. To make changes, edit ../../dependencies.yaml and run `rapids-dependency-file-generator`. +[project.scripts] +cuopt_grpc_server = "cuopt_server._grpc_server_wrapper:main" + [project.urls] Homepage = "https://docs.nvidia.com/cuopt/introduction.html" Source = "https://github.com/nvidia/cuopt" From e1ec778bf68a675c4e94668be9973db07cc9bffe Mon Sep 17 00:00:00 2001 From: Ramakrishnap <42624703+rgsl888prabhu@users.noreply.github.com> Date: Tue, 14 Apr 2026 14:45:22 -0500 Subject: [PATCH 2/4] Update python/cuopt_server/cuopt_server/tests/test_grpc_server_entry_point.py --- .../cuopt_server/tests/test_grpc_server_entry_point.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/cuopt_server/cuopt_server/tests/test_grpc_server_entry_point.py b/python/cuopt_server/cuopt_server/tests/test_grpc_server_entry_point.py index 957af7bf4b..56f12a4d6c 100644 --- a/python/cuopt_server/cuopt_server/tests/test_grpc_server_entry_point.py +++ b/python/cuopt_server/cuopt_server/tests/test_grpc_server_entry_point.py @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 import shutil From 1d3fa00a2a5739a7504aa2cf87baeb1f0affdb7b Mon Sep 17 00:00:00 2001 From: Ramakrishnap <42624703+rgsl888prabhu@users.noreply.github.com> Date: Tue, 14 Apr 2026 14:45:30 -0500 Subject: [PATCH 3/4] Update python/cuopt_server/cuopt_server/_grpc_server_wrapper.py --- python/cuopt_server/cuopt_server/_grpc_server_wrapper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python/cuopt_server/cuopt_server/_grpc_server_wrapper.py b/python/cuopt_server/cuopt_server/_grpc_server_wrapper.py index 5a1386d76b..8cb5c0ba0b 100644 --- a/python/cuopt_server/cuopt_server/_grpc_server_wrapper.py +++ b/python/cuopt_server/cuopt_server/_grpc_server_wrapper.py @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: Copyright (c) 2025-2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. # SPDX-License-Identifier: Apache-2.0 import os From acf7b80e2006f40355d591f84b07313118dea88e Mon Sep 17 00:00:00 2001 From: Trevor McKay Date: Thu, 16 Apr 2026 13:01:39 -0400 Subject: [PATCH 4/4] move cuopt_grpc_server scriptlet to libcuopt pyproject --- conda/recipes/cuopt-server/recipe.yaml | 3 --- .../tests/test_grpc_server_entry_point.py | 7 ++++--- python/cuopt_server/pyproject.toml | 3 --- python/libcuopt/libcuopt/_grpc_server_wrapper.py | 16 ++++++++++++++++ python/libcuopt/pyproject.toml | 1 + 5 files changed, 21 insertions(+), 9 deletions(-) create mode 100644 python/libcuopt/libcuopt/_grpc_server_wrapper.py diff --git a/conda/recipes/cuopt-server/recipe.yaml b/conda/recipes/cuopt-server/recipe.yaml index 91bee36bc0..58227487f8 100644 --- a/conda/recipes/cuopt-server/recipe.yaml +++ b/conda/recipes/cuopt-server/recipe.yaml @@ -48,9 +48,6 @@ tests: imports: - cuopt_server pip_check: false - - package_contents: - files: - - bin/cuopt_grpc_server about: homepage: ${{ load_from_file("python/cuopt_server/pyproject.toml").project.urls.Homepage }} diff --git a/python/cuopt_server/cuopt_server/tests/test_grpc_server_entry_point.py b/python/cuopt_server/cuopt_server/tests/test_grpc_server_entry_point.py index 56f12a4d6c..942e05a392 100644 --- a/python/cuopt_server/cuopt_server/tests/test_grpc_server_entry_point.py +++ b/python/cuopt_server/cuopt_server/tests/test_grpc_server_entry_point.py @@ -18,9 +18,10 @@ def test_cuopt_grpc_server_help(): text=True, timeout=10, ) + output = f"{result.stdout}\n{result.stderr}" assert result.returncode == 0, ( - f"cuopt_grpc_server --help failed (rc={result.returncode}): {result.stderr}" + f"cuopt_grpc_server --help failed (rc={result.returncode}): {output}" ) - assert "cuopt_grpc_server" in result.stdout, ( - f"Expected 'cuopt_grpc_server' in --help output, got: {result.stdout}" + assert "cuopt_grpc_server" in output, ( + f"Expected 'cuopt_grpc_server' in --help output, got: {output}" ) diff --git a/python/cuopt_server/pyproject.toml b/python/cuopt_server/pyproject.toml index da89a4f1bd..ce96c884be 100644 --- a/python/cuopt_server/pyproject.toml +++ b/python/cuopt_server/pyproject.toml @@ -52,9 +52,6 @@ test = [ "requests", ] # This list was generated by `rapids-dependency-file-generator`. To make changes, edit ../../dependencies.yaml and run `rapids-dependency-file-generator`. -[project.scripts] -cuopt_grpc_server = "cuopt_server._grpc_server_wrapper:main" - [project.urls] Homepage = "https://docs.nvidia.com/cuopt/introduction.html" Source = "https://github.com/nvidia/cuopt" diff --git a/python/libcuopt/libcuopt/_grpc_server_wrapper.py b/python/libcuopt/libcuopt/_grpc_server_wrapper.py new file mode 100644 index 0000000000..dc60b2bbda --- /dev/null +++ b/python/libcuopt/libcuopt/_grpc_server_wrapper.py @@ -0,0 +1,16 @@ +# SPDX-FileCopyrightText: Copyright (c) 2026, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +# SPDX-License-Identifier: Apache-2.0 + +import os +import subprocess +import sys + + +def main(): + """ + This connects to the gRPC server binary situated under libcuopt/bin folder. + """ + server_path = os.path.join( + os.path.dirname(__file__), "bin", "cuopt_grpc_server" + ) + sys.exit(subprocess.call([server_path] + sys.argv[1:])) diff --git a/python/libcuopt/pyproject.toml b/python/libcuopt/pyproject.toml index 6ba41c60dd..72f0000d04 100644 --- a/python/libcuopt/pyproject.toml +++ b/python/libcuopt/pyproject.toml @@ -47,6 +47,7 @@ libcuopt = "libcuopt" [project.scripts] cuopt_cli = "libcuopt._cli_wrapper:main" +cuopt_grpc_server = "libcuopt._grpc_server_wrapper:main" [tool.pydistcheck] select = [