Skip to content
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
2 changes: 1 addition & 1 deletion .github/workflows/test-local.yml
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@ jobs:
echo "ON_UBUNTU: $ON_UBUNTU"
echo "ON_STUDENT: $ON_STUDENT"

# Because there is no 'ansys-tools-path' we need to input the
# Because there is no 'ansys-tools-common' we need to input the
# executable path with the env var: PYMAPDL_MAPDL_EXEC.

if [[ "${MAPDL_VERSION}" == *"latest-ubuntu"* ]] ; then
Expand Down
1 change: 1 addition & 0 deletions doc/changelog.d/4307.maintenance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Migrate ansys-tools-path -> ansys-tools-common
8 changes: 4 additions & 4 deletions doc/source/api/launcher.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Launcher
========
Various PyMAPDL specific launcher commands.
Most of these commands are called from the
library `ansys-tools-path <ansys_tools_path_>`_.
library `ansys-tools-common.path <ansys_tools_common_>`_.

.. currentmodule:: ansys.mapdl.core.launcher

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


``ansys-tools-path`` functions
------------------------------
``ansys-tools-common.path`` functions
--------------------------------------

.. currentmodule:: ansys.tools.path
.. currentmodule:: ansys.tools.common.path

.. autosummary::
:toctree: _autosummary
Expand Down
2 changes: 1 addition & 1 deletion doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
"pypim": ("https://pypim.docs.pyansys.com/version/dev/", None),
"ansys-dpf-core": ("https://dpf.docs.pyansys.com/version/stable/", None),
"ansys-math-core": ("https://math.docs.pyansys.com/version/stable/", None),
"ansys-tools-path": ("https://path.tools.docs.pyansys.com/version/stable/", None),
"ansys-tools-common": ("https://tools.docs.pyansys.com/version/stable/", None),
"pytwin": ("https://twin.docs.pyansys.com/version/stable/", None),
}

Expand Down
2 changes: 1 addition & 1 deletion doc/source/links.rst
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
.. _dpf_post_docs: https://post.docs.pyansys.com
.. _legacy_reader_docs: https://reader.docs.pyansys.com/
.. _example_data_repo: https://github.com/ansys/example-data
.. _ansys_tools_path: http://path.tools.docs.pyansys.com/
.. _ansys_tools_path: https://tools.docs.pyansys.com/version/stable/user_guide/ansys_tools_path.html
.. _pyansys_math: https://math.docs.pyansys.com/version/stable/
.. _pyansys_math_api: https://math.docs.pyansys.com/version/stable/api/index.html
.. _pytwin_docs: https://twin.docs.pyansys.com
Expand Down
2 changes: 1 addition & 1 deletion doc/source/user_guide/troubleshoot.rst
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,7 @@ If you want to see which Ansys installations PyMAPDL has detected, use:

Student versions are provided as **negative** versions because the Python dictionary
does not accept two equal keys. The result of the
:func:`get_available_ansys_installations() <ansys.tools.path.get_available_ansys_installations>`
:func:`get_available_ansys_installations() <ansys.tools.common.path.get_available_ansys_installations>`
method lists higher versions first and student versions last.

