pyedb 0.34.1__py3-none-any.whl → 0.34.2__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.

pyedb/__init__.py CHANGED
@@ -44,7 +44,7 @@ deprecation_warning()
44
44
  #
45
45
 
46
46
  pyedb_path = os.path.dirname(__file__)
47
- __version__ = "0.34.1"
47
+ __version__ = "0.34.2"
48
48
  version = __version__
49
49
 
50
50
  #
pyedb/common/nets.py CHANGED
@@ -2,8 +2,6 @@ import math
2
2
  import os
3
3
  import time
4
4
 
5
- import shapely
6
-
7
5
  from pyedb.generic.constants import CSS4_COLORS
8
6
 
9
7
 
@@ -120,22 +118,30 @@ class CommonNets:
120
118
  sign = -1
121
119
  return [[sign * i[0], i[1]] for i in poly]
122
120
 
123
- import matplotlib.pyplot as plt
121
+ try:
122
+ import matplotlib.pyplot as plt
123
+ except ImportError: # pragma: no cover
124
+ self._pedb.logger.error("Matplotlib is needed. Please, install it first.")
125
+ return False
124
126
 
125
127
  dpi = 100.0
126
128
  figsize = (size[0] / dpi, size[1] / dpi)
127
129
 
128
130
  fig = plt.figure(figsize=figsize)
129
131
  ax = fig.add_subplot(1, 1, 1)
130
- from shapely import affinity
131
- from shapely.geometry import (
132
- LinearRing,
133
- MultiLineString,
134
- MultiPolygon,
135
- Point,
136
- Polygon,
137
- )
138
- from shapely.plotting import plot_line, plot_polygon
132
+ try:
133
+ from shapely import affinity, union_all
134
+ from shapely.geometry import (
135
+ LinearRing,
136
+ MultiLineString,
137
+ MultiPolygon,
138
+ Point,
139
+ Polygon,
140
+ )
141
+ from shapely.plotting import plot_line, plot_polygon
142
+ except ImportError: # pragma: no cover
143
+ self._pedb.logger.error("Shapely is needed. Please, install it first.")
144
+ return False
139
145
 
140
146
  start_time = time.time()
141
147
  if not nets:
@@ -317,7 +323,7 @@ class CommonNets:
317
323
  h1 = mirror_poly([(i, j) for i, j in zip(xvt, yvt)])
318
324
  holes.append(h1)
319
325
  if len(holes) > 1:
320
- holes = shapely.union_all([Polygon(i) for i in holes])
326
+ holes = union_all([Polygon(i) for i in holes])
321
327
  if isinstance(holes, MultiPolygon):
322
328
  holes = [i.boundary for i in list(holes.geoms)]
323
329
  else:
@@ -1,7 +1,6 @@
1
1
  import os
2
2
  from pathlib import Path
3
3
  import pkgutil
4
- import shutil
5
4
  import sys
6
5
  import warnings
7
6
 
@@ -34,79 +33,62 @@ pyedb_path = Path(pyedb.__file__).parent
34
33
  sys.path.append(str(pyedb_path / "dlls" / "PDFReport"))
35
34
 
36
35
 
37
- def find_dotnet_root() -> Path:
38
- """Find dotnet root path."""
39
- dotnet_path = shutil.which("dotnet")
40
- if not dotnet_path:
41
- raise FileNotFoundError("The 'dotnet' executable was not found in the PATH.")
42
-
43
- dotnet_path = Path(dotnet_path).resolve()
44
- dotnet_root = dotnet_path.parent
45
- return dotnet_root
46
-
47
-
48
- def find_runtime_config(dotnet_root: Path) -> Path:
49
- """Find dotnet runtime configuration file path."""
50
- sdk_path = dotnet_root / "sdk"
51
- if not sdk_path.is_dir():
52
- raise EnvironmentError(f"The 'sdk' directory could not be found in: {dotnet_root}")
53
- sdk_versions = sorted(sdk_path.iterdir(), key=lambda x: x.name, reverse=True)
54
- if not sdk_versions:
55
- raise FileNotFoundError("No SDK versions were found.")
56
- runtime_config = sdk_versions[0] / "dotnet.runtimeconfig.json"
57
- if not runtime_config.is_file():
58
- raise FileNotFoundError(f"The configuration file '{runtime_config}' does not exist.")
59
- return runtime_config
60
-
61
-
62
36
  if is_linux: # pragma: no cover
63
37
  from pythonnet import load
64
38
 
