Skip to content

Commit 8efc45e

Browse files
germa89pyansys-ci-botCopilot
authored
chore: migrate ansys-tools-path -> ansys-tools-common (#4307)
* chore: migrate ansys-tools-path -> ansys-tools-common Update dependency, imports, docs, links, and tests to use ansys-tools-common (ansys.tools.common.path) instead of ansys-tools-path. Add _HAS_ATC feature flag and provide a backward-compatible _HAS_ATP alias. Adjust CLI/help text, sphinx intersphinx mapping, workflow comment, and numerous test patches to reflect the new package name. * chore: adding changelog file 4307.maintenance.md [dependabot-skip] * Update src/ansys/mapdl/core/report.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: pyansys-ci-bot <92810346+pyansys-ci-bot@users.noreply.github.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent 45ead1e commit 8efc45e

File tree

21 files changed

+91
-89
lines changed

21 files changed

+91
-89
lines changed

.github/workflows/test-local.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ jobs:
250250
echo "ON_UBUNTU: $ON_UBUNTU"
251251
echo "ON_STUDENT: $ON_STUDENT"
252252
253-
# Because there is no 'ansys-tools-path' we need to input the
253+
# Because there is no 'ansys-tools-common' we need to input the
254254
# executable path with the env var: PYMAPDL_MAPDL_EXEC.
255255
256256
if [[ "${MAPDL_VERSION}" == *"latest-ubuntu"* ]] ; then
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Migrate ansys-tools-path -> ansys-tools-common

doc/source/api/launcher.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ Launcher
44
========
55
Various PyMAPDL specific launcher commands.
66
Most of these commands are called from the
7-
library `ansys-tools-path <ansys_tools_path_>`_.
7+
library `ansys-tools-common.path <ansys_tools_common_>`_.
88

99
.. currentmodule:: ansys.mapdl.core.launcher
1010

@@ -18,10 +18,10 @@ library `ansys-tools-path <ansys_tools_path_>`_.
1818
close_all_local_instances
1919

2020

21-
``ansys-tools-path`` functions
22-
------------------------------
21+
``ansys-tools-common.path`` functions
22+
--------------------------------------
2323

24-
.. currentmodule:: ansys.tools.path
24+
.. currentmodule:: ansys.tools.common.path
2525

2626
.. autosummary::
2727
:toctree: _autosummary

doc/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@
125125
"pypim": ("https://pypim.docs.pyansys.com/version/dev/", None),
126126
"ansys-dpf-core": ("https://dpf.docs.pyansys.com/version/stable/", None),
127127
"ansys-math-core": ("https://math.docs.pyansys.com/version/stable/", None),
128-
"ansys-tools-path": ("https://path.tools.docs.pyansys.com/version/stable/", None),
128+
"ansys-tools-common": ("https://tools.docs.pyansys.com/version/stable/", None),
129129
"pytwin": ("https://twin.docs.pyansys.com/version/stable/", None),
130130
}
131131

doc/source/links.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
.. _dpf_post_docs: https://post.docs.pyansys.com
1515
.. _legacy_reader_docs: https://reader.docs.pyansys.com/
1616
.. _example_data_repo: https://github.com/ansys/example-data
17-
.. _ansys_tools_path: http://path.tools.docs.pyansys.com/
17+
.. _ansys_tools_path: https://tools.docs.pyansys.com/version/stable/user_guide/ansys_tools_path.html
1818
.. _pyansys_math: https://math.docs.pyansys.com/version/stable/
1919
.. _pyansys_math_api: https://math.docs.pyansys.com/version/stable/api/index.html
2020
.. _pytwin_docs: https://twin.docs.pyansys.com

doc/source/user_guide/troubleshoot.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -725,7 +725,7 @@ If you want to see which Ansys installations PyMAPDL has detected, use:
725725
726726
Student versions are provided as **negative** versions because the Python dictionary
727727
does not accept two equal keys. The result of the
728-
:func:`get_available_ansys_installations() <ansys.tools.path.get_available_ansys_installations>`
728+
:func:`get_available_ansys_installations() <ansys.tools.common.path.get_available_ansys_installations>`
729729
method lists higher versions first and student versions last.
730730

