Skip to content

Commit

Permalink
Merged with main.
Browse files Browse the repository at this point in the history
  • Loading branch information
ansmedson-ext committed Jan 30, 2025
2 parents 2afba6d + 3ac7086 commit 3a80566
Show file tree
Hide file tree
Showing 22 changed files with 495 additions and 23 deletions.
2 changes: 2 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ updates:
- "dependencies"
commit-message:
prefix: "MAINT"
ignore:
- dependency-name: "grpcio"

- package-ecosystem: "github-actions"
directory: "/"
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/ci_cd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
- main

env:
MAIN_PYTHON_VERSION: '3.10'
MAIN_PYTHON_VERSION: '3.13'
PACKAGE_NAME: 'ansys-sherlock-core'
PACKAGE_NAMESPACE: 'ansys.sherlock.core'
DOCUMENTATION_CNAME: 'sherlock.docs.pyansys.com'
Expand Down Expand Up @@ -46,7 +46,7 @@ jobs:
fail-fast: false
matrix:
os: [ ubuntu-latest, windows-latest, macos-latest ]
python-version: [ '3.10', '3.11', '3.12' ]
python-version: [ '3.10', '3.11', '3.12', '3.13' ]
should-release:
- ${{ github.event_name == 'push' && contains(github.ref, 'refs/tags') }}
exclude:
Expand All @@ -67,7 +67,7 @@ jobs:
runs-on: [ self-hosted, pysherlock ]
strategy:
matrix:
python-version: [ '3.10', '3.11', '3.12' ]
python-version: [ '3.10', '3.11', '3.12', '3.13' ]

steps:
- uses: actions/checkout@v4
Expand Down
1 change: 1 addition & 0 deletions doc/changelog.d/469.documentation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
chore: update CHANGELOG for v0.8.0
1 change: 1 addition & 0 deletions doc/changelog.d/477.documentation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
docs: Updated documentation in update potting region.
1 change: 1 addition & 0 deletions doc/changelog.d/478.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
feat: add Analysis.update_component_failure_mechanism_analysis_props()
1 change: 1 addition & 0 deletions doc/changelog.d/479.documentation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MAINT: bump ansys-sphinx-theme from 1.2.3 to 1.2.4
1 change: 1 addition & 0 deletions doc/changelog.d/481.documentation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MAINT: Add support for Python 3.13
1 change: 1 addition & 0 deletions doc/changelog.d/482.documentation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MAINT: bump grpcio from 1.67.1 to 1.69.0
1 change: 1 addition & 0 deletions doc/changelog.d/483.documentation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MAINT: bump ansys-sphinx-theme from 1.2.4 to 1.2.6
1 change: 1 addition & 0 deletions doc/changelog.d/485.documentation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MAINT: Revert grpcio version for tests. Modify dependabot.yml so it doesn't update grpcio dependencies
1 change: 1 addition & 0 deletions doc/changelog.d/488.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
feat: New API update_semiconductor_wearout_props()
1 change: 1 addition & 0 deletions doc/changelog.d/489.documentation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
chore: update CHANGELOG for v0.8.2
1 change: 1 addition & 0 deletions doc/changelog.d/490.documentation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MAINT: bump ansys-api-sherlock from 0.1.37 to 0.1.38
4 changes: 4 additions & 0 deletions doc/source/api/analysis_types.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,7 @@ Constants
:members:
.. autoclass:: UpdatePcbModelingPropsRequestPcbModelType
:members:
.. autoclass:: ComponentFailureMechanism
:members:
.. autoclass:: UpdateComponentFailureMechanismPropsRequest
:members:
8 changes: 8 additions & 0 deletions doc/source/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,14 @@ This document contains the release notes for the project.
.. towncrier release notes start
`0.8.2 <https://github.com/ansys/pysherlock/releases/tag/v0.8.2>`_ - 2025-01-20
===============================================================================

Documentation
^^^^^^^^^^^^^

- fix: changed Launcher.launch_sherlock() to properly append sherlock_command_args `#487 <https://github.com/ansys/pysherlock/pull/487>`_

`0.8.1 <https://github.com/ansys/pysherlock/releases/tag/v0.8.1>`_ - 2024-12-10
===============================================================================

Expand Down
9 changes: 5 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "flit_core.buildapi"

