Skip to content

FEAT: Add Version manager to main panels #6089

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 12 commits into from
Apr 30, 2025
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ exclude: |
(?x)(
^src/ansys/aedt/core/rpc/|
^src/ansys/aedt/core/sbrplus/matlab/|
^src/ansys/aedt/core/workflows/installer|
^src/ansys/aedt/core/extensions/installer|
tests/system/general/example_models/|
tests/system/visualization/example_models/|
tests/system/solvers/example_models/
Expand Down
4 changes: 2 additions & 2 deletions codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ ignore:
- "src/ansys/aedt/core/rpc/*.py"
- "src/ansys/aedt/core/misc/*.py"
- "src/ansys/aedt/core/visualization/advanced/sbrplus/hdm_utils.py"
- "src/ansys/aedt/core/workflows/installer"
- "src/ansys/aedt/core/workflows/templates"
- "src/ansys/aedt/core/extensions/installer"
- "src/ansys/aedt/core/extensions/templates"
- "src/ansys/aedt/core/common_rpc.py"
- "src/ansys/aedt/core/internal/grpc_plugin_dll_class.py"
- "src/ansys/aedt/core/edb.py"
Expand Down
1 change: 1 addition & 0 deletions doc/changelog.d/6089.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add Version manager to main panels
35 changes: 33 additions & 2 deletions doc/source/Getting_started/Installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,37 @@ The user can select the AEDT application to install the specific workflow.
For additional information about AEDT extensions,
see `Extensions <https://aedt.docs.pyansys.com/version/stable/User_guide/extensions.html>`_.

Version manager
~~~~~~~~~~~~~~~
The **Version manager** extension allows users to manage and update **PyAEDT** and **PyEDB** installations.

There are several available options:

- **Display environment details**:
- Python virtual environment path
- Python version
- Installed versions of PyAEDT and PyEDB

- **Check latest releases on PyPI**:
- View the most recent versions of PyAEDT and PyEDB available on PyPI

- **Update from PyPI**:
- Install the latest official release of PyAEDT and PyEDB from PyPI

- **Install from a GitHub branch**:
- Uses the `main` development branch by default
- Other existing branch names can be specified

- **Update from a local wheelhouse**:
- Automatically checks compatibility before installation

- **Reset and update PyAEDT panels in AEDT**:
- Direct access to reset and update options within the AEDT interface

.. image:: ../Resources/version_manager_ui.png
:width: 800
:alt: PyAEDT version manager


Install on CPython from PyPI
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -101,7 +132,7 @@ Finally, in the Python console, run the following commands:

.. code::

from ansys.aedt.core.workflows.installer.pyaedt_installer import add_pyaedt_to_aedt
from ansys.aedt.core.extensions.installer.pyaedt_installer import add_pyaedt_to_aedt
add_pyaedt_to_aedt(“your_aedt_version", r“path_to_personalib")

You can also install the PyAEDT panels using the following steps, this is also useful if you have a centralized PyAEDT installation:
Expand Down Expand Up @@ -152,7 +183,7 @@ Finally, in the Python console, run the following commands:

.. code::

from ansys.aedt.core.workflows.installer.pyaedt_installer import add_pyaedt_to_aedt
from ansys.aedt.core.extensions.installer.pyaedt_installer import add_pyaedt_to_aedt
add_pyaedt_to_aedt(“your_aedt_version", r“path_to_personalib")


Expand Down
4 changes: 2 additions & 2 deletions doc/source/Resources/pyaedt_installer_from_aedt.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,14 +137,14 @@ def run_pyinstaller_from_c_python(oDesktop):
# f.write("import sys\n")
# f.write('sys.path.insert(0, r"c:\\ansysdev\\git\\repos\\pyaedt")\n')
if version <= "231":
f.write("from pyaedt.workflows.installer.pyaedt_installer import add_pyaedt_to_aedt\n")
f.write("from pyaedt.extensions.installer.pyaedt_installer import add_pyaedt_to_aedt\n")
f.write(
'add_pyaedt_to_aedt(aedt_version="{}", personallib=r"{}")\n'.format(
oDesktop.GetVersion()[:6], oDesktop.GetPersonalLibDirectory()
)
)
else:
f.write("from ansys.aedt.core.workflows.installer.pyaedt_installer import add_pyaedt_to_aedt\n")
f.write("from ansys.aedt.core.extensions.installer.pyaedt_installer import add_pyaedt_to_aedt\n")
f.write(
'add_pyaedt_to_aedt(aedt_version="{}", personal_lib=r"{}")\n'.format(
oDesktop.GetVersion()[:6], oDesktop.GetPersonalLibDirectory()
Expand Down
2 changes: 1 addition & 1 deletion doc/source/Resources/toolkit_installer_from_aedt.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def run_pyinstaller_from_c_python(oDesktop, pyaedt_interpreter):
if os.path.isfile(python_script):
os.remove(python_script)
with open(python_script, "w") as f:
f.write("from ansys.aedt.core.workflows.installer.pyaedt_installer import add_pyaedt_to_aedt\n")
f.write("from ansys.aedt.core.extensions.installer.pyaedt_installer import add_pyaedt_to_aedt\n")
f.write(
'add_pyaedt_to_aedt(aedt_version="{}", personal_lib=r"{}")\n'.format(
oDesktop.GetVersion()[:6], oDesktop.GetPersonalLibDirectory()))
Expand Down
Binary file modified doc/source/Resources/toolkits_ribbon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added doc/source/Resources/version_manager_ui.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 0 additions & 6 deletions doc/source/User_guide/extensions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,6 @@ They are small automated workflows with a simple GUI.

Lear how to convert projects from 2022R2 to newer versions.

.. grid-item-card:: Version manager
:link: pyaedt_extensions_doc/project/version_manager
:link-type: doc
:margin: 2 2 0 0

Manage pyaedt and pyedb versions.

.. grid-item-card:: Point cloud generator
:link: pyaedt_extensions_doc/project/point_cloud_generator
Expand Down
8 changes: 4 additions & 4 deletions doc/source/User_guide/pyaedt_extensions_doc/commandline.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,30 @@ Every extension can also launch the extension user interface from the terminal:

SET PYAEDT_SCRIPT_PORT=50051
SET PYAEDT_SCRIPT_VERSION=2025.1
python.exe path/to/pyaedt/workflows/project/import_nastran.py
python.exe path/to/pyaedt/extensions/project/import_nastran.py

The available arguments are: ``file_path``, ``planar``, ``lightweight``, and ``decimate``.
You can obtain these arguments from the help with this command:

.. code::

python.exe path/to/pyaedt/workflows/project/import_nastran.py --help
python.exe path/to/pyaedt/extensions/project/import_nastran.py --help

This code shows how to pass the input file as an argument, which doesn't launch the user interface:

.. code::

export PYAEDT_SCRIPT_PORT=50051
export PYAEDT_SCRIPT_VERSION=2025.1
python.exe path/to/pyaedt/workflows/project/import_nastran.py --file_path="my_file.stl"
python.exe path/to/pyaedt/extensions/project/import_nastran.py --file_path="my_file.stl"

Finally, this code shows how you can run the extension directly from a Python script:

.. code:: python

import ansys.aedt.core
import os
from ansys.aedt.core.workflows.project.import_nastran import main
from ansys.aedt.core.extensions.project.import_nastran import main
file_path = "my_file.stl"
hfss = ansys.aedt.core.Hfss()
# Specify the AEDT session to connect
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ You can also launch the extension user interface from the terminal:

.. code::

python.exe path/to/pyaedt/workflows/project/kernel_converter.py
python.exe path/to/pyaedt/extensions/project/kernel_converter.py

Finally, this code shows how you can run the extension directly from a Python script:

.. code:: python

from ansys.aedt.core.workflows.project.kernel_converter import main
from ansys.aedt.core.extensions.project.kernel_converter import main

main(test_args = {"password": "my_pwd",
"application": "HFSS",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ The extension can be run from a Python script in the following way:
import ansys.aedt.core
import os

from ansys.aedt.core.workflows.templates.template_get_started import main
from ansys.aedt.core.extensions.templates.template_get_started import main

hfss = ansys.aedt.core.Hfss()

Expand Down
2 changes: 1 addition & 1 deletion src/ansys/aedt/core/desktop.py
Original file line number Diff line number Diff line change
Expand Up @@ -1564,7 +1564,7 @@ def get_available_toolkits():
list
List of toolkit names.
"""
from ansys.aedt.core.workflows.customize_automation_tab import available_toolkits
from ansys.aedt.core.extensions.customize_automation_tab import available_toolkits

return list(available_toolkits().keys())

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@

import ansys.aedt.core
from ansys.aedt.core import Circuit
import ansys.aedt.core.workflows
from ansys.aedt.core.workflows.misc import get_aedt_version
from ansys.aedt.core.workflows.misc import get_arguments
from ansys.aedt.core.workflows.misc import get_port
from ansys.aedt.core.workflows.misc import get_process_id
from ansys.aedt.core.workflows.misc import is_student
import ansys.aedt.core.extensions
from ansys.aedt.core.extensions.misc import get_aedt_version
from ansys.aedt.core.extensions.misc import get_arguments
from ansys.aedt.core.extensions.misc import get_port
from ansys.aedt.core.extensions.misc import get_process_id
from ansys.aedt.core.extensions.misc import is_student

port = get_port()
version = get_aedt_version()
Expand All @@ -50,7 +50,7 @@ def frontend(): # pragma: no cover

import PIL.Image
import PIL.ImageTk
from ansys.aedt.core.workflows.misc import ExtensionTheme
from ansys.aedt.core.extensions.misc import ExtensionTheme

master = tkinter.Tk()
master.title(extension_description)
Expand All @@ -59,7 +59,7 @@ def frontend(): # pragma: no cover
master.flag = False

# Load the logo for the main window
icon_path = Path(ansys.aedt.core.workflows.__path__[0]) / "images" / "large" / "logo.png"
icon_path = Path(ansys.aedt.core.extensions.__path__[0]) / "images" / "large" / "logo.png"
im = PIL.Image.open(icon_path)
photo = PIL.ImageTk.PhotoImage(im)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@

import warnings

import ansys.aedt.core.extensions
import ansys.aedt.core.extensions.templates
from ansys.aedt.core.generic.file_utils import read_toml
from ansys.aedt.core.generic.settings import is_linux
import ansys.aedt.core.workflows
import ansys.aedt.core.workflows.templates
from defusedxml.ElementTree import ParseError
from defusedxml.minidom import parseString

Expand Down Expand Up @@ -116,7 +116,7 @@ def add_automation_tab(
panel_element.remove(b)

if not icon_file:
icon_file = os.path.join(os.path.dirname(ansys.aedt.core.workflows.__file__), "images", "large", "pyansys.png")
icon_file = os.path.join(os.path.dirname(ansys.aedt.core.extensions.__file__), "images", "large", "pyansys.png")

file_name = os.path.basename(icon_file)

Expand Down Expand Up @@ -224,7 +224,7 @@ def available_toolkits():

def add_script_to_menu(
name,
script_file,
script_file=None,
template_file="run_pyaedt_toolkit_script",
icon_file=None,
product="Project",
Expand All @@ -245,7 +245,7 @@ def add_script_to_menu(
----------
name : str
Name of the toolkit to appear in AEDT.
script_file : str
script_file : str, optional
Full path to the script file. The script will be copied to Personal Lib.
template_file : str
Script template name to use. The default is ``"run_pyaedt_toolkit_script"``.
Expand Down Expand Up @@ -295,9 +295,10 @@ def add_script_to_menu(
toolkit_rel_lib_dir = os.path.join("Lib", file_name)
lib_dir = os.path.join(toolkit_dir, toolkit_rel_lib_dir)
toolkit_rel_lib_dir = "../../" + toolkit_rel_lib_dir
os.makedirs(lib_dir, exist_ok=True)
if copy_to_personal_lib:
os.makedirs(lib_dir, exist_ok=True)
os.makedirs(tool_dir, exist_ok=True)
dest_script_path = None
dest_script_path = script_file
if script_file and copy_to_personal_lib:
dest_script_path = os.path.join(lib_dir, os.path.split(script_file)[-1])
shutil.copy2(script_file, dest_script_path)
Expand All @@ -313,7 +314,7 @@ def add_script_to_menu(
version_agnostic = True
executable_version_agnostic = executable_interpreter

templates_dir = os.path.dirname(ansys.aedt.core.workflows.templates.__file__)
templates_dir = os.path.dirname(ansys.aedt.core.extensions.templates.__file__)

ipython_executable = executable_version_agnostic.replace("python" + __exe(), "ipython" + __exe())
jupyter_executable = executable_version_agnostic.replace("python" + __exe(), "jupyter" + __exe())
Expand All @@ -326,6 +327,7 @@ def add_script_to_menu(
build_file_data = build_file_data.replace("##PYTHON_EXE##", executable_version_agnostic)
build_file_data = build_file_data.replace("##JUPYTER_EXE##", jupyter_executable)
build_file_data = build_file_data.replace("##TOOLKIT_NAME##", file_name)
build_file_data = build_file_data.replace("##EXTENSION_TEMPLATES##", templates_dir)
if dest_script_path:
build_file_data = build_file_data.replace("##PYTHON_SCRIPT##", dest_script_path)

Expand Down Expand Up @@ -508,7 +510,7 @@ def add_custom_toolkit(desktop_object, toolkit_name, wheel_toolkit=None, install
tool_dir = os.path.join(toolkit_dir, product_name, toolkit_info["name"])

script_image = os.path.abspath(
os.path.join(os.path.dirname(ansys.aedt.core.workflows.__file__), product_name.lower(), toolkit_info["icon"])
os.path.join(os.path.dirname(ansys.aedt.core.extensions.__file__), product_name.lower(), toolkit_info["icon"])
)

if install:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,14 @@

import ansys.aedt.core
from ansys.aedt.core import Hfss
import ansys.aedt.core.extensions
from ansys.aedt.core.extensions.misc import get_aedt_version
from ansys.aedt.core.extensions.misc import get_arguments
from ansys.aedt.core.extensions.misc import get_port
from ansys.aedt.core.extensions.misc import get_process_id
from ansys.aedt.core.extensions.misc import is_student
from ansys.aedt.core.generic.file_utils import read_json
from ansys.aedt.core.generic.file_utils import write_configuration_file
import ansys.aedt.core.workflows
from ansys.aedt.core.workflows.misc import get_aedt_version
from ansys.aedt.core.workflows.misc import get_arguments
from ansys.aedt.core.workflows.misc import get_port
from ansys.aedt.core.workflows.misc import get_process_id
from ansys.aedt.core.workflows.misc import is_student

port = get_port()
version = get_aedt_version()
Expand Down Expand Up @@ -96,7 +96,7 @@ def frontend(): # pragma: no cover

import PIL.Image
import PIL.ImageTk
from ansys.aedt.core.workflows.misc import ExtensionTheme
from ansys.aedt.core.extensions.misc import ExtensionTheme

# Create UI
master = tkinter.Tk()
Expand All @@ -106,7 +106,7 @@ def frontend(): # pragma: no cover
master.flag = False

# Load the logo for the main window
icon_path = Path(ansys.aedt.core.workflows.__path__[0]) / "images" / "large" / "logo.png"
icon_path = Path(ansys.aedt.core.extensions.__path__[0]) / "images" / "large" / "logo.png"
im = PIL.Image.open(icon_path)
photo = PIL.ImageTk.PhotoImage(im)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@

import ansys.aedt.core
from ansys.aedt.core import get_pyaedt_app
from ansys.aedt.core.extensions.misc import get_aedt_version
from ansys.aedt.core.extensions.misc import get_arguments
from ansys.aedt.core.extensions.misc import get_port
from ansys.aedt.core.extensions.misc import get_process_id
from ansys.aedt.core.extensions.misc import is_student
from ansys.aedt.core.internal.errors import AEDTRuntimeError
from ansys.aedt.core.workflows.misc import get_aedt_version
from ansys.aedt.core.workflows.misc import get_arguments
from ansys.aedt.core.workflows.misc import get_port
from ansys.aedt.core.workflows.misc import get_process_id
from ansys.aedt.core.workflows.misc import is_student
import numpy as np
from scipy.interpolate import CubicSpline

Expand All @@ -54,7 +54,7 @@ def frontend(): # pragma: no cover

import PIL.Image
import PIL.ImageTk
from ansys.aedt.core.workflows.misc import ExtensionTheme
from ansys.aedt.core.extensions.misc import ExtensionTheme

app = ansys.aedt.core.Desktop(
new_desktop=False,
Expand Down Expand Up @@ -96,7 +96,7 @@ def frontend(): # pragma: no cover
master.flag = False

# Load the logo for the main window
icon_path = Path(ansys.aedt.core.workflows.__path__[0]) / "images" / "large" / "logo.png"
icon_path = Path(ansys.aedt.core.extensions.__path__[0]) / "images" / "large" / "logo.png"
im = PIL.Image.open(icon_path)
photo = PIL.ImageTk.PhotoImage(im)

Expand Down
Loading
Loading