731731
.. warning::

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ dependencies = [
2323
"ansys-mapdl-reader>=0.51.7",
2424
"ansys-math-core>=0.1.2",
2525
"ansys-platform-instancemanagement~=1.0",
26-
"ansys-tools-path>=0.3.1",
26+
"ansys-tools-common>=0.2.1",
2727
"click>=8.1.3", # for CLI interface
2828
"grpcio>=1.30.0", # tested up to grpcio==1.35
2929
"numpy>=1.14.0,<3.0.0",

src/ansys/mapdl/core/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
import logging
2828
import os
2929
from typing import Dict, List, Tuple
30-
from warnings import warn
3130

3231
from platformdirs import user_data_dir
3332

@@ -64,7 +63,8 @@
6463
MINIMUM_PYTHON_VERSION: Tuple[int, int] = (3, 10)
6564

6665
# Import related globals
67-
_HAS_ATP: bool = is_installed("ansys.tools.path")
66+
_HAS_ATC: bool = is_installed("ansys.tools.common")
67+
_HAS_ATP: bool = _HAS_ATC # Backward compatibility alias
6868
_HAS_CLICK: bool = is_installed("click")
6969
_HAS_DPF: bool = is_installed("ansys.dpf.core")
7070
_HAS_MATPLOTLIB: bool = is_installed("matplotlib")
@@ -128,8 +128,8 @@
128128
# ==================
129129
#
130130
# For compatibility with other versions or for convenience
131-
if _HAS_ATP:
132-
from ansys.tools.path.path import (
131+
if _HAS_ATC:
132+
from ansys.tools.common.path import (
133133
change_default_ansys_path,
134134
find_mapdl,
135135
get_available_ansys_installations,

src/ansys/mapdl/core/cli/start.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@
165165
"--version",
166166
default=None,
167167
type=str,
168-
help="Version of MAPDL to launch. If ``None``, the latest version is used. Versions can be provided as integers (i.e. ``version=222``) or floats (i.e. ``version=22.2``). To retrieve the available installed versions, use the function :meth:`ansys.tools.path.path.get_available_ansys_installations`.",
168+
help="Version of MAPDL to launch. If ``None``, the latest version is used. Versions can be provided as integers (i.e. ``version=222``) or floats (i.e. ``version=22.2``). To retrieve the available installed versions, use the function :meth:`ansys.tools.common.path.get_available_ansys_installations`.",
169169
)
170170
def start(
171171
exec_file: str,

src/ansys/mapdl/core/launcher.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
import psutil
5353

5454
from ansys.mapdl import core as pymapdl
55-
from ansys.mapdl.core import _HAS_ATP, _HAS_PIM, LOG # type: ignore
55+
from ansys.mapdl.core import _HAS_ATC, _HAS_PIM, LOG # type: ignore
5656
from ansys.mapdl.core._version import SUPPORTED_ANSYS_VERSIONS
5757
from ansys.mapdl.core.errors import (
5858
LockFileException,
@@ -77,8 +77,8 @@
7777
if _HAS_PIM:
7878
import ansys.platform.instancemanagement as pypim # type: ignore
7979

80-
if _HAS_ATP:
81-
from ansys.tools.path import version_from_path as _version_from_path
80+
if _HAS_ATC:
81+
from ansys.tools.common.path import version_from_path as _version_from_path
8282

8383
@wraps(_version_from_path)
8484
def version_from_path(*args: Any, **kwargs: Any) -> int | None:
@@ -919,7 +919,7 @@ def get_default_ansys() -> Union[Tuple[str, float], Tuple[Literal[""], Literal["
919919
>>> get_default_ansys()
920920
(/usr/ansys_inc/v211/ansys/bin/ansys211, 21.1)
921921
"""
922-
from ansys.tools.path import find_mapdl
922+
from ansys.tools.common.path import find_mapdl
923923

924924
return find_mapdl(supported_versions=SUPPORTED_ANSYS_VERSIONS)
925925

@@ -976,11 +976,11 @@ def get_default_ansys_version():
976976

977977
def check_valid_ansys() -> bool:
978978
"""Checks if a valid version of ANSYS is installed and preconfigured"""
979-
if not _HAS_ATP:
979+
if not _HAS_ATC:
980980
raise ModuleNotFoundError(
981-
"The package 'ansys-tools-path' is required to use this function."
981+
"The package 'ansys-tools-common' is required to use this function."
982982
)
983-
from ansys.tools.path import get_mapdl_path
983+
from ansys.tools.common.path import get_mapdl_path
984984

985985
ansys_bin = get_mapdl_path(allow_input=False) # type: ignore
986986
if ansys_bin is not None:
@@ -1041,11 +1041,11 @@ def set_MPI_additional_switches(
10411041

10421042
# known issues with distributed memory parallel (DMP)
10431043
if os.name == "nt" and "smp" not in add_sw_lower_case: # pragma: no cover
1044-
if _HAS_ATP:
1044+
if _HAS_ATC:
10451045
condition = not force_intel and version and (222 > version >= 210)
10461046
else:
10471047
warnings.warn(
1048-
"Because 'ansys-tools-path' is not installed, PyMAPDL cannot check\n"
1048+
"Because 'ansys-tools-common' is not installed, PyMAPDL cannot check\n"
10491049
"if this Ansys version requires the MPI fix, so if you are on Windows,\n"
10501050
"the fix is applied by default.\n"
10511051
"Use 'force_intel=True' to not apply the fix."
@@ -1388,7 +1388,7 @@ def launch_mapdl(
13881388
Versions can be provided as integers (i.e. ``version=222``) or floats
13891389
(i.e. ``version=22.2``).
13901390
To retrieve the available installed versions, use the function
1391-
:func:`ansys.tools.path.get_available_ansys_installations`.
1391+
:func:`ansys.tools.common.path.get_available_ansys_installations`.
13921392
You can also provide this value through the environment variable
13931393
:envvar:`PYMAPDL_MAPDL_VERSION`. For instance:
13941394
@@ -2457,7 +2457,7 @@ def get_version(
24572457

24582458
if not version:
24592459
# verify version
2460-
if exec_file and _HAS_ATP:
2460+
if exec_file and _HAS_ATC:
24612461
version = version_from_path("mapdl", exec_file, launch_on_hpc=launch_on_hpc)
24622462
if version and version < 202:
24632463
raise VersionError(
@@ -2571,7 +2571,7 @@ def get_exec_file(args: Dict[str, Any]) -> None:
25712571
Raises
25722572
------
25732573
ModuleNotFoundError
2574-
'ansys-tools-path' library could not be found
2574+
'ansys-tools-common' library could not be found
25752575
FileNotFoundError
25762576
Invalid exec_file path or cannot load cached MAPDL path.
25772577
FileNotFoundError
@@ -2585,13 +2585,13 @@ def get_exec_file(args: Dict[str, Any]) -> None:
25852585
return
25862586

25872587
if args["exec_file"] is None:
2588-
if not _HAS_ATP:
2588+
if not _HAS_ATC:
25892589
raise ModuleNotFoundError(
2590-
"If you don't have 'ansys-tools-path' library installed, you need "
2590+
"If you don't have 'ansys-tools-common' library installed, you need "
25912591
"to input the executable path ('exec_file' argument) or use the "
25922592
"'PYMAPDL_MAPDL_EXEC' environment variable."
25932593
)
2594-
from ansys.tools.path import get_mapdl_path
2594+
from ansys.tools.common.path import get_mapdl_path
25952595

25962596
if args.get("_debug_no_launch", False):
25972597
args["exec_file"] = ""

0 commit comments

Comments
 (0)