[project]
name = "ansys-sherlock-core"
version = "0.3.dev0"
version = "0.9.dev0"
description = "A python wrapper for Ansys Sherlock"
readme = "README.rst"
requires-python = ">=3.10,<4"
Expand All @@ -20,24 +20,25 @@ classifiers = [
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
]

dependencies = [
"ansys-api-sherlock==0.1.35",
"ansys-api-sherlock==0.1.38",
"grpcio>=1.17, <1.68.0",
"protobuf>=3.20",
"pydantic>=2.9.2",
]

[project.optional-dependencies]
tests = [
"grpcio==1.67.1",
"grpcio>=1.17, <1.68.0",
"protobuf==5.28.0",
"pytest==8.3.4",
"pytest-cov==6.0.0",
]
doc = [
"ansys-sphinx-theme==1.2.3",
"ansys-sphinx-theme==1.2.6",
"numpydoc==1.8.0",
"Sphinx==8.1.3", # BLOCKED BY sphinx-design - Cannot upgrade to Sphinx 7 for now
"sphinx-copybutton==0.5.2",
Expand Down
139 changes: 138 additions & 1 deletion src/ansys/sherlock/core/analysis.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Copyright (C) 2023-2024 ANSYS, Inc. and/or its affiliates.
# Copyright (C) 2023-2025 ANSYS, Inc. and/or its affiliates.

"""Module containing all analysis capabilities."""
from typing import Optional
Expand All @@ -10,15 +10,19 @@
ModelSource,
RunAnalysisRequestAnalysisType,
RunStrainMapAnalysisRequestAnalysisType,
UpdateComponentFailureMechanismPropsRequest,
UpdatePcbModelingPropsRequestAnalysisType,
UpdatePcbModelingPropsRequestPcbMaterialModel,
UpdatePcbModelingPropsRequestPcbModelType,
UpdateSemiconductorWearoutAnalysisPropsRequest,
)

try:
import SherlockAnalysisService_pb2
import SherlockAnalysisService_pb2_grpc
import SherlockCommonService_pb2
except ModuleNotFoundError:
from ansys.api.sherlock.v0 import SherlockCommonService_pb2
from ansys.api.sherlock.v0 import SherlockAnalysisService_pb2
from ansys.api.sherlock.v0 import SherlockAnalysisService_pb2_grpc