.. warning::
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ dependencies = [
"ansys-mapdl-reader>=0.51.7",
"ansys-math-core>=0.1.2",
"ansys-platform-instancemanagement~=1.0",
"ansys-tools-path>=0.3.1",
"ansys-tools-common>=0.2.1",
"click>=8.1.3", # for CLI interface
"grpcio>=1.30.0", # tested up to grpcio==1.35
"numpy>=1.14.0,<3.0.0",
Expand Down
8 changes: 4 additions & 4 deletions src/ansys/mapdl/core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import logging
import os
from typing import Dict, List, Tuple
from warnings import warn

from platformdirs import user_data_dir

Expand Down Expand Up @@ -64,7 +63,8 @@
MINIMUM_PYTHON_VERSION: Tuple[int, int] = (3, 10)

# Import related globals
_HAS_ATP: bool = is_installed("ansys.tools.path")
_HAS_ATC: bool = is_installed("ansys.tools.common")
_HAS_ATP: bool = _HAS_ATC # Backward compatibility alias
_HAS_CLICK: bool = is_installed("click")
_HAS_DPF: bool = is_installed("ansys.dpf.core")
_HAS_MATPLOTLIB: bool = is_installed("matplotlib")
Expand Down Expand Up @@ -128,8 +128,8 @@
# ==================
#
# For compatibility with other versions or for convenience
if _HAS_ATP:
from ansys.tools.path.path import (
if _HAS_ATC:
from ansys.tools.common.path import (
change_default_ansys_path,
find_mapdl,
get_available_ansys_installations,
Expand Down
2 changes: 1 addition & 1 deletion src/ansys/mapdl/core/cli/start.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@
"--version",
default=None,
type=str,
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`.",
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`.",
)
def start(
exec_file: str,
Expand Down
30 changes: 15 additions & 15 deletions src/ansys/mapdl/core/launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
import psutil

from ansys.mapdl import core as pymapdl
from ansys.mapdl.core import _HAS_ATP, _HAS_PIM, LOG # type: ignore
from ansys.mapdl.core import _HAS_ATC, _HAS_PIM, LOG # type: ignore
from ansys.mapdl.core._version import SUPPORTED_ANSYS_VERSIONS
from ansys.mapdl.core.errors import (
LockFileException,
Expand All @@ -77,8 +77,8 @@
if _HAS_PIM:
import ansys.platform.instancemanagement as pypim # type: ignore

if _HAS_ATP:
from ansys.tools.path import version_from_path as _version_from_path
if _HAS_ATC:
from ansys.tools.common.path import version_from_path as _version_from_path

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

return find_mapdl(supported_versions=SUPPORTED_ANSYS_VERSIONS)

Expand Down Expand Up @@ -976,11 +976,11 @@ def get_default_ansys_version():

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

ansys_bin = get_mapdl_path(allow_input=False) # type: ignore
if ansys_bin is not None:
Expand Down Expand Up @@ -1041,11 +1041,11 @@ def set_MPI_additional_switches(

# known issues with distributed memory parallel (DMP)
if os.name == "nt" and "smp" not in add_sw_lower_case: # pragma: no cover
if _HAS_ATP:
if _HAS_ATC:
condition = not force_intel and version and (222 > version >= 210)
else:
warnings.warn(
"Because 'ansys-tools-path' is not installed, PyMAPDL cannot check\n"
"Because 'ansys-tools-common' is not installed, PyMAPDL cannot check\n"
"if this Ansys version requires the MPI fix, so if you are on Windows,\n"
"the fix is applied by default.\n"
"Use 'force_intel=True' to not apply the fix."
Expand Down Expand Up @@ -1388,7 +1388,7 @@ def launch_mapdl(
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
:func:`ansys.tools.path.get_available_ansys_installations`.
:func:`ansys.tools.common.path.get_available_ansys_installations`.
You can also provide this value through the environment variable
:envvar:`PYMAPDL_MAPDL_VERSION`. For instance:

Expand Down Expand Up @@ -2457,7 +2457,7 @@ def get_version(

if not version:
# verify version
if exec_file and _HAS_ATP:
if exec_file and _HAS_ATC:
version = version_from_path("mapdl", exec_file, launch_on_hpc=launch_on_hpc)
if version and version < 202:
raise VersionError(
Expand Down Expand Up @@ -2571,7 +2571,7 @@ def get_exec_file(args: Dict[str, Any]) -> None:
Raises
------
ModuleNotFoundError
'ansys-tools-path' library could not be found
'ansys-tools-common' library could not be found
FileNotFoundError
Invalid exec_file path or cannot load cached MAPDL path.
FileNotFoundError
Expand All @@ -2585,13 +2585,13 @@ def get_exec_file(args: Dict[str, Any]) -> None:
return

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

if args.get("_debug_no_launch", False):
args["exec_file"] = ""
Expand Down
8 changes: 4 additions & 4 deletions src/ansys/mapdl/core/licensing.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@
import time
from typing import Iterator, Literal

from ansys.mapdl.core import _HAS_ATP, LOG
from ansys.mapdl.core import _HAS_ATC, LOG
from ansys.mapdl.core.errors import LicenseServerConnectionError
from ansys.mapdl.core.misc import threaded_daemon

if _HAS_ATP:
from ansys.tools.path import get_mapdl_path, version_from_path
if _HAS_ATC:
from ansys.tools.common.path import get_mapdl_path, version_from_path

LOCALHOST = "127.0.0.1"
LIC_PATH_ENVAR = "ANSYSLIC_DIR"
Expand Down Expand Up @@ -150,7 +150,7 @@ def start(self, license_file: bool = True, checkout_license: bool = False):
Start the checkout license thread. By default this is
disabled.
"""
if license_file and _HAS_ATP:
if license_file and _HAS_ATC:
self._lic_file_thread = self.check_license_file()
if checkout_license:
self._checkout_thread = self.checkout_license()
Expand Down
6 changes: 3 additions & 3 deletions src/ansys/mapdl/core/mapdl_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1745,7 +1745,7 @@ def open_gui(

exec_file: str, optional
Path to the MAPDL executable. If not provided, it will try to obtain
it using the `ansys.tools.path` package. If this package is not
it using the `ansys.tools.common` package. If this package is not
available, it will use the same executable as the current MAPDL
instance.

Expand Down Expand Up @@ -1778,7 +1778,7 @@ def open_gui(
>>> mapdl.eplot()
"""
# lazy load here to avoid circular import
from ansys.mapdl.core import _HAS_ATP
from ansys.mapdl.core import _HAS_ATC

if not self._local:
raise MapdlRuntimeError(
Expand Down Expand Up @@ -1857,7 +1857,7 @@ def open_gui(
os.chdir(run_dir)

if not exec_file:
if _HAS_ATP:
if _HAS_ATC:
from ansys.mapdl.core import get_mapdl_path

exec_file_ = get_mapdl_path(allow_input=False)
Expand Down
12 changes: 6 additions & 6 deletions src/ansys/mapdl/core/pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
import warnings
import weakref

from ansys.mapdl.core import _HAS_ATP, _HAS_TQDM, LOG, launch_mapdl
from ansys.mapdl.core import _HAS_ATC, _HAS_TQDM, LOG, launch_mapdl
from ansys.mapdl.core.errors import MapdlDidNotStart, MapdlRuntimeError, VersionError
from ansys.mapdl.core.launcher import (
LOCALHOST,
Expand All @@ -40,8 +40,8 @@
)
from ansys.mapdl.core.misc import create_temp_dir, threaded, threaded_daemon

if _HAS_ATP:
from ansys.tools.path import get_mapdl_path, version_from_path
if _HAS_ATC:
from ansys.tools.common.path import get_mapdl_path, version_from_path

if _HAS_TQDM:
from tqdm import tqdm
Expand Down Expand Up @@ -276,12 +276,12 @@ def __init__(
exec_file = kwargs.get("exec_file", exec_file)

if not exec_file: # get default executable
if _HAS_ATP:
if _HAS_ATC:
exec_file = get_mapdl_path()
else:
raise ValueError(
"Please use 'exec_file' argument to specify the location of the ansys installation.\n"
"Alternatively, PyMAPDL can detect your ansys installation if you install 'ansys-tools-path' library."
"Alternatively, PyMAPDL can detect your ansys installation if you install 'ansys-tools-common' library."
)

if exec_file is None:
Expand All @@ -292,7 +292,7 @@ def __init__(
)

# Checking version
if _HAS_ATP:
if _HAS_ATC:
if version_from_path("mapdl", exec_file) < 211:
raise VersionError("MapdlPool requires MAPDL 2021R1 or later.")

Expand Down
10 changes: 5 additions & 5 deletions src/ansys/mapdl/core/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,13 @@
"""Module for report features"""
import os

from ansys.mapdl.core import _HAS_ATP, _HAS_PYANSYS_REPORT, _HAS_PYVISTA
from ansys.mapdl.core import _HAS_ATC, _HAS_PYANSYS_REPORT, _HAS_PYVISTA

if _HAS_PYANSYS_REPORT:
import ansys.tools.report as pyansys_report

if _HAS_ATP:
from ansys.tools.path import get_available_ansys_installations
if _HAS_ATC:
from ansys.tools.common.path import get_available_ansys_installations

ANSYS_ENV_VARS = [
"PYMAPDL_START_INSTANCE",
Expand Down Expand Up @@ -152,7 +152,7 @@ def mapdl_info(self):
# List installed Ansys
lines = ["", "Ansys Environment Report", "-" * 79]
lines = ["\n", "Ansys Installation", "******************"]
if _HAS_ATP:
if _HAS_ATC:
mapdl_install = get_available_ansys_installations()

if not mapdl_install:
Expand All @@ -165,7 +165,7 @@ def mapdl_info(self):
else:
mapdl_install = None
lines.append(
"Unable to locate any Ansys installations because 'ansys-tools-path is not installed."
"Unable to locate any Ansys installations because 'ansys-tools-common' is not installed."
)

install_info = "\n".join(lines)
Expand Down
4 changes: 2 additions & 2 deletions tests/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def is_on_local():
os.environ.get("PYMAPDL_START_INSTANCE").lower() != "false"
) # default is false

from ansys.tools.path import find_mapdl
from ansys.tools.common.path import find_mapdl

_, rver = find_mapdl()

Expand Down Expand Up @@ -109,7 +109,7 @@ def has_grpc():
return True

try:
from ansys.tools.path import find_mapdl
from ansys.tools.common.path import find_mapdl
except ModuleNotFoundError:
return True

Expand Down
4 changes: 2 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,8 +209,8 @@ def requires_dependency(dependency: str):
# ------------------
#

if has_dependency("ansys-tools-path"):
from ansys.tools.path import find_mapdl
if has_dependency("ansys-tools-common"):
from ansys.tools.common.path import find_mapdl


if has_dependency("pyvista"):
Expand Down
2 changes: 1 addition & 1 deletion tests/test_inprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def exec_path(self) -> str:

self._exec_path = os.getenv("PYMAPDL_MAPDL_EXEC")
if self._exec_path is None:
from ansys.tools.path import get_mapdl_path
from ansys.tools.common.path import get_mapdl_path

version: float | None = (
float(os.getenv("PYMAPDL_MAPDL_VERSION", 0)) or None
Expand Down
Loading
Loading