pyedb 0.43.0__py3-none-any.whl → 0.45.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of pyedb might be problematic. Click here for more details.

Files changed (68) hide show
  1. pyedb/__init__.py +1 -1
  2. pyedb/configuration/cfg_boundaries.py +21 -15
  3. pyedb/configuration/cfg_components.py +8 -8
  4. pyedb/configuration/cfg_general.py +14 -6
  5. pyedb/configuration/cfg_modeler.py +8 -0
  6. pyedb/configuration/cfg_operations.py +40 -1
  7. pyedb/configuration/cfg_package_definition.py +41 -1
  8. pyedb/configuration/cfg_padstacks.py +611 -256
  9. pyedb/configuration/cfg_pin_groups.py +1 -1
  10. pyedb/configuration/cfg_ports_sources.py +234 -66
  11. pyedb/configuration/cfg_s_parameter_models.py +81 -1
  12. pyedb/configuration/cfg_setup.py +167 -33
  13. pyedb/configuration/cfg_stackup.py +44 -0
  14. pyedb/configuration/configuration.py +13 -3
  15. pyedb/dotnet/database/cell/primitive/path.py +12 -0
  16. pyedb/dotnet/database/edb_data/design_options.py +19 -1
  17. pyedb/dotnet/database/edb_data/padstacks_data.py +9 -4
  18. pyedb/dotnet/database/geometry/point_data.py +26 -0
  19. pyedb/dotnet/database/geometry/polygon_data.py +13 -2
  20. pyedb/dotnet/database/nets.py +13 -3
  21. pyedb/dotnet/database/padstack.py +6 -2
  22. pyedb/dotnet/database/utilities/simulation_setup.py +7 -17
  23. pyedb/dotnet/database/utilities/siwave_simulation_setup.py +30 -0
  24. pyedb/dotnet/edb.py +41 -18
  25. pyedb/grpc/database/components.py +2 -3
  26. pyedb/grpc/database/definition/component_def.py +15 -0
  27. pyedb/grpc/database/definition/component_pin.py +1 -1
  28. pyedb/grpc/database/definition/materials.py +27 -0
  29. pyedb/grpc/database/definition/package_def.py +20 -2
  30. pyedb/grpc/database/definition/padstack_def.py +5 -2
  31. pyedb/grpc/database/hfss.py +10 -1
  32. pyedb/grpc/database/hierarchy/component.py +4 -2
  33. pyedb/grpc/database/hierarchy/pingroup.py +12 -8
  34. pyedb/grpc/database/layers/layer.py +28 -0
  35. pyedb/grpc/database/layers/stackup_layer.py +281 -40
  36. pyedb/grpc/database/layout/layout.py +12 -6
  37. pyedb/grpc/database/layout_validation.py +2 -2
  38. pyedb/grpc/database/modeler.py +8 -8
  39. pyedb/grpc/database/padstacks.py +15 -9
  40. pyedb/grpc/database/ports/ports.py +3 -3
  41. pyedb/grpc/database/primitive/bondwire.py +3 -3
  42. pyedb/grpc/database/primitive/circle.py +1 -1
  43. pyedb/grpc/database/primitive/padstack_instance.py +13 -3
  44. pyedb/grpc/database/primitive/path.py +2 -2
  45. pyedb/grpc/database/primitive/polygon.py +3 -3
  46. pyedb/grpc/database/primitive/primitive.py +1 -1
  47. pyedb/grpc/database/primitive/rectangle.py +2 -2
  48. pyedb/grpc/database/simulation_setup/hfss_simulation_setup.py +78 -30
  49. pyedb/grpc/database/simulation_setup/siwave_simulation_setup.py +73 -30
  50. pyedb/grpc/database/simulation_setup/sweep_data.py +12 -1
  51. pyedb/grpc/database/siwave.py +10 -1
  52. pyedb/grpc/database/source_excitations.py +19 -9
  53. pyedb/grpc/database/stackup.py +26 -10
  54. pyedb/grpc/database/terminal/bundle_terminal.py +3 -3
  55. pyedb/grpc/database/terminal/edge_terminal.py +95 -2
  56. pyedb/grpc/database/terminal/padstack_instance_terminal.py +42 -2
  57. pyedb/grpc/database/terminal/pingroup_terminal.py +48 -2
  58. pyedb/grpc/database/terminal/point_terminal.py +10 -1
  59. pyedb/grpc/database/terminal/terminal.py +4 -4
  60. pyedb/grpc/database/utility/hfss_extent_info.py +14 -10
  61. pyedb/grpc/edb.py +21 -17
  62. pyedb/grpc/edb_init.py +19 -15
  63. pyedb/grpc/rpc_session.py +11 -8
  64. pyedb/misc/misc.py +13 -0
  65. {pyedb-0.43.0.dist-info → pyedb-0.45.0.dist-info}/METADATA +6 -6
  66. {pyedb-0.43.0.dist-info → pyedb-0.45.0.dist-info}/RECORD +68 -68
  67. {pyedb-0.43.0.dist-info → pyedb-0.45.0.dist-info}/LICENSE +0 -0
  68. {pyedb-0.43.0.dist-info → pyedb-0.45.0.dist-info}/WHEEL +0 -0