65
- # Use system DOTNET core runtime
66
- try:
67
- from clr_loader import get_coreclr
68
-
69
- runtime = get_coreclr()
70
- load(runtime)
71
- is_clr = True
72
- # Define DOTNET root and runtime config file to load DOTNET core runtime
73
- except Exception:
74
- if os.environ.get("DOTNET_ROOT") is None:
75
- try:
76
- dotnet_root = find_dotnet_root()
77
- runtime_config = find_runtime_config(dotnet_root)
78
- except Exception:
79
- warnings.warn(
80
- "Unable to set DOTNET root and locate the runtime configuration file. "
81
- "Falling back to using dotnetcore2."
82
- )
83
- warnings.warn(LINUX_WARNING)
84
-
85
- import dotnetcore2
39
+ dotnet_root = None
40
+ runtime_config = None
41
+ # Use system .NET core runtime or fall back to dotnetcore2
42
+ if os.environ.get("DOTNET_ROOT") is None:
43
+ try:
44
+ from clr_loader import get_coreclr
86
45
 
87
- dotnet_root = Path(dotnetcore2.__file__).parent / "bin"
88
- runtime_config = pyedb_path / "misc" / "pyedb.runtimeconfig.json"
46
+ runtime = get_coreclr()
47
+ load(runtime)
48
+ os.environ["DOTNET_ROOT"] = str(runtime.dotnet_root)
49
+ is_clr = True
50
+ # TODO: Fall backing to dotnetcore2 should be removed in a near future.
51
+ except Exception:
52
+ warnings.warn(
53
+ "Unable to set .NET root and locate the runtime configuration file. "
54
+ "Falling back to using dotnetcore2."
55
+ )
56
+ warnings.warn(LINUX_WARNING)
57
+
58
+ import dotnetcore2
59
+
60
+ dotnet_root = Path(dotnetcore2.__file__).parent / "bin"
61
+ runtime_config = pyedb_path / "misc" / "pyedb.runtimeconfig.json"
62
+ # Use specified .NET root folder
63
+ else:
64
+ dotnet_root = Path(os.environ["DOTNET_ROOT"])
65
+ # Patch the case where DOTNET_ROOT leads to dotnetcore2 for more information
66
+ # see https://github.com/ansys/pyedb/issues/922
67
+ # TODO: Remove once dotnetcore2 is deprecated
68
+ if dotnet_root.parent.name == "dotnetcore2":
69
+ runtime_config = pyedb_path / "misc" / "pyedb.runtimeconfig.json"
89
70
  else:
90
- dotnet_root = Path(os.environ["DOTNET_ROOT"])
91
- try:
92
- runtime_config = find_runtime_config(dotnet_root)
93
- except Exception as e:
71
+ from clr_loader import find_runtimes
72
+
73
+ candidates = [rt for rt in find_runtimes() if rt.name == "Microsoft.NETCore.App"]
74
+ candidates.sort(key=lambda spec: spec.version, reverse=True)
75
+ if not candidates:
94
76
  raise RuntimeError(
95
77
  "Configuration file could not be found from DOTNET_ROOT. "
96
78
  "Please ensure that .NET SDK is correctly installed or "
97
79
  "that DOTNET_ROOT is correctly set."
98
80
  )
81
+ runtime_config = candidates[0]
82
+ # Use specific .NET core runtime
83
+ if dotnet_root is not None and runtime_config is not None:
99
84
  try:
100
85
  load("coreclr", runtime_config=str(runtime_config), dotnet_root=str(dotnet_root))
86
+ os.environ["DOTNET_ROOT"] = dotnet_root
101
87
  if "mono" not in os.getenv("LD_LIBRARY_PATH", ""):
102
88
  warnings.warn("LD_LIBRARY_PATH needs to be setup to use pyedb.")
103
89
  warnings.warn("export ANSYSEM_ROOT242=/path/to/AnsysEM/v242/Linux64")
104
90
  msg = "export LD_LIBRARY_PATH="
105
91
  msg += "$ANSYSEM_ROOT242/common/mono/Linux64/lib64:$LD_LIBRARY_PATH"
106
- msg += (
107
- "If PyEDB is used with AEDT<2023.2 then /path/to/AnsysEM/v2XY/Linux64/Delcross "
108
- "should be added to LD_LIBRARY_PATH."
109
- )
110
92
  warnings.warn(msg)
111
93
  is_clr = True
112
94
  except ImportError:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: pyedb
3
- Version: 0.34.1
3
+ Version: 0.34.2
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>
@@ -1,10 +1,10 @@
1
- pyedb/__init__.py,sha256=zRwDIaZ3PBm0P5sxEGjdwWgOUX92sLSkfV2J8tV0e_Y,1525
1
+ pyedb/__init__.py,sha256=ZDatOkcJCppw0vyJACYczRa-_Dy0Zv-eH-3iWU9B7S0,1525
2
2
  pyedb/edb_logger.py,sha256=7KXPvAMCKzlzJ5zioiNO5A3zkqbpCHhWHB4aXKfgu5Y,14959
