Skip to content

Commit

Permalink
Merge branch 'main' into release/0.13
Browse files Browse the repository at this point in the history
# Conflicts:
#	src/ansys/aedt/core/__init__.py
  • Loading branch information
Samuelopez-ansys committed Dec 20, 2024
2 parents 6564fce + 5ea9436 commit d5de1b4
Show file tree
Hide file tree
Showing 125 changed files with 73,035 additions and 214,965 deletions.
2 changes: 1 addition & 1 deletion doc/source/Getting_started/ClientServer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ In AEDT 2022 R2 and later, PyAEDT fully supports the gRPC API (except for EDB):
# Launch the latest installed version of AEDT in graphical mode.
from ansys.aedt.core import Hfss
from ansys.aedt.core import settings
from ansys.aedt.core.generic.settings import settings
settings.use_grpc_api=True
hfss = Hfss(machine="fullmachinename", port=portnumber)
Expand Down
2 changes: 1 addition & 1 deletion doc/source/Getting_started/versioning.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ This interface works only on Windows and uses .NET COM objects.
.. code:: python
from ansys.aedt.core import settings
from ansys.aedt.core.generic.settings import settings
settings.use_grpc_api = False
Expand Down
143 changes: 71 additions & 72 deletions doc/source/Resources/pyaedt_installer_from_aedt.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,10 +79,10 @@ def run_pyinstaller_from_c_python(oDesktop):
if is_student_version(oDesktop):
command.append("--student")
if is_linux:
command.extend(['--edt_root="{}"'.format(edt_root), '--python_version="{}"'.format(python_version)])
command.extend([r'--edt_root={}'.format(edt_root), '--python_version="{}"'.format(python_version)])

if wheelpyaedt:
command.extend(['--wheel="{}"'.format(wheelpyaedt)])
command.extend([r'--wheel={}'.format(wheelpyaedt)])

oDesktop.AddMessage("", "", 0, "Installing PyAEDT.")
return_code = subprocess.call(command)
Expand Down Expand Up @@ -179,8 +179,26 @@ def parse_arguments_for_pyaedt_installer(args=None):
parser.error("No arguments given!")
return args

def unzip_if_zip(path):
"""Unzip path if it is a ZIP file."""
import zipfile

# Extracted folder
unzipped_path = path
if path.suffix == '.zip':
unzipped_path = path.parent / path.stem
if unzipped_path.exists():
shutil.rmtree(unzipped_path, ignore_errors=True)
with zipfile.ZipFile(path, "r") as zip_ref:
# Extract all contents to a directory. (You can specify a different extraction path if needed.)
zip_ref.extractall(unzipped_path)
return unzipped_path


def install_pyaedt():
"""Install PyAEDT in CPython."""
from pathlib import Path

# This is called when run from CPython
args = parse_arguments_for_pyaedt_installer()

Expand All @@ -189,136 +207,117 @@ def install_pyaedt():
python_version = "3_7"