@@ -20,10 +20,12 @@
20
20
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  # SOFTWARE.
22
22
 
23
- from ansys.edb.core.terminal.terminals import (
23
+ from ansys.edb.core.terminal.padstack_instance_terminal import (
24
24
  PadstackInstanceTerminal as GrpcPadstackInstanceTerminal,
25
25
  )
26
- from ansys.edb.core.terminal.terminals import BoundaryType as GrpcBoundaryType
26
+ from ansys.edb.core.terminal.terminal import BoundaryType as GrpcBoundaryType
27
+
28
+ from pyedb.misc.misc import deprecated_property
27
29
 
28
30
 
29
31
  class PadstackInstanceTerminal(GrpcPadstackInstanceTerminal):
@@ -45,6 +47,18 @@ class PadstackInstanceTerminal(GrpcPadstackInstanceTerminal):
45
47
  pos_x, pos_y, rotation = self.padstack_instance.get_position_and_rotation()
46
48
  return [pos_x.value, pos_y.value]
47
49
 
50
+ @property
51
+ def padstack_instance(self):
52
+ from pyedb.grpc.database.primitive.padstack_instance import PadstackInstance
53
+
54
+ return PadstackInstance(self._pedb, super().padstack_instance)
55
+
56
+ @property
57
+ def component(self):
58
+ from pyedb.grpc.database.hierarchy.component import Component
59
+
60
+ return Component(self._pedb, super().component)
61
+
48
62
  @property
49
63
  def location(self):
50
64
  """Terminal position.
@@ -169,3 +183,29 @@ class PadstackInstanceTerminal(GrpcPadstackInstanceTerminal):
169
183
  "pec": GrpcBoundaryType.PEC,
170
184
  }
171
185
  super(PadstackInstanceTerminal, self.__class__).boundary_type.__set__(self, mapping[value.name.lower()])
186
+
187
+ @property
188
+ def is_port(self):
189
+ if self.boundary_type == "port":
190
+ return True
191
+ return False
192
+
193
+ @property
194
+ @deprecated_property
195
+ def ref_terminal(self):
196
+ """Return reference terminal.
197
+
198
+ ..deprecated:: 0.43.0
199
+ Use: func:`reference_terminal` property instead.
200
+ """
201
+ self._pedb.logger.warning("ref_terminal property is deprecated, use reference_terminal property instead.")
202
+ return self.reference_terminal
203
+
204
+ @ref_terminal.setter
205
+ def ref_terminal(self, value):
206
+ if isinstance(value, PadstackInstanceTerminal):
207
+ self.reference_terminal = value
208
+
209
+ @property
210
+ def terminal_type(self):
211
+ return "PadstackInstanceTerminal"
@@ -20,10 +20,13 @@
20
20
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  # SOFTWARE.
22
22
 
23
- from ansys.edb.core.terminal.terminals import BoundaryType as GrpcBoundaryType
24
- from ansys.edb.core.terminal.terminals import PinGroupTerminal as GrpcPinGroupTerminal
23
+ from ansys.edb.core.terminal.pin_group_terminal import (
24
+ PinGroupTerminal as GrpcPinGroupTerminal,
25
+ )
26
+ from ansys.edb.core.terminal.terminal import BoundaryType as GrpcBoundaryType
25
27
 
26
28
  from pyedb.grpc.database.net.net import Net
29
+ from pyedb.misc.misc import deprecated_property
27
30
 
28
31
 
29
32
  class PinGroupTerminal(GrpcPinGroupTerminal):
@@ -56,6 +59,12 @@ class PinGroupTerminal(GrpcPinGroupTerminal):
56
59
  value = GrpcBoundaryType.VOLTAGE_PROBE
57
60
  super(PinGroupTerminal, self.__class__).boundary_type.__set__(self, value)
58
61
 
62
+ @property
63
+ def is_port(self):
64
+ if self.boundary_type == "port":
65
+ return True
66
+ return False
67
+
59
68
  @property
60
69
  def magnitude(self):
61
70
  """Source magnitude.
@@ -160,3 +169,40 @@ class PinGroupTerminal(GrpcPinGroupTerminal):
160
169
  from pyedb.grpc.database.hierarchy.pingroup import PinGroup
161
170
 
162
171
  return PinGroup(self._pedb, super().pin_group)
172
+
173
+ @property
174
+ def terminal_type(self):
175
+ return "PinGroupTerminal"
176
+
177
+ @property
178
+ @deprecated_property
179
+ def ref_terminal(self):
180
+ """Property keeping DotNet compatibility
181
+
182
+ ..deprecated:: 0.43.0
183
+ Use: func:`reference_terminal` property instead.
184
+
185
+ """
186
+ self._pedb.logger.warning("ref_terminal property is deprecated, use reference_terminal property instead.")
187
+ return PinGroupTerminal(self._pedb, self.reference_terminal)
188
+
189
+ @ref_terminal.setter
190
+ def ref_terminal(self, value):
191
+ self._pedb.logger.warning("ref_terminal is deprecated, use reference_terminal instead.")
192
+ self.reference_terminal = value
193
+
194
+ @property
195
+ def hfss_type(self):
196
+ return "circuit"
197
+
198
+ @property
199
+ def is_current_source(self):
200
+ if self.boundary_type == "current_source":
201
+ return True
202
+ return False
203
+
204
+ @property
205
+ def is_voltage_source(self):
206
+ if self.boundary_type == "voltage_source":
207
+ return True
208
+ return False
@@ -21,7 +21,7 @@
21
21
  # SOFTWARE.
22
22
 
23
23
  from ansys.edb.core.geometry.point_data import PointData as GrpcPointData
24
- from ansys.edb.core.terminal.terminals import PointTerminal as GrpcPointTerminal
24
+ from ansys.edb.core.terminal.point_terminal import PointTerminal as GrpcPointTerminal
25
25
  from ansys.edb.core.utility.value import Value as GrpcValue
26
26
 
27
27
 
@@ -97,3 +97,12 @@ class PointTerminal(GrpcPointTerminal):
97
97
  @reference_terminal.setter
98
98
  def reference_terminal(self, value):
99
99
  super(PointTerminal, self.__class__).reference_terminal.__set__(self, value)
100
+
101
+ @property
102
+ def terminal_type(self):
103
+ return "PointTerminal"
104
+
105
+ @property
106
+ def is_port(self):
107
+ """Adding DotNet compatibility."""
108
+ return True
@@ -22,10 +22,10 @@
22
22
 
23
23
  import re
24
24
 
25
- from ansys.edb.core.terminal.terminals import BoundaryType as GrpcBoundaryType
26
- from ansys.edb.core.terminal.terminals import EdgeType as GrpcEdgeType
27
- from ansys.edb.core.terminal.terminals import Terminal as GrpcTerminal
28
- from ansys.edb.core.terminal.terminals import TerminalType as GrpcTerminalType
25
+ from ansys.edb.core.terminal.edge_terminal import EdgeType as GrpcEdgeType
26
+ from ansys.edb.core.terminal.terminal import BoundaryType as GrpcBoundaryType
27
+ from ansys.edb.core.terminal.terminal import Terminal as GrpcTerminal
28
+ from ansys.edb.core.terminal.terminal import TerminalType as GrpcTerminalType
29
29
  from ansys.edb.core.utility.value import Value as GrpcValue
30
30
 
31
31
  from pyedb.dotnet.database.edb_data.padstacks_data import EDBPadstackInstance
@@ -20,7 +20,11 @@
20
20
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  # SOFTWARE.
22
22
 
23
+ from ansys.edb.core.utility.hfss_extent_info import (
24
+ HFSSExtentInfoType as GrpcHfssExtentInfoType,
25
+ )
23
26
  from ansys.edb.core.utility.hfss_extent_info import HfssExtentInfo as GrpcHfssExtentInfo
27
+ from ansys.edb.core.utility.hfss_extent_info import OpenRegionType as GrpcOpenRegionType
24
28
  from ansys.edb.core.utility.value import Value as GrpcValue
25
29
 
26
30
 
@@ -37,14 +41,14 @@ class HfssExtentInfo(GrpcHfssExtentInfo):
37
41
  self._pedb = pedb
38
42
  super().__init__()
39
43
  self.extent_type_mapping = {
40
- "bounding_box": GrpcHfssExtentInfo.HFSSExtentInfoType.BOUNDING_BOX,
41
- "conforming": GrpcHfssExtentInfo.HFSSExtentInfoType.CONFORMING,
42
- "convex_hull": GrpcHfssExtentInfo.HFSSExtentInfoType.CONVEX_HUL,
43
- "polygon": GrpcHfssExtentInfo.HFSSExtentInfoType.POLYGON,
44
+ "bounding_box": GrpcHfssExtentInfoType.BOUNDING_BOX,
45
+ "conforming": GrpcHfssExtentInfoType.CONFORMING,
46
+ "convex_hull": GrpcHfssExtentInfoType.CONVEX_HUL,
47
+ "polygon": GrpcHfssExtentInfoType.POLYGON,
44
48
  }
45
49
  self._open_region_type = {
46
- "radiation": GrpcHfssExtentInfo.OpenRegionType.RADIATION,
47
- "pml": GrpcHfssExtentInfo.OpenRegionType.PML,
50
+ "radiation": GrpcOpenRegionType.RADIATION,
51
+ "pml": GrpcOpenRegionType.PML,
48
52
  }
49
53
  self.hfss_extent_type = self._hfss_extent_info.extent_type
50
54
 
@@ -258,13 +262,13 @@ class HfssExtentInfo(GrpcHfssExtentInfo):
258
262
  hfss_extent = self._hfss_extent_info
259
263
  if isinstance(value, str):
260
264
  if value.lower() == "bounding_box":
261
- value = GrpcHfssExtentInfo.HFSSExtentInfoType.BOUNDING_BOX
265
+ value = GrpcHfssExtentInfoType.BOUNDING_BOX
262
266
  elif value.lower() == "conforming":
263
- value = GrpcHfssExtentInfo.HFSSExtentInfoType.CONFORMING
267
+ value = GrpcHfssExtentInfoType.CONFORMING
264
268
  elif value.lower() == "convex_hul":
265
- value = GrpcHfssExtentInfo.HFSSExtentInfoType.CONVEX_HUL
269
+ value = GrpcHfssExtentInfoType.CONVEX_HUL
266
270
  elif value.lower() == "polygon":
267
- value = GrpcHfssExtentInfo.HFSSExtentInfoType.POLYGON
271
+ value = GrpcHfssExtentInfoType.POLYGON
268
272
  else:
269
273
  raise f"Invalid extent type : {value}"
270
274
  hfss_extent.extent_type = value
pyedb/grpc/edb.py CHANGED
@@ -198,7 +198,6 @@ class Edb(EdbInit):
198
198
  use_ppe=False,
199
199
  technology_file=None,
200
200
  restart_rpc_server=False,
201
- kill_all_instances=False,
202
201
  ):
