diff --git a/src/ansys/geometry/core/_grpc/_services/v0/admin.py b/src/ansys/geometry/core/_grpc/_services/v0/admin.py index 583c796f0c..902a9a6b49 100644 --- a/src/ansys/geometry/core/_grpc/_services/v0/admin.py +++ b/src/ansys/geometry/core/_grpc/_services/v0/admin.py @@ -87,6 +87,7 @@ def get_backend(self, **kwargs) -> dict: # noqa: D102 "version": backend_version, "api_server_build_info": api_server_build_info, "product_build_info": product_build_info, + "additional_info": {k: v for k, v in response.additional_build_info.items()}, } @protect_grpc diff --git a/src/ansys/geometry/core/connection/client.py b/src/ansys/geometry/core/connection/client.py index a1a5d18fa8..40047242f9 100644 --- a/src/ansys/geometry/core/connection/client.py +++ b/src/ansys/geometry/core/connection/client.py @@ -229,6 +229,7 @@ def __init__( self._backend_version = response.get("version") self._backend_api_server_build_info = response.get("api_server_build_info") self._backend_product_build_info = response.get("product_build_info") + self._backend_additional_info = response.get("additional_info", {}) # Register the close method to be called at exit - irrespectively of # the user calling it or not... @@ -313,12 +314,23 @@ def backend_info(self, indent=0) -> str: str String with the backend information. """ - return ( + base_info = ( f"{' ' * indent}Version: {self.backend_version}\n" f"{' ' * indent}Backend type: {self.backend_type.name}\n" f"{' ' * indent}Backend number: {self._backend_product_build_info}\n" f"{' ' * indent}API server number: {self._backend_api_server_build_info}" ) + if self._backend_additional_info: + # Calculate padding to align values consistently + # (19 chars total for label + colon + spaces) + additional_info_lines = [ + f"{' ' * indent}{key + ':':<19}{value}" + for key, value in self._backend_additional_info.items() + ] + additional_info_str = "\n".join(additional_info_lines) + return f"{base_info}\n{additional_info_str}" + else: # pragma: no cover + return base_info def __repr__(self) -> str: """Represent the client as a string.""" diff --git a/tests/integration/test_client.py b/tests/integration/test_client.py index 76b6678b2c..b99956c4a4 100644 --- a/tests/integration/test_client.py +++ b/tests/integration/test_client.py @@ -58,6 +58,11 @@ def test_client_backend_info(client: GrpcClient): assert "Backend number" in backend_info assert "API server number" in backend_info + # Additional info may or may not be present depending on the backend version + if client._backend_additional_info: + for key in client._backend_additional_info.keys(): + assert key in backend_info + def test_client_through_channel(modeler: Modeler): """Test the instantiation of a client from a gRPC channel."""