if is_windows:
venv_dir = os.path.join(os.environ["APPDATA"], VENV_DIR_PREFIX, python_version)
python_exe = os.path.join(venv_dir, "Scripts", "python.exe")
pip_exe = os.path.join(venv_dir, "Scripts", "pip.exe")
venv_dir = Path(os.environ["APPDATA"], VENV_DIR_PREFIX, python_version)
python_exe = venv_dir / "Scripts" / "python.exe"
pip_exe = venv_dir / "Scripts" / "pip.exe"
else:
venv_dir = os.path.join(os.environ["HOME"], VENV_DIR_PREFIX, python_version)
python_exe = os.path.join(venv_dir, "bin", "python")
pip_exe = os.path.join(venv_dir, "bin", "pip")
venv_dir = Path(os.environ["HOME"], VENV_DIR_PREFIX, python_version)
python_exe = venv_dir / "bin" / "python"
pip_exe = venv_dir / "bin" / "pip"
os.environ["ANSYSEM_ROOT{}".format(args.version)] = args.edt_root
ld_library_path_dirs_to_add = [
"{}/commonfiles/CPython/{}/linx64/Release/python/lib".format(
r"{}/commonfiles/CPython/{}/linx64/Release/python/lib".format(
args.edt_root, args.python_version.replace(".", "_")
),
"{}/common/mono/Linux64/lib64".format(args.edt_root),
"{}".format(args.edt_root),
r"{}/common/mono/Linux64/lib64".format(args.edt_root),
r"{}".format(args.edt_root),
]
if args.version < "232":
ld_library_path_dirs_to_add.append("{}/Delcross".format(args.edt_root))
ld_library_path_dirs_to_add.append(r"{}/Delcross".format(args.edt_root))
os.environ["LD_LIBRARY_PATH"] = ":".join(ld_library_path_dirs_to_add) + ":" + os.getenv("LD_LIBRARY_PATH", "")
os.environ["TK_LIBRARY"] = "{}/commonfiles/CPython/{}/linx64/Release/python/lib/tk8.5".format(
os.environ["TK_LIBRARY"] = r"{}/commonfiles/CPython/{}/linx64/Release/python/lib/tk8.5".format(
args.edt_root, args.python_version.replace(".", "_")
)
os.environ["TCL_LIBRARY"] = "{}/commonfiles/CPython/{}/linx64/Release/python/lib/tcl8.5".format(
os.environ["TCL_LIBRARY"] = r"{}/commonfiles/CPython/{}/linx64/Release/python/lib/tcl8.5".format(
args.edt_root, args.python_version.replace(".", "_")
)

if not os.path.exists(venv_dir):

if args.version == "231":
subprocess.call([sys.executable, "-m", "venv", venv_dir, "--system-site-packages"])
if not venv_dir.exists():
print("Creating the virtual environment in {}".format(venv_dir))
if args.version <= "231":
subprocess.call([sys.executable, "-m", "venv", str(venv_dir), "--system-site-packages"])
else:
subprocess.call([sys.executable, "-m", "venv", venv_dir])
subprocess.call([sys.executable, "-m", "venv", str(venv_dir)])

if args.wheel and os.path.exists(args.wheel):
wheel_pyaedt = args.wheel
if wheel_pyaedt.endswith(".zip"):
import zipfile

unzipped_path = os.path.join(
os.path.dirname(wheel_pyaedt), os.path.splitext(os.path.basename(wheel_pyaedt))[0]
)
if os.path.exists(unzipped_path):
shutil.rmtree(unzipped_path, ignore_errors=True)
with zipfile.ZipFile(wheel_pyaedt, "r") as zip_ref:
# Extract all contents to a directory. (You can specify a different extraction path if needed.)
zip_ref.extractall(unzipped_path)
else:
# Extracted folder.
unzipped_path = wheel_pyaedt
if args.wheel and Path(args.wheel).exists():
print("Installing PyAEDT using provided wheels argument")
unzipped_path = unzip_if_zip(Path(args.wheel))
if args.version <= "231":
subprocess.call(
[
pip_exe,
str(pip_exe),
"install",
"--no-cache-dir",
"--no-index",
"--find-links={}".format(unzipped_path),
"pyaedt[all,dotnet]",
r"--find-links={}".format(str(unzipped_path)),
"pyaedt[all,dotnet]=='0.9.0'",
]
)
else:
subprocess.call(
[
pip_exe,
str(pip_exe),
"install",
"--no-cache-dir",
"--no-index",
"--find-links={}".format(unzipped_path),
r"--find-links={}".format(str(unzipped_path)),
"pyaedt[installer]",
]
)

else:
subprocess.call([python_exe, "-m", "pip", "install", "--upgrade", "pip"])
subprocess.call([pip_exe, "--default-timeout=1000", "install", "wheel"])
print("Installing PyAEDT using online sources")
subprocess.call([str(python_exe), "-m", "pip", "install", "--upgrade", "pip"])
subprocess.call([str(pip_exe), "--default-timeout=1000", "install", "wheel"])
if args.version <= "231":
subprocess.call([pip_exe, "--default-timeout=1000", "install", "pyaedt[all]=='0.9.0'"])
subprocess.call([pip_exe, "--default-timeout=1000", "install", "jupyterlab"])
subprocess.call([pip_exe, "--default-timeout=1000", "install", "ipython", "-U"])
subprocess.call([pip_exe, "--default-timeout=1000", "install", "ipyvtklink"])
subprocess.call([str(pip_exe), "--default-timeout=1000", "install", "pyaedt[all]=='0.9.0'"])
subprocess.call([str(pip_exe), "--default-timeout=1000", "install", "jupyterlab"])
subprocess.call([str(pip_exe), "--default-timeout=1000", "install", "ipython", "-U"])
subprocess.call([str(pip_exe), "--default-timeout=1000", "install", "ipyvtklink"])
else:
subprocess.call([pip_exe, "--default-timeout=1000", "install", "pyaedt[installer]"])
subprocess.call([str(pip_exe), "--default-timeout=1000", "install", "pyaedt[installer]"])

if args.version == "231":
subprocess.call([pip_exe, "uninstall", "-y", "pywin32"])
if args.version <= "231":
subprocess.call([str(pip_exe), "uninstall", "-y", "pywin32"])

else:
subprocess.call([pip_exe, "uninstall", "-y", "pyaedt"])
print("Using existing virtual environment in {}".format(venv_dir))
subprocess.call([str(pip_exe), "uninstall", "-y", "pyaedt"])

if args.wheel and os.path.exists(args.wheel):
wheel_pyaedt = args.wheel
import zipfile

unzipped_path = os.path.join(
os.path.dirname(wheel_pyaedt), os.path.splitext(os.path.basename(wheel_pyaedt))[0]
)
if os.path.exists(unzipped_path):
shutil.rmtree(unzipped_path, ignore_errors=True)
with zipfile.ZipFile(wheel_pyaedt, "r") as zip_ref:
# Extract all contents to a directory. (You can specify a different extraction path if needed.)
zip_ref.extractall(unzipped_path)
if args.wheel and Path(args.wheel).exists():
print("Installing PyAEDT using provided wheels argument")
unzipped_path = unzip_if_zip(Path(args.wheel))
if args.version <= "231":
subprocess.call(
[
pip_exe,
str(pip_exe),
"install",
"--no-cache-dir",
"--no-index",
"--find-links={}".format(unzipped_path),
"pyaedt[all]=='0.9.0'",
r"--find-links={}".format(str(unzipped_path)),
"pyaedt[all,dotnet]=='0.9.0'",
]
)
else:
subprocess.call(
[
pip_exe,
str(pip_exe),
"install",
"--no-cache-dir",
"--no-index",
"--find-links={}".format(unzipped_path),
r"--find-links={}".format(str(unzipped_path)),
"pyaedt[installer]",
]
)
else:
print("Installing PyAEDT using online sources")
if args.version <= "231":
subprocess.call([pip_exe, "--default-timeout=1000", "install", "pyaedt[all]=='0.9.0'"])
subprocess.call([pip_exe, "--default-timeout=1000", "install", "jupyterlab"])
subprocess.call([pip_exe, "--default-timeout=1000", "install", "ipython", "-U"])
subprocess.call([pip_exe, "--default-timeout=1000", "install", "ipyvtklink"])
subprocess.call([str(pip_exe), "pip=1000", "install", "pyaedt[all]=='0.9.0'"])
subprocess.call([str(pip_exe), "--default-timeout=1000", "install", "jupyterlab"])
subprocess.call([str(pip_exe), "--default-timeout=1000", "install", "ipython", "-U"])
subprocess.call([str(pip_exe), "--default-timeout=1000", "install", "ipyvtklink"])
else:
subprocess.call([pip_exe, "--default-timeout=1000", "install", "pyaedt[installer]"])
subprocess.call([str(pip_exe), "--default-timeout=1000", "install", "pyaedt[installer]"])
sys.exit(0)


Expand Down
43 changes: 43 additions & 0 deletions doc/source/release_1_0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,49 @@ The following table list the name changes with the old and new paths:
| pyaedt\\modules\\SolveSweeps.py | src\\ansys\\aedt\\core\\modules\\solve_sweeps.py |
+----------------------------------------------------------------+--------------------------------------------------------------------------+

Dotnet changes in Linux
-----------------------

To improve compatibility with system libraries in Linux, the Python package `dotnetcore2` is being removed from PyAEDT's dotnet installation target.
Indeed, the embedded version of `.NET` associated to `dotnetcore2` is old and has **incompatibilities** with recent versions of `openssl` such as the one installed by default in Ubuntu 22.04.

The impact of this decision is that users need to install `.NET` themselves.
The installation process can be done following the official
Microsoft documentation for `.NET` on Linux to ensure proper setup and compatibility. See
`Register Microsoft package repository <https://learn.microsoft.com/en-us/dotnet/core/install/linux-ubuntu#register-the-microsoft-package-repository>`_
and `Install .NET <https://learn.microsoft.com/en-us/dotnet/core/install/linux-ubuntu#install-net>`_.

.. note::
Starting with Ubuntu 22.04, `.NET` is available in the official Ubuntu repository.
If you want to use the Microsoft package to install `.NET`, you can use the following
approach to *"demote"* the Ubuntu packages so that the Microsoft packages take precedence.

1. Ensure the removal of any existing `.NET` installation. In Ubuntu, this can be done with
the following command:

.. code::
sudo apt remove dotnet* aspnetcore* netstandard*
2. Create a preference file in `/etc/apt/preferences.d`, for example `microsoft-dotnet.pref`,
with the following content:

.. code::
Package: dotnet* aspnet* netstandard*
Pin: origin "archive.ubuntu.com"
Pin-Priority: -10
Package: dotnet* aspnet* netstandard*
Pin: origin "security.ubuntu.com"
Pin-Priority: -10
3. Perform an update and install of the version you want, for example .NET 6.0 or 8.0

.. code::
sudo apt update && sudo apt install -y dotnet-sdk-6.0
Other changes in release 1.0
============================

Expand Down
3 changes: 2 additions & 1 deletion doc/styles/config/vocabularies/ANSYS/accept.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ DesignXploration
docstring
[Dd]ocstrings
doppler
dotnet
[Dd]otnet
EDB
EDT
efields
Expand Down Expand Up @@ -58,6 +58,7 @@ netlist
Nexxim
numpy
numpydoc
openssl
[Oo]ptimetrics
padstack
padstacks
Expand Down
17 changes: 9 additions & 8 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ dependencies = [
"tomli-w",
"rpyc>=6.0.0,<6.1",
"pyyaml",
"defusedxml>=0.7,<8.0"
"defusedxml>=0.7,<8.0",
"attrs!=24.3.0",
]

[project.optional-dependencies]
Expand All @@ -55,7 +56,7 @@ unit-tests = [
integration-tests = [
"matplotlib>=3.5.0,<3.10",
"mock>=5.1.0,<5.2",
"numpy>=1.20.0,<2",
"numpy>=1.20.0,<2.3",
"pandas>=1.1.0,<2.3",
"pytest>=7.4.0,<8.4",
"pytest-cov>=4.0.0,<6.1",
Expand All @@ -65,7 +66,7 @@ tests = [
"joblib>=1.0.0,<1.5",
"matplotlib>=3.5.0,<3.10",
"mock>=5.1.0,<5.2",
"numpy>=1.20.0,<2",
"numpy>=1.20.0,<2.3",
"openpyxl>=3.1.0,<3.3",
"osmnx>=1.1.0,<2.1",
"pandas>=1.1.0,<2.3",
Expand All @@ -76,7 +77,7 @@ tests = [
"ansys-tools-visualization-interface; python_version >= '3.10'",
"tables; python_version >= '3.10'",
# Never directly imported but required when loading ML related file see #4713
"scikit-learn>=1.0.0,<1.6",
"scikit-learn>=1.0.0,<1.7",
"scikit-rf>=0.30.0,<1.6",
"SRTM.py",
"utm",
Expand Down Expand Up @@ -104,7 +105,7 @@ doc = [
]
all = [
"matplotlib>=3.5.0,<3.10",
"numpy>=1.20.0,<2",
"numpy>=1.20.0,<2.3",
"openpyxl>=3.1.0,<3.3",
"osmnx>=1.1.0,<2.1",
"pandas>=1.1.0,<2.3",
Expand All @@ -113,22 +114,22 @@ all = [
"ansys-tools-visualization-interface; python_version >= '3.10'",
"tables; python_version >= '3.10'",
# Never directly imported but required when loading ML related file see #4713
"scikit-learn>=1.0.0,<1.6",
"scikit-learn>=1.0.0,<1.7",
"scikit-rf>=0.30.0,<1.6",
"SRTM.py",
"utm",
]
installer = [
"matplotlib>=3.5.0,<3.10",
"numpy>=1.20.0,<2",
"numpy>=1.20.0,<2.3",
"openpyxl>=3.1.0,<3.3",
"osmnx>=1.1.0,<2.1",
"pandas>=1.1.0,<2.3",
"pyvista[io]>=0.38.0,<0.45",
"fast-simplification>=0.1.7",
"ansys-tools-visualization-interface; python_version >= '3.10'",
# Never directly imported but required when loading ML related file see #4713
"scikit-learn>=1.0.0,<1.6",
"scikit-learn>=1.0.0,<1.7",
"scikit-rf>=0.30.0,<1.6",
"SRTM.py",
"utm",
Expand Down
Loading

0 comments on commit d5de1b4

Please sign in to comment.