203
202
  edbversion = get_string_version(edbversion)
204
203
  self._clean_variables()
@@ -273,9 +272,9 @@ class Edb(EdbInit):
273
272
  self.logger.info("EDB %s was created correctly from %s file.", self.edbpath, edbpath[-2:])
274
273
  elif edbpath.endswith("edb.def"):
275
274
  self.edbpath = os.path.dirname(edbpath)
276
- self.open_edb(restart_rpc_server=restart_rpc_server, kill_all_instances=kill_all_instances)
275
+ self.open_edb(restart_rpc_server=restart_rpc_server)
277
276
  elif not os.path.exists(os.path.join(self.edbpath, "edb.def")):
278
- self.create_edb(restart_rpc_server=restart_rpc_server, kill_all_instances=kill_all_instances)
277
+ self.create_edb(restart_rpc_server=restart_rpc_server)
279
278
  self.logger.info("EDB %s created correctly.", self.edbpath)
280
279
  elif ".aedb" in edbpath:
281
280
  self.edbpath = edbpath
@@ -290,8 +289,7 @@ class Edb(EdbInit):
290
289
  return self
291
290
 
292
291
  def __exit__(self, ex_type, ex_value, ex_traceback):
293
- if ex_type:
294
- self.edb_exception(ex_value, ex_traceback)
292
+ self._signal_handler(ex_type, ex_value)
295
293
 
