diff --git a/doc/changelog.d/5997.dependencies.md b/doc/changelog.d/5997.dependencies.md new file mode 100644 index 00000000000..e1767ea1d75 --- /dev/null +++ b/doc/changelog.d/5997.dependencies.md @@ -0,0 +1 @@ +Update install targets and dependencies \ No newline at end of file diff --git a/doc/source/Getting_started/Installation.rst b/doc/source/Getting_started/Installation.rst index 0d47a178d1b..c7691c9e45b 100644 --- a/doc/source/Getting_started/Installation.rst +++ b/doc/source/Getting_started/Installation.rst @@ -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:: @@ -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:////PyAEDT-v-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:////PyAEDT-v-wheelhouse-Windows-3.10 pyaedt[installer] - Finally, in the Python console, run the following commands: .. code:: diff --git a/doc/source/Resources/pyaedt_installer_from_aedt.py b/doc/source/Resources/pyaedt_installer_from_aedt.py index 12abb5d58e7..a8619e0e937 100644 --- a/doc/source/Resources/pyaedt_installer_from_aedt.py +++ b/doc/source/Resources/pyaedt_installer_from_aedt.py @@ -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) diff --git a/pyproject.toml b/pyproject.toml index 05542a28227..3d29c4a6715 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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", @@ -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__"} diff --git a/src/ansys/aedt/core/workflows/project/version_manager.py b/src/ansys/aedt/core/workflows/project/version_manager.py index 589d3729455..bd6bd1f8009 100644 --- a/src/ansys/aedt/core/workflows/project/version_manager.py +++ b/src/ansys/aedt/core/workflows/project/version_manager.py @@ -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) if response.status_code == 200: data = response.json() return data["info"]["version"] @@ -417,12 +417,23 @@ def get_pyedb_branch(self): 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 + 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("-") msg = [] correct_wheelhouse = file_name @@ -437,9 +448,16 @@ def update_from_wheelhouse(self): ) 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."]) + 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."]) if msg is not []: msg.extend(["", f"Please download {correct_wheelhouse}."]) @@ -465,7 +483,7 @@ def update_from_wheelhouse(self): "--no-cache-dir", "--no-index", f"--find-links=file:///{str(unzipped_path)}", - "pyaedt[installer]", + "pyaedt[all]", ], check=True, ) # nosec