3
3
  pyedb/exceptions.py,sha256=n94xluzUks6BA24vd_L6HkrvoP_H_l6__hQmqzdCyPo,111
4
4
  pyedb/siwave.py,sha256=Mgg5ZGzOUOtNdlePHcnrgN3rletQ7jrqRi3WfxF58uU,17727
5
5
  pyedb/workflow.py,sha256=Y0ya4FUHwlSmoLP45zjdYLsSpyKduHUSpT9GGK9MGd8,814
6
6
  pyedb/common/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
- pyedb/common/nets.py,sha256=daGdkzlv6kcyz_EnLLjTnXP3f9jOyK9LKe93NF-K6wo,20230
7
+ pyedb/common/nets.py,sha256=eOJn_WBbyjZWT-sDWrUOvO4ZQyh_6OK9DtoTb8Dp3Hs,20600
8
8
  pyedb/component_libraries/ansys_components.py,sha256=O3ypt832IHY9zG2AD_yrRrbH2KH9P1yFaoi1EO6Zllw,4830
9
9
  pyedb/configuration/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
10
10
  pyedb/configuration/cfg_boundaries.py,sha256=5_v6HD0VgkFCJHgx5zTIn_nxPv3KpcCuGz9P4Kk4ywM,6246
@@ -25,7 +25,7 @@ pyedb/configuration/cfg_spice_models.py,sha256=Q_5j2-V6cepSFcnijot8iypTqzanLp7HO
25
25
  pyedb/configuration/cfg_stackup.py,sha256=ZKUcTh4UAFLJgES2W-5J7uXkUdz_q0URg28lUZUyfdo,6433
26
26
  pyedb/configuration/configuration.py,sha256=MnoO5H5VZSogQSZ3MUJqWiO3DB-_QUYOfM4qROTHcnY,15470
27
27
  pyedb/dotnet/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
28
- pyedb/dotnet/clr_module.py,sha256=JnQQ1GFQcGVa5Fk7D8sLFOlohIQtETGu51TGL_aT8Tc,5827
28
+ pyedb/dotnet/clr_module.py,sha256=V8S_WV_XxjaJOf_XYBZ8i9GDnsF33ItYrXQAtgV0CBY,5287
29
29
  pyedb/dotnet/edb.py,sha256=Ut1lpxs_YwagTRjcmrANr8xyIOVu-BzedW_YtU6kIcU,186395
30
30
  pyedb/dotnet/application/Variables.py,sha256=awNhyiLASBYrNjWIyW8IJowgqt7FfFPKF9UElRWyjZg,77750
31
31
  pyedb/dotnet/application/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -188,7 +188,7 @@ pyedb/misc/siw_feature_config/xtalk_scan/scan_config.py,sha256=YmYI6WTQulL5Uf8Wx
188
188
  pyedb/misc/siw_feature_config/xtalk_scan/td_xtalk_config.py,sha256=KHa-UqcXuabiVfT2CV-UvWl5Q2qGYHF2Ye9azcAlnXc,3966
189
189
  pyedb/modeler/geometry_operators.py,sha256=g_Sy7a6R23sP6RtboJn1rl8uTuo8oeLmMF21rNkzwjk,74198
190
190
  pyedb/siwave_core/icepak.py,sha256=WnZ-t8mik7LDY06V8hZFV-TxRZJQWK7bu_8Ichx-oBs,5206
191
- pyedb-0.34.1.dist-info/LICENSE,sha256=qQWivZ12ETN5l3QxvTARY-QI5eoRRlyHdwLlAj0Bg5I,1089
192
- pyedb-0.34.1.dist-info/WHEEL,sha256=CpUCUxeHQbRN5UGRQHYRJorO5Af-Qy_fHMctcQ8DSGI,82
193
- pyedb-0.34.1.dist-info/METADATA,sha256=m4DCanHy1Nb4lCcqxh29iHLYidI1TXM1a1FOY1ewvlI,8512
194
- pyedb-0.34.1.dist-info/RECORD,,
191
+ pyedb-0.34.2.dist-info/LICENSE,sha256=qQWivZ12ETN5l3QxvTARY-QI5eoRRlyHdwLlAj0Bg5I,1089
192
+ pyedb-0.34.2.dist-info/WHEEL,sha256=CpUCUxeHQbRN5UGRQHYRJorO5Af-Qy_fHMctcQ8DSGI,82
193
+ pyedb-0.34.2.dist-info/METADATA,sha256=oNJa8H9I4rPugFDVo03TVQBCfs-7gkyrHTuLMUf9Sro,8512
194
+ pyedb-0.34.2.dist-info/RECORD,,
File without changes