296
294
  def __getitem__(self, variable_name):
297
295
  """Get a variable to the Edb project. The variable can be project using ``$`` prefix or
@@ -493,7 +491,9 @@ class Edb(EdbInit):
493
491
  """
494
492
  terminals = [term for term in self.layout.terminals if not term.is_reference_terminal]
495
493
  ports = {}
494
+ from pyedb.grpc.database.ports.ports import WavePort
496
495
  from pyedb.grpc.database.terminal.bundle_terminal import BundleTerminal
496
+ from pyedb.grpc.database.terminal.edge_terminal import EdgeTerminal
497
497
  from pyedb.grpc.database.terminal.padstack_instance_terminal import (
498
498
  PadstackInstanceTerminal,
499
499
  )
@@ -504,6 +504,11 @@ class Edb(EdbInit):
504
504
  ports[bundle_ter.name] = bundle_ter
505
505
  elif isinstance(t, PadstackInstanceTerminal):
506
506
  ports[t.name] = CoaxPort(self, t)
507
+ elif isinstance(t, EdgeTerminal):
508
+ if t.is_wave_port:
509
+ ports[t.name] = WavePort(self, t)
510
+ else:
511
+ ports[t.name] = EdgeTerminal(self, t)
507
512
  else:
508
513
  ports[t.name] = GapPort(self, t)
