Skip to content

BUILD: Update install targets and dependencies #5997

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 6 commits into from
Apr 3, 2025
Merged
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions doc/changelog.d/5997.dependencies.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update install targets and dependencies
12 changes: 0 additions & 12 deletions doc/source/Getting_started/Installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,6 @@ If you are not utilizing gRPC, you can install the required dotnet dependencies

pip install pyaedt[dotnet]

If you want to install the PyAEDT panels in the AEDT Automation tab, use the following command:

.. code:: python

pip install pyaedt[installer]

Finally, in the Python console, run the following commands:

.. code::
Expand Down Expand Up @@ -154,12 +148,6 @@ For example, on Windows with Python 3.10, install PyAEDT and all its dependencie

pip install --no-cache-dir --no-index --find-links=file:///<path_to_wheelhouse>/PyAEDT-v<release_version>-wheelhouse-Windows-3.10 pyaedt[all]

If you want to add the PyAEDT panels in the AEDT Automation tab, you need first to install the installer dependencies:

.. code::

pip install --no-cache-dir --no-index --find-links=file:///<path_to_wheelhouse>/PyAEDT-v<release_version>-wheelhouse-Windows-3.10 pyaedt[installer]

Finally, in the Python console, run the following commands:

.. code::
Expand Down
93 changes: 36 additions & 57 deletions doc/source/Resources/pyaedt_installer_from_aedt.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,89 +249,68 @@ def install_pyaedt():
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"])
subprocess.run([sys.executable, "-m", "venv", str(venv_dir), "--system-site-packages"], check=True)
else:
subprocess.call([sys.executable, "-m", "venv", str(venv_dir)])
subprocess.run([sys.executable, "-m", "venv", str(venv_dir)], check=True)

if args.wheel and Path(args.wheel).exists():
print("Installing PyAEDT using provided wheels argument")
unzipped_path = unzip_if_zip(Path(args.wheel))
command = [
str(pip_exe),
"install",
"--no-cache-dir",
"--no-index",
r"--find-links={}".format(str(unzipped_path)),
]
if args.version <= "231":
subprocess.call(
[
str(pip_exe),
"install",
"--no-cache-dir",
"--no-index",
r"--find-links={}".format(str(unzipped_path)),
"pyaedt[all,dotnet]=='0.9.0'",
]
)
command.append("pyaedt[all,dotnet]=='0.9.0'")
else:
subprocess.call(
[
str(pip_exe),
"install",
"--no-cache-dir",
"--no-index",
r"--find-links={}".format(str(unzipped_path)),
"pyaedt[installer]",
]
)

command.append("pyaedt[all]")
subprocess.run(command, check=True) # nosec
else:
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"])
subprocess.run([str(python_exe), "-m", "pip", "install", "--upgrade", "pip"], check=True) # nosec
subprocess.run([str(pip_exe), "--default-timeout=1000", "install", "wheel"], check=True) # nosec
if args.version <= "231":
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"])
subprocess.run([str(pip_exe), "--default-timeout=1000", "install", "pyaedt[all]=='0.9.0'"], check=True) # nosec
subprocess.run([str(pip_exe), "--default-timeout=1000", "install", "jupyterlab"], check=True) # nosec
subprocess.run([str(pip_exe), "--default-timeout=1000", "install", "ipython", "-U"], check=True) # nosec
subprocess.run([str(pip_exe), "--default-timeout=1000", "install", "ipyvtklink"], check=True) # nosec
else:
subprocess.call([str(pip_exe), "--default-timeout=1000", "install", "pyaedt[installer]"])
subprocess.run([str(pip_exe), "--default-timeout=1000", "install", "pyaedt[all]"], check=True) # nosec

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

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

if args.wheel and Path(args.wheel).exists():
print("Installing PyAEDT using provided wheels argument")
unzipped_path = unzip_if_zip(Path(args.wheel))
command = [
str(pip_exe),
"install",
"--no-cache-dir",
"--no-index",
r"--find-links={}".format(str(unzipped_path)),
]
if args.version <= "231":
subprocess.call(
[
str(pip_exe),
"install",
"--no-cache-dir",
"--no-index",
r"--find-links={}".format(str(unzipped_path)),
"pyaedt[all,dotnet]=='0.9.0'",
]
)
command.append("pyaedt[all,dotnet]=='0.9.0'")
else:
subprocess.call(
[
str(pip_exe),
"install",
"--no-cache-dir",
"--no-index",
r"--find-links={}".format(str(unzipped_path)),
"pyaedt[installer]",
]
)
command.append("pyaedt[all]")
subprocess.run(command, check=True) # nosec
else:
print("Installing PyAEDT using online sources")
if args.version <= "231":
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"])
subprocess.run([str(pip_exe), "pip=1000", "install", "pyaedt[all]=='0.9.0'"], check=True) # nosec
subprocess.run([str(pip_exe), "--default-timeout=1000", "install", "jupyterlab"], check=True) # nosec
subprocess.run([str(pip_exe), "--default-timeout=1000", "install", "ipython", "-U"], check=True) # nosec
subprocess.run([str(pip_exe), "--default-timeout=1000", "install", "ipyvtklink"], check=True) # nosec
else:
subprocess.call([str(pip_exe), "--default-timeout=1000", "install", "pyaedt[installer]"])
subprocess.run([str(pip_exe), "--default-timeout=1000", "install", "pyaedt[all]"], check=True) # nosec
sys.exit(0)