Expand Down Expand Up @@ -2166,3 +2170,136 @@ def get_parts_list_validation_analysis_props(
except SherlockGetPartsListValidationAnalysisPropsError as e:
LOG.error(str(e))
raise e

@require_version(252)
def update_component_failure_mechanism_analysis_props(
self,
request: UpdateComponentFailureMechanismPropsRequest,
) -> list[SherlockCommonService_pb2.ReturnCode]:
r"""Update properties for one or more Component Failure Mechanism analysis.
Parameters
----------
request: UpdateComponentFailureMechanismPropsRequest
Contains all the information needed to update the properties for one or more component
failure mechanism analyses per project.
Returns
-------
list[SherlockCommonService_pb2.ReturnCode]
Return codes for each request.
Examples
--------
>>> from ansys.sherlock.core.launcher import launch_sherlock
>>> from ansys.sherlock.core.types.analysis_types import (
ComponentFailureMechanism,
UpdateComponentFailureMechanismPropsRequest,
)
>>> sherlock = launch_sherlock()
>>> sherlock.project.import_project_zip_archive(
project="Assembly Tutorial",
category="category",
archive_file=\
"C:\\Program Files\\ANSYS Inc\\v252\\sherlock\\tutorial\\Assembly Tutorial.zip",
)
>>> update_request1 = ComponentFailureMechanism(
cca_name="Main Board",
default_part_temp_rise=1.5,
default_part_temp_rise_units="K",
part_temp_rise_min_enabled=True,
part_validation_enabled=False,
)
>>> update_request2 = ComponentFailureMechanism(
cca_name="Memory Card 1",
default_part_temp_rise=-3.25,
default_part_temp_rise_units="F",
part_temp_rise_min_enabled=False,
part_validation_enabled=True,
)
>>> request = UpdateComponentFailureMechanismPropsRequest(
project="Test",
component_failure_mechanism_properties_per_cca=[
update_request1,
update_request2
]
)
>>> return_codes = sherlock.analysis.\
update_component_failure_mechanism_analysis_props(request)
>>> for return_code in return_codes:
print(f"Return code: value={return_code.value}, message={return_code.message}")
"""
update_request = request._convert_to_grpc()

responses = []
for return_code in self.stub.updateComponentFailureMechanismProps(update_request):
responses.append(return_code)
return responses

@require_version(252)
def update_semiconductor_wearout_props(
self,
request: UpdateSemiconductorWearoutAnalysisPropsRequest,
) -> list[SherlockCommonService_pb2.ReturnCode]:
r"""Update properties for one or more Semiconductor Wearout Analysis.
Parameters
----------
request: UpdateSemiconductorWearoutAnalysisPropsRequest
Contains all the information needed to update the properties for one or more
semiconductor wearout analyses per project.
Returns
-------
list[SherlockCommonService_pb2.ReturnCode]
Return codes for each request.
Examples
--------
>>> from ansys.sherlock.core.launcher import launch_sherlock
>>> from ansys.sherlock.core.types.analysis_types import (
SemiconductorWearoutAnalysis,
UpdateSemiconductorWearoutAnalysisPropsRequest,
)
>>> sherlock = launch_sherlock()
>>> sherlock.project.import_project_zip_archive(
project="Assembly Tutorial",
category="category",
archive_file=\
"C:\\Program Files\\ANSYS Inc\\v252\\sherlock\\tutorial\\Assembly Tutorial.zip",
)
>>> update_request1 = SemiconductorWearoutAnalysis(
cca_name="Main Board",
max_feature_size=1.5,
max_feature_size_units="mm",
part_temp_rise=10.0,
part_temp_rise_units="C",
part_temp_rise_min_enabled=True,
part_validation_enabled=False,
)
>>> update_request2 = SemiconductorWearoutAnalysis(
cca_name="Memory Card 1",
max_feature_size=2.0,
max_feature_size_units="mm",
part_temp_rise=15.0,
part_temp_rise_units="C",
part_temp_rise_min_enabled=False,
part_validation_enabled=True,
)
>>> request = UpdateSemiconductorWearoutAnalysisPropsRequest(
project="Test",
semiconductor_wearout_analysis_properties=[
update_request1,
update_request2
]
)
>>> return_codes = sherlock.analysis.update_semiconductor_wearout_props(request)
>>> for return_code in return_codes:
print(f"Return code: value={return_code.value}, message={return_code.message}")
"""
update_request = request._convert_to_grpc()

responses = []
for return_code in self.stub.updateSemiconductorWearoutAnalysisProps(update_request):
responses.append(return_code)
return responses
6 changes: 3 additions & 3 deletions src/ansys/sherlock/core/launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def launch_sherlock(
try:
_is_port_available(host, port)
except Exception as e:
print(str(e))
LOG.error(str(e))
raise e

_server_version = None
Expand All @@ -95,8 +95,8 @@ def launch_sherlock(
args.append("-singleProject")
args.append(single_project_path)
if sherlock_command_args != "":
args.append(f"{shlex.split(sherlock_command_args)}")
print(args)
args.extend(shlex.split(sherlock_command_args))
LOG.info(f"Command arguments: {args}")
subprocess.Popen(args)

sherlock = connect_grpc_channel(port, _server_version)
Expand Down
17 changes: 10 additions & 7 deletions src/ansys/sherlock/core/layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ def update_potting_region(
>>> from ansys.sherlock.core.types.layer_types import PottingRegion
>>> sherlock = launch_sherlock()
>>>
>>> update_request1 = PottingRegionUpdateData(
>>> update1 = PottingRegionUpdateData(
potting_region_id_to_update=potting_id,
potting_region=PottingRegionData(
cca_name=cca_name,
Expand All @@ -300,7 +300,7 @@ def update_potting_region(
)
)
)
>>> update_request2 = PottingRegionUpdateData(
>>> update2 = PottingRegionUpdateData(
potting_region_id_to_update=potting_id,
potting_region=PottingRegionData(
cca_name=cca_name,
Expand All @@ -316,11 +316,14 @@ def update_potting_region(
)
)
)
>>> potting_region_requests = [
update_request1,
update_request2
]
>>> return_codes = sherlock.layer.update_potting_region(request)
>>> example_request = UpdatePottingRegionRequest(
"project_name",
[
update1,
update2
]
)
>>> return_codes = sherlock.layer.update_potting_region(example_request)
"""
update_request = request._convert_to_grpc()

Expand Down
Loading

0 comments on commit 3a80566

Please sign in to comment.