509
514
  return ports
@@ -572,7 +577,6 @@ class Edb(EdbInit):
572
577
  self.edbpath,
573
578
  self.isreadonly,
574
579
  restart_rpc_server=restart_rpc_server,
575
- kill_all_instances=kill_all_instances,
576
580
  )
577
581
  n_try -= 1
578
582
  except Exception as e:
@@ -613,7 +617,7 @@ class Edb(EdbInit):
613
617
  n_try = 10
614
618
  while not self.db and n_try:
615
619
  try:
616
- self.create(self.edbpath, restart_rpc_server=restart_rpc_server, kill_all_instances=kill_all_instances)
620
+ self.create(self.edbpath, restart_rpc_server=restart_rpc_server)
617
621
  n_try -= 1
618
622
  except Exception as e:
619
623
  self.logger.error(e.args[0])
@@ -1085,7 +1089,7 @@ class Edb(EdbInit):
1085
1089
  :class:`Circle <pyedb.grpc.database.primitive.circle.Circle>`,
1086
1090
  :class:`Polygon <pyedb.grpc.database.primitive.polygon.Polygon>`]
1087
1091
  """
1088
- from ansys.edb.core.terminal.terminals import (
1092
+ from ansys.edb.core.terminal.padstack_instance_terminal import (
1089
1093
  PadstackInstanceTerminal as GrpcPadstackInstanceTerminal,
1090
1094
  )
1091
1095
 
@@ -2015,8 +2019,8 @@ class Edb(EdbInit):
2015
2019
  nets_to_preserve.extend(el.nets)
2016
2020
  if include_pingroups:
2017
2021
  for pingroup in self.layout.pin_groups:
2018
- for pin in pingroup.pins:
2019
- if pin.net_name in reference_list:
2022
+ for pin_name, pin in pingroup.pins.items():
2023
+ if pin_name in reference_list:
2020
2024
  pins_to_preserve.append(pin.edb_uid)
2021
2025
  if check_terminals:
2022
2026
  terms = [
@@ -2324,7 +2328,7 @@ class Edb(EdbInit):
2324
2328
  ids.append(lobj.id)
2325
2329
  if include_partial_instances:
2326
2330
  from ansys.edb.core.geometry.point_data import PointData as GrpcPointData
2327
- from ansys.edb.core.primitive.primitive import (
2331
+ from ansys.edb.core.primitive.padstack_instance import (
2328
2332
  PadstackInstance as GrpcPadstackInstance,
2329
2333
  )
2330
2334
 
@@ -3384,15 +3388,15 @@ class Edb(EdbInit):
3384
3388
  list: [:class:`GapPort <pyedb.grpc.database.ports.ports.GapPort`>,
3385
3389
  :class:`WavePort <pyedb.grpc.database.ports.ports.WavePort>`].
3386
3390
  """
3387
- from ansys.edb.core.terminal.terminals import BoundaryType as GrpcBoundaryType
3391
+ from ansys.edb.core.terminal.terminal import BoundaryType as GrpcBoundaryType
3388
3392
 
3389
- if isinstance(terminal.boundary_type, GrpcBoundaryType):
3393
+ if terminal.boundary_type == "port":
3390
3394
  terminal.boundary_type = GrpcBoundaryType.PORT
3391
3395
  terminal.is_circuit_port = is_circuit_port
3392
-
3393
- if isinstance(ref_terminal.boundary_type, GrpcBoundaryType):
3394
- ref_terminal.boundary_type = GrpcBoundaryType.PORT
3395
- terminal.ref_terminal = ref_terminal
3396
+ if ref_terminal:
3397
+ if ref_terminal.boundary_type == "port":
3398
+ ref_terminal.boundary_type = GrpcBoundaryType.PORT
3399
+ terminal.reference_terminal = ref_terminal
3396
3400
  if name:
3397
3401
  terminal.name = name
3398
3402
  return self.ports[terminal.name]
pyedb/grpc/edb_init.py CHANGED
@@ -22,7 +22,9 @@
22
22
 
23
23
 
24
24
  """Database."""
25
+ import atexit
25
26
  import os
27
+ import signal
26
28
  import sys
27
29
 
28
30
  import ansys.edb.core.database as database
@@ -68,13 +70,22 @@ class EdbInit(object):
68
70
  oa_directory = os.path.join(self.base_path, "common", "oa")
69
71
  os.environ["ANSYS_OADIR"] = oa_directory
70
72
  os.environ["PATH"] = "{};{}".format(os.environ["PATH"], self.base_path)
73
+ # register server kill
74
+ atexit.register(self._signal_handler)
75
+ # register signal handlers
76
+ signal.signal(signal.SIGTERM, self._signal_handler)
77
+ signal.signal(signal.SIGINT, self._signal_handler)
78
+
79
+ @staticmethod
80
+ def _signal_handler(signum=None, frame=None):
81
+ RpcSession.kill()
71
82
 
72
83
  @property
73
84
  def db(self):
74
85
  """Active database object."""
75
86
  return self._db
76
87
 