Expand Down
28 changes: 15 additions & 13 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,7 @@ dependencies = [
"jsonschema",
"psutil",
"pyedb>=0.4.0; python_version == '3.7'",
"pyedb>=0.24.0; python_version > '3.7'",
"pyedb!=0.28.0; python_version > '3.7'",
"pyedb>=0.24.0,!=0.28.0; python_version > '3.7'",
"tomli; python_version < '3.11'",
"tomli-w",
"rpyc>=6.0.0,<6.1",
Expand Down Expand Up @@ -113,21 +112,24 @@ all = [
"ansys-tools-visualization-interface; python_version >= '3.10'",
"tables; python_version >= '3.10'",
"scikit-rf>=0.30.0,<1.7",
]
installer = [
"matplotlib>=3.5.0,<3.11",
"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'",
"scikit-rf>=0.30.0,<1.7",
"jupyterlab>=3.6.0,<4.4",
"ipython>=7.30.0,<9.1",
"ipyvtklink>=0.2.0,<0.2.4",
]
# Set of dependencies used to run our examples with CPython 3.10
examples = [
"imageio==2.37.0",
"matplotlib==3.10.1",
"numpy==2.2.3",
"openpyxl==3.1.5",
"osmnx==2.0.1",
"pandas==2.2.3",
"pyvista==0.44.2",
"fast-simplification==0.1.9",
"joblib==1.4.2",
"plotly==6.0.1",
"scikit-rf==1.6.2",
]

[tool.setuptools.dynamic]
version = {attr = "ansys.aedt.core.__version__"}
Expand Down
32 changes: 25 additions & 7 deletions src/ansys/aedt/core/workflows/project/version_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@
UNKNOWN_VERSION = "Unknown"


def get_latest_version(package_name):
response = requests.get(f"https://pypi.org/pypi/{package_name}/json")
def get_latest_version(package_name, timeout=20):
response = requests.get(f"https://pypi.org/pypi/{package_name}/json", timeout=timeout)

Check warning on line 65 in src/ansys/aedt/core/workflows/project/version_manager.py

View check run for this annotation

Codecov / codecov/patch

src/ansys/aedt/core/workflows/project/version_manager.py#L64-L65

Added lines #L64 - L65 were not covered by tests
if response.status_code == 200:
data = response.json()
return data["info"]["version"]
Expand Down Expand Up @@ -417,12 +417,23 @@
self.clicked_refresh(need_restart=True)

def update_from_wheelhouse(self):
def version_is_leq(version, other_version):
version_parts = [int(part) for part in version.split(".")]
target_parts = [int(part) for part in other_version.split(".")]
if version_parts == target_parts:
return True
for v, t in zip(version_parts, target_parts):
if v < t:
return True
elif v > t:
return False

Check warning on line 429 in src/ansys/aedt/core/workflows/project/version_manager.py

View check run for this annotation

Codecov / codecov/patch

src/ansys/aedt/core/workflows/project/version_manager.py#L420-L429

Added lines #L420 - L429 were not covered by tests

file_selected = filedialog.askopenfilename(title="Select Wheelhouse")

if file_selected:
fpath = Path(file_selected)
file_name = fpath.stem
_, _, wh_pkg_type, _, _, _, wh_python_version = file_name.split("-")
_, pyaedt_version, wh_pkg_type, _, _, _, wh_python_version = file_name.split("-")

Check warning on line 436 in src/ansys/aedt/core/workflows/project/version_manager.py

View check run for this annotation

Codecov / codecov/patch

src/ansys/aedt/core/workflows/project/version_manager.py#L436

Added line #L436 was not covered by tests

msg = []
correct_wheelhouse = file_name
Expand All @@ -437,9 +448,16 @@
)
correct_wheelhouse = correct_wheelhouse.replace(wh_python_version, self.python_version)

if wh_pkg_type != "installer":
correct_wheelhouse = correct_wheelhouse.replace(f"-{wh_pkg_type}-", "-installer-")
msg.extend(["", "This wheelhouse doesn't contain required packages to add PyAEDT buttons."])
# NOTE: For compatibility reasons, we compare with 'installer' install target
# when PyAEDT's version is 0.15.3 or lower.
if version_is_leq(pyaedt_version, "0.15.3"):
if wh_pkg_type != "installer":
correct_wheelhouse = correct_wheelhouse.replace(f"-{wh_pkg_type}-", "-installer-")
msg.extend(["", "This wheelhouse doesn't contain required packages to add PyAEDT buttons."])

Check warning on line 456 in src/ansys/aedt/core/workflows/project/version_manager.py

View check run for this annotation

Codecov / codecov/patch

src/ansys/aedt/core/workflows/project/version_manager.py#L453-L456

Added lines #L453 - L456 were not covered by tests
else:
if wh_pkg_type != "all":
correct_wheelhouse = correct_wheelhouse.replace(f"-{wh_pkg_type}-", "-installer-")
msg.extend(["", "This wheelhouse doesn't contain required packages to use every PyAEDT features."])

Check warning on line 460 in src/ansys/aedt/core/workflows/project/version_manager.py

View check run for this annotation

Codecov / codecov/patch

src/ansys/aedt/core/workflows/project/version_manager.py#L458-L460

Added lines #L458 - L460 were not covered by tests

if msg is not []:
msg.extend(["", f"Please download {correct_wheelhouse}."])
Expand All @@ -465,7 +483,7 @@
"--no-cache-dir",
"--no-index",
f"--find-links=file:///{str(unzipped_path)}",
"pyaedt[installer]",
"pyaedt[all]",
],
check=True,
) # nosec
Expand Down
Loading