From f18e80745f4f3232ba54c9b3cd2a5a91e4709bb6 Mon Sep 17 00:00:00 2001 From: rward Date: Fri, 12 Sep 2025 09:01:36 -0400 Subject: [PATCH 01/10] feat: for 261 dotnet 8 is included in core service --- .../core/connection/product_instance.py | 51 +++++++++++-------- 1 file changed, 30 insertions(+), 21 deletions(-) diff --git a/src/ansys/geometry/core/connection/product_instance.py b/src/ansys/geometry/core/connection/product_instance.py index 45fe9ce773..0e2bc36ca6 100644 --- a/src/ansys/geometry/core/connection/product_instance.py +++ b/src/ansys/geometry/core/connection/product_instance.py @@ -464,29 +464,38 @@ def prepare_and_start_backend( # Verify dotnet is installed import shutil - if not shutil.which("dotnet"): - raise RuntimeError( - "Cannot find 'dotnet' command. " - "Please install 'dotnet' to use the Ansys Geometry Core Service. " - "At least dotnet 8.0 is required." + if version < 261: # Only execute this block if version is less than 261 + if not shutil.which("dotnet"): + raise RuntimeError( + "Cannot find 'dotnet' command. " + "Please install 'dotnet' to use the Ansys Geometry Core Service. " + "At least dotnet 8.0 is required." + ) + + # At least dotnet 8.0 is required + # private method and controlled input by library - excluding bandit check. + if subprocess.check_output(["dotnet", "--version"]).decode("utf-8").split(".")[0] < "8": # nosec B607, B603 + raise RuntimeError( + "Ansys Geometry Core Service requires at least dotnet 8.0. " + "Please install a compatible version." + ) + + # For Linux, we need to use the dotnet command to launch the Core Geometry Service + args.append("dotnet") + args.append( + Path( + root_service_folder, + CORE_GEOMETRY_SERVICE_EXE.replace(".exe", ".dll"), + ) ) - - # At least dotnet 8.0 is required - # private method and controlled input by library - excluding bandit check. - if subprocess.check_output(["dotnet", "--version"]).decode("utf-8").split(".")[0] < "8": # nosec B607, B603 - raise RuntimeError( - "Ansys Geometry Core Service requires at least dotnet 8.0. " - "Please install a compatible version." + if version >= 261: + # For Linux, we need to use the exe file to launch the Core Geometry Service + args.append( + Path( + root_service_folder, + CORE_GEOMETRY_SERVICE_EXE.replace(".exe", ""), + ) ) - - # For Linux, we need to use the dotnet command to launch the Core Geometry Service - args.append("dotnet") - args.append( - Path( - root_service_folder, - CORE_GEOMETRY_SERVICE_EXE.replace(".exe", ".dll"), - ) - ) else: raise RuntimeError( f"Cannot connect to backend {backend_type.name} using ``prepare_and_start_backend()``" From 23d6b10dd4847240d951f81556d1f78398454877 Mon Sep 17 00:00:00 2001 From: pyansys-ci-bot <92810346+pyansys-ci-bot@users.noreply.github.com> Date: Fri, 12 Sep 2025 13:04:08 +0000 Subject: [PATCH 02/10] chore: adding changelog file 2226.added.md [dependabot-skip] --- doc/changelog.d/2226.added.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 doc/changelog.d/2226.added.md diff --git a/doc/changelog.d/2226.added.md b/doc/changelog.d/2226.added.md new file mode 100644 index 0000000000..c7624826b3 --- /dev/null +++ b/doc/changelog.d/2226.added.md @@ -0,0 +1 @@ +For 261 dotnet 8 is included in core service From 545f4825f5b4967493f51943be0c3a5e2cf5ee19 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Fri, 12 Sep 2025 13:04:12 +0000 Subject: [PATCH 03/10] chore: auto fixes from pre-commit hooks --- src/ansys/geometry/core/connection/product_instance.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ansys/geometry/core/connection/product_instance.py b/src/ansys/geometry/core/connection/product_instance.py index 0e2bc36ca6..f620f732b0 100644 --- a/src/ansys/geometry/core/connection/product_instance.py +++ b/src/ansys/geometry/core/connection/product_instance.py @@ -474,7 +474,10 @@ def prepare_and_start_backend( # At least dotnet 8.0 is required # private method and controlled input by library - excluding bandit check. - if subprocess.check_output(["dotnet", "--version"]).decode("utf-8").split(".")[0] < "8": # nosec B607, B603 + if ( + subprocess.check_output(["dotnet", "--version"]).decode("utf-8").split(".")[0] + < "8" + ): # nosec B607, B603 raise RuntimeError( "Ansys Geometry Core Service requires at least dotnet 8.0. " "Please install a compatible version." From 6c06d8682292722f53cdc648ef8c3147c0f3f579 Mon Sep 17 00:00:00 2001 From: rward Date: Tue, 16 Sep 2025 07:24:49 -0400 Subject: [PATCH 04/10] remove version check --- .../geometry/core/connection/product_instance.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/ansys/geometry/core/connection/product_instance.py b/src/ansys/geometry/core/connection/product_instance.py index 0e2bc36ca6..dad2aec762 100644 --- a/src/ansys/geometry/core/connection/product_instance.py +++ b/src/ansys/geometry/core/connection/product_instance.py @@ -463,15 +463,16 @@ def prepare_and_start_backend( else: # Verify dotnet is installed import shutil - - if version < 261: # Only execute this block if version is less than 261 + if not any( + CORE_GEOMETRY_SERVICE_EXE.replace(".exe", "") in file.name + for file in Path(root_service_folder).iterdir() + ): if not shutil.which("dotnet"): raise RuntimeError( "Cannot find 'dotnet' command. " "Please install 'dotnet' to use the Ansys Geometry Core Service. " "At least dotnet 8.0 is required." ) - # At least dotnet 8.0 is required # private method and controlled input by library - excluding bandit check. if subprocess.check_output(["dotnet", "--version"]).decode("utf-8").split(".")[0] < "8": # nosec B607, B603 @@ -479,7 +480,6 @@ def prepare_and_start_backend( "Ansys Geometry Core Service requires at least dotnet 8.0. " "Please install a compatible version." ) - # For Linux, we need to use the dotnet command to launch the Core Geometry Service args.append("dotnet") args.append( @@ -488,7 +488,10 @@ def prepare_and_start_backend( CORE_GEOMETRY_SERVICE_EXE.replace(".exe", ".dll"), ) ) - if version >= 261: + if any( + CORE_GEOMETRY_SERVICE_EXE.replace(".exe", "") in file.name + for file in Path(root_service_folder).iterdir() + ): # For Linux, we need to use the exe file to launch the Core Geometry Service args.append( Path( From 6320749ffc98c56f101d0ef51f5c5ede76228fa1 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 16 Sep 2025 11:28:45 +0000 Subject: [PATCH 05/10] chore: auto fixes from pre-commit hooks --- src/ansys/geometry/core/connection/product_instance.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ansys/geometry/core/connection/product_instance.py b/src/ansys/geometry/core/connection/product_instance.py index 8ab63e0b4c..99d3bd957d 100644 --- a/src/ansys/geometry/core/connection/product_instance.py +++ b/src/ansys/geometry/core/connection/product_instance.py @@ -463,6 +463,7 @@ def prepare_and_start_backend( else: # Verify dotnet is installed import shutil + if not any( CORE_GEOMETRY_SERVICE_EXE.replace(".exe", "") in file.name for file in Path(root_service_folder).iterdir() From 3e1a013ccf6a50dd890c12756be73f8bba395cbe Mon Sep 17 00:00:00 2001 From: rward Date: Tue, 16 Sep 2025 08:14:56 -0400 Subject: [PATCH 06/10] fix warning --- src/ansys/geometry/core/connection/product_instance.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/ansys/geometry/core/connection/product_instance.py b/src/ansys/geometry/core/connection/product_instance.py index 8ab63e0b4c..dad2aec762 100644 --- a/src/ansys/geometry/core/connection/product_instance.py +++ b/src/ansys/geometry/core/connection/product_instance.py @@ -475,10 +475,7 @@ def prepare_and_start_backend( ) # At least dotnet 8.0 is required # private method and controlled input by library - excluding bandit check. - if ( - subprocess.check_output(["dotnet", "--version"]).decode("utf-8").split(".")[0] - < "8" - ): # nosec B607, B603 + if subprocess.check_output(["dotnet", "--version"]).decode("utf-8").split(".")[0] < "8": # nosec B607, B603 raise RuntimeError( "Ansys Geometry Core Service requires at least dotnet 8.0. " "Please install a compatible version." From 782b4c2ccff00f904972fc823c794e155c7465d7 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 16 Sep 2025 12:15:45 +0000 Subject: [PATCH 07/10] chore: auto fixes from pre-commit hooks --- src/ansys/geometry/core/connection/product_instance.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/ansys/geometry/core/connection/product_instance.py b/src/ansys/geometry/core/connection/product_instance.py index fb7ed7c433..e39ecaa1e4 100644 --- a/src/ansys/geometry/core/connection/product_instance.py +++ b/src/ansys/geometry/core/connection/product_instance.py @@ -477,7 +477,10 @@ def prepare_and_start_backend( ) # At least dotnet 8.0 is required # private method and controlled input by library - excluding bandit check. - if subprocess.check_output(["dotnet", "--version"]).decode("utf-8").split(".")[0] < "8": # nosec B607, B603 + if ( + subprocess.check_output(["dotnet", "--version"]).decode("utf-8").split(".")[0] + < "8" + ): # nosec B607, B603 raise RuntimeError( "Ansys Geometry Core Service requires at least dotnet 8.0. " "Please install a compatible version." From f2bb30d28568506b2a3f33e8e29d117cbbaded18 Mon Sep 17 00:00:00 2001 From: rward Date: Tue, 16 Sep 2025 08:17:54 -0400 Subject: [PATCH 08/10] move comment --- src/ansys/geometry/core/connection/product_instance.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ansys/geometry/core/connection/product_instance.py b/src/ansys/geometry/core/connection/product_instance.py index e39ecaa1e4..269b45c583 100644 --- a/src/ansys/geometry/core/connection/product_instance.py +++ b/src/ansys/geometry/core/connection/product_instance.py @@ -478,9 +478,9 @@ def prepare_and_start_backend( # At least dotnet 8.0 is required # private method and controlled input by library - excluding bandit check. if ( - subprocess.check_output(["dotnet", "--version"]).decode("utf-8").split(".")[0] + subprocess.check_output(["dotnet", "--version"]).decode("utf-8").split(".")[0] # nosec B607, B603 < "8" - ): # nosec B607, B603 + ): raise RuntimeError( "Ansys Geometry Core Service requires at least dotnet 8.0. " "Please install a compatible version." From 2191c10e9d822ee07f9e7a282180ffbf5ab91341 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 16 Sep 2025 12:18:09 +0000 Subject: [PATCH 09/10] chore: auto fixes from pre-commit hooks --- src/ansys/geometry/core/connection/product_instance.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/ansys/geometry/core/connection/product_instance.py b/src/ansys/geometry/core/connection/product_instance.py index 269b45c583..a1d5a68691 100644 --- a/src/ansys/geometry/core/connection/product_instance.py +++ b/src/ansys/geometry/core/connection/product_instance.py @@ -478,9 +478,9 @@ def prepare_and_start_backend( # At least dotnet 8.0 is required # private method and controlled input by library - excluding bandit check. if ( - subprocess.check_output(["dotnet", "--version"]).decode("utf-8").split(".")[0] # nosec B607, B603 + subprocess.check_output(["dotnet", "--version"]).decode("utf-8").split(".")[0] # nosec B607, B603 < "8" - ): + ): raise RuntimeError( "Ansys Geometry Core Service requires at least dotnet 8.0. " "Please install a compatible version." From 913fbe2128f0e7299ea6a1372bd3f0c05801ec71 Mon Sep 17 00:00:00 2001 From: rward Date: Tue, 16 Sep 2025 09:45:35 -0400 Subject: [PATCH 10/10] address comment --- src/ansys/geometry/core/connection/product_instance.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/ansys/geometry/core/connection/product_instance.py b/src/ansys/geometry/core/connection/product_instance.py index 269b45c583..f2bc7b0745 100644 --- a/src/ansys/geometry/core/connection/product_instance.py +++ b/src/ansys/geometry/core/connection/product_instance.py @@ -493,10 +493,7 @@ def prepare_and_start_backend( CORE_GEOMETRY_SERVICE_EXE.replace(".exe", ".dll"), ) ) - if any( - CORE_GEOMETRY_SERVICE_EXE.replace(".exe", "") in file.name - for file in Path(root_service_folder).iterdir() - ): + else: # For Linux, we need to use the exe file to launch the Core Geometry Service args.append( Path(