77
- def create(self, db_path, port=0, restart_rpc_server=False, kill_all_instances=False):
88
+ def create(self, db_path, port=0, restart_rpc_server=False):
78
89
  """Create a Database at the specified file location.
79
90
 
80
91
  Parameters
@@ -82,12 +93,12 @@ class EdbInit(object):
82
93
  db_path : str
83
94
  Path to top-level database folder
84
95
 
96
+ port : int
97
+ grpc port number.
98
+
85
99
  restart_rpc_server : optional, bool
86
100
  Force restarting RPC server when `True`.Default value is `False`
87
101
 
88
- kill_all_instances : optional, bool.
89
- Force killing all RPC server instances, must be used with caution. Default value is `False`.
90
-
91
102
  Returns
92
103
  -------
93
104
  Database
@@ -97,7 +108,6 @@ class EdbInit(object):
97
108
  edb_version=self.edbversion,
98
109
  port=port,
99
110
  restart_server=restart_rpc_server,
100
- kill_all_instances=kill_all_instances,
101
111
  )
102
112
  if not RpcSession.pid:
103
113
  self.logger.error("Failed to start RPC server.")
@@ -105,7 +115,7 @@ class EdbInit(object):
105
115
  self._db = database.Database.create(db_path)
106
116
  return self._db
107
117
 
108
- def open(self, db_path, read_only, port=0, restart_rpc_server=False, kill_all_instances=False):
118
+ def open(self, db_path, read_only, port=0, restart_rpc_server=False):
109
119
  """Open an existing Database at the specified file location.
110
120
 
111
121
  Parameters
@@ -115,11 +125,9 @@ class EdbInit(object):
115
125
  read_only : bool
116
126
  Obtain read-only access.
117
127
  port : optional, int.
118
- Specify the port number.If not provided a randon free one is selected. Default value is `0`.
128
+ Specify the port number. If not provided a randon free one is selected. Default value is `0`.
119
129
  restart_rpc_server : optional, bool
120
130
  Force restarting RPC server when `True`. Default value is `False`.
121
- kill_all_instances : optional, bool.
122
- Force killing all RPC server instances, must be used with caution. Default value is `False`.
123
131
 
124
132
  Returns
125
133
  -------
@@ -133,7 +141,6 @@ class EdbInit(object):
133
141
  edb_version=self.edbversion,
134
142
  port=port,
135
143
  restart_server=restart_rpc_server,
136
- kill_all_instances=kill_all_instances,
137
144
  )
138
145
  if not RpcSession.pid:
139
146
  self.logger.error("Failed to start RPC server.")
@@ -154,7 +161,7 @@ class EdbInit(object):
154
161
  """Save any changes into a file."""
155
162
  return self._db.save()
156
163
 
157
- def close(self, terminate_rpc_session=True, kill_all_instances=False):
164
+ def close(self, terminate_rpc_session=True):
158
165
  """Close the database.
159
166
 
160
167
  Parameters
@@ -167,10 +174,7 @@ class EdbInit(object):
167
174
  """
168
175
  self._db.close()
169
176
  self._db = None
170
- if kill_all_instances:
171
- RpcSession._kill_all_instances()
172
- RpcSession.pid = 0
173
- elif terminate_rpc_session:
177
+ if terminate_rpc_session:
174
178
  RpcSession.rpc_session.disconnect()
175
179
  RpcSession.pid = 0
176
180
  return True
pyedb/grpc/rpc_session.py CHANGED
@@ -50,7 +50,7 @@ class RpcSession:
50
50
  port = 10000
51
51
 
52
52
  @staticmethod
53
- def start(edb_version, port=0, restart_server=False, kill_all_instances=False):
53
+ def start(edb_version, port=0, restart_server=False):
54
54
  """Start RPC-server, the server must be started before opening EDB.
55
55
 
56
56
  Parameters
@@ -107,10 +107,7 @@ class RpcSession:
107
107
  if RpcSession.pid:
108
108
  if restart_server:
109
109
  pyedb_logger.logger.info("Restarting RPC server")
110
- if kill_all_instances:
111
- RpcSession.__kill_all_instances()
112
- else:
113
- RpcSession.__kill()
110
+ RpcSession.kill()
114
111
  RpcSession.__start_rpc_server()
115
112
  else:
116
113
  pyedb_logger.info(f"Server already running on port {RpcSession.port}")
@@ -141,13 +138,18 @@ class RpcSession:
141
138
  pyedb_logger.logger.info("Grpc session started")
142
139
 
143
140
  @staticmethod
144
- def __kill():
141
+ def kill():
145
142
  p = psutil.Process(RpcSession.pid)
146
143
  time.sleep(latency_delay)
147
- p.terminate()
144
+ try:
145
+ p.terminate()
146
+ print(f"RPC session pid: {RpcSession.pid} killed due to execution failure.")
147
+ RpcSession.pid = 0
148
+ except:
149
+ print("RPC session closed.")
148
150
 
149
151
  @staticmethod
150
- def _kill_all_instances():
152
+ def kill_all_instances():
151
153
  proc = [p.pid for p in list(psutil.process_iter()) if "edb_rpc" in p.name().lower()]
152
154
  time.sleep(latency_delay)
153
155
  for pid in proc:
@@ -163,6 +165,7 @@ class RpcSession:
163
165
  end_managing()
164
166
  RpcSession.rpc_session.disconnect()
165
167
  time.sleep(latency_delay)
168
+ RpcSession.__get_process_id()
166
169
 
167
170
  @staticmethod
168
171
  def __get_random_free_port():
pyedb/misc/misc.py CHANGED
@@ -87,3 +87,16 @@ def current_student_version():
87
87
  if "SV" in version_key:
88
88
  return version_key
89
89
  return ""
90
+
91
+
92
+ def deprecated_property(func):
93
+ """
94
+ This decorator marks a property as deprecated.
95
+ It will emit a warning when the property is accessed.
96
+ """
97
+
98
+ def wrapper(*args, **kwargs):
99
+ warnings.warn(f"Access to deprecated property {func.__name__}.", category=DeprecationWarning, stacklevel=2)
100
+ return func(*args, **kwargs)
101
+
102
+ return wrapper
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pyedb
3
- Version: 0.43.0
3
+ Version: 0.45.0
4
4
  Summary: Higher-Level Pythonic Ansys Electronics Data Base
5
5
  Author-email: "ANSYS, Inc." <pyansys.core@ansys.com>
6
6
  Maintainer-email: PyEDB developers <simon.vandenbrouck@ansys.com>
@@ -127,15 +127,15 @@ Documentation for the latest stable release of PyEDB is hosted at
127
127
  [PyEDB documentation](https://edb.docs.pyansys.com/version/stable/index.html).
128
128
  The documentation has five sections:
129
129
 
130
- - [Getting started](https://edb.docs.pyansys.com/version/version/stable/getting_started/index.html): Describes
130
+ - [Getting started](https://edb.docs.pyansys.com/version/stable/getting_started/index.html): Describes
131
131
  how to install PyEDB in user mode.
132
- - [User guide](https://edb.docs.pyansys.com/version/version/stable/user_guide/index.html): Describes how to
132
+ - [User guide](https://edb.docs.pyansys.com/version/stable/user_guide/index.html#user-guide): Describes how to
133
133
  use PyEDB.
134
- - [API reference](https://edb.docs.pyansys.com/version/version/stable/api/index.html): Provides API member descriptions
134
+ - [API reference](https://edb.docs.pyansys.com/version/stable/api/index.html): Provides API member descriptions
135
135
  and usage examples.
136
- - [Examples](https://edb.docs.pyansys.com/version/version/stable/examples/index.html): Provides examples showing
136
+ - [Examples](https://examples.aedt.docs.pyansys.com/version/dev/examples/high_frequency/layout/index.html): Provides examples showing
137
137
  end-to-end workflows for using PyEDB.
138
- - [Contribute](https://edb.docs.pyansys.com/version/version/stable/contribute.html): Describes how to install
138
+ - [Contribute](https://edb.docs.pyansys.com/version/stable/contributing.html): Describes how to install
139
139
  PyEDB in developer mode and how to contribute to this PyAnsys library.
140
140
 
141
141
  In the upper right corner of the documentation's title bar, there is an option