Skip to content

Commit

Permalink
Merge branch 'main' into feat/main_commands
Browse files Browse the repository at this point in the history
  • Loading branch information
clatapie committed Nov 26, 2024
2 parents eea116a + 4e93bf7 commit e5fc82b
Show file tree
Hide file tree
Showing 98 changed files with 1,389 additions and 1,564 deletions.
11 changes: 9 additions & 2 deletions .ci/build_matrix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ LATEST=3 # for 'latest-ubuntu' and 'latest-ubuntu-student'
ONLY_UBUNTU="${ONLY_UBUNTU:-false}"

# Do not process more than the $AUTH_USER_LIMIT_VERSIONS versions in above list
AUTH_USER_LIMIT_VERSIONS="${AUTH_USER_LIMIT_VERSIONS:-3}"
AUTH_USER_LIMIT_VERSIONS="${AUTH_USER_LIMIT_VERSIONS:-2}"
AUTH_USER_LIMIT=$((LATEST+AUTH_USER_LIMIT_VERSIONS*3))

# Students licenses only last a year, hence $NON_AUTH_USER_LIMIT_VERSIONS cannot be more than 2.
Expand Down Expand Up @@ -87,13 +87,20 @@ for version in "${versions[@]}"; do
echo " - Student: $ON_STUDENT"
echo " - Ubuntu: $ON_UBUNTU"

# Early exiting if on Ubuntu only
# Skipping if on Ubuntu only
if [[ "$ON_UBUNTU" != "true" && "$ONLY_UBUNTU" == "true" ]]; then
echo "Skipping non-ubuntu versions"
echo ""
continue
fi

# Skipping student versions on auth_user
if [[ "$auth_user" == "true" && "$ON_STUDENT" == "true" ]]; then
echo "Skipping student versions when user is authenticated"
echo ""
continue
fi

# main logic
if [[ "$auth_user" == "true" ]]; then
if [[ "$extended_testing" == "true" ]]; then
Expand Down
1 change: 0 additions & 1 deletion .github/ISSUE_TEMPLATE/bug.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ body:
description: Run `python --version` to verify your Python version
multiple: false
options:
- '3.9'
- '3.10'
- '3.11'
- '3.12'
Expand Down
1 change: 0 additions & 1 deletion .github/ISSUE_TEMPLATE/examples.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ body:
description: Run `python --version` to verify your Python version
multiple: false
options:
- '3.9'
- '3.10'
- '3.11'
- '3.12'
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ env:
DPF_PORT: 21004
MAPDL_PACKAGE: ghcr.io/ansys/mapdl
ON_CI: True
PYTEST_ARGUMENTS: '-vvv --color=yes -ra --durations=10 --maxfail=3 --reruns 3 --reruns-delay 4 --cov=ansys.mapdl.core --cov-report=html'
PYTEST_ARGUMENTS: '-vvv -rxXsa --color=yes --durations=10 --random-order --random-order-bucket=class --maxfail=10 --reruns 3 --reruns-delay 4 --cov=ansys.mapdl.core --cov-report=html'

BUILD_CHEATSHEET: True

# Following env vars when changed will "reset" the mentioned cache,
Expand Down Expand Up @@ -820,7 +821,7 @@ jobs:
- name: "Unit testing requirements installation"
run: |
python -m pip install pytest pytest-rerunfailures pytest-cov
python -m pip install pytest pytest-rerunfailures pytest-cov pytest-random-order
- name: "Unit testing"
env:
Expand Down
1 change: 1 addition & 0 deletions doc/changelog.d/3519.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
refactor: testing suite (random order)
1 change: 1 addition & 0 deletions doc/changelog.d/3556.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
refactor: increase post module coverage
1 change: 1 addition & 0 deletions doc/changelog.d/3560.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
refactor: using find_mapdl instead of find_ansys
1 change: 1 addition & 0 deletions doc/changelog.d/3564.maintenance.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ci: skipping student versions when user is authenticated
1 change: 1 addition & 0 deletions doc/changelog.d/3565.dependencies.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build: bump grpcio from 1.67.1 to 1.68.0 in the grpc-deps group
1 change: 1 addition & 0 deletions doc/changelog.d/3566.dependencies.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build: bump the core group with 2 updates
1 change: 1 addition & 0 deletions doc/changelog.d/3567.dependencies.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build: bump pytest-rerunfailures from 14.0 to 15.0 in the testing group
1 change: 1 addition & 0 deletions doc/changelog.d/3570.fixed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
fix: python version warning
1 change: 1 addition & 0 deletions doc/changelog.d/3571.miscellaneous.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
feat: supporting v25.1 and v25.2
1 change: 1 addition & 0 deletions doc/changelog.d/3572.documentation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
docs: updating compatible Python versions
1 change: 1 addition & 0 deletions doc/changelog.d/3574.miscellaneous.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
feat: adding-mode-warning
1 change: 1 addition & 0 deletions doc/changelog.d/3575.miscellaneous.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
feat: running MPI fix only if on windows
1 change: 1 addition & 0 deletions doc/changelog.d/3576.miscellaneous.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
feat: adding ``check_has_mapdl``
2 changes: 1 addition & 1 deletion doc/source/api/launcher.rst
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ library `ansys-tools-path <ansys_tools_path_>`_.
:toctree: _autosummary

change_default_ansys_path
find_ansys
find_mapdl
save_ansys_path
get_available_ansys_installations
4 changes: 3 additions & 1 deletion doc/source/getting_started/develop_pymapdl.rst
Original file line number Diff line number Diff line change
Expand Up @@ -230,12 +230,14 @@ It is executed upstream of each test and not within all tests.

.. code:: python
def test_my_new_feature(mapdl): # pass the 'mapdl' fixture as an argument.
def test_my_new_feature(mapdl, cleared): # pass the 'mapdl' fixture as an argument.
mapdl.prep7()
# .... more code
return True # if everything goes ok until here
Passing the ``cleared`` fixture is also useful since it clears up the MAPDL database
and configuration before performing the test.
If you do not have MAPDL installed locally but still want to run the
unit testing, you must set up the following environment variables.

Expand Down
8 changes: 4 additions & 4 deletions doc/source/getting_started/install_pymapdl.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Install PyMAPDL

Python module
~~~~~~~~~~~~~
The ``ansys.mapdl.core`` package currently supports Python 3.9 through
The ``ansys.mapdl.core`` package currently supports Python 3.10 through
Python 3.12 on Windows, Mac OS, and Linux.

Install the latest release from `PyPi <pymapdl_pypi_>`_ with this command:
Expand Down Expand Up @@ -48,15 +48,15 @@ Each wheelhouse archive contains all the Python wheels necessary to install
PyMAPDL from scratch on Windows and Linux. You can install
this on an isolated system with a fresh Python installation or on a virtual environment.

For example, on Linux with Python 3.9, unzip the wheelhouse archive and install it with
For example, on Linux with Python 3.10, unzip the wheelhouse archive and install it with
these commands:

.. code:: console
unzip PyMAPDL-v0.68.dev1-wheelhouse-Linux-3.9.zip wheelhouse
unzip PyMAPDL-v0.68.dev1-wheelhouse-Linux-3.10.zip wheelhouse
pip install ansys-mapdl-core -f wheelhouse --no-index --upgrade --ignore-installed
If you're on Windows with Python 3.9, unzip to a ``wheelhouse`` directory and
If you're on Windows with Python 3.10, unzip to a ``wheelhouse`` directory and
install using the preceding command.

Consider installing using a `virtual environment <using_venv_>`_.
Expand Down
2 changes: 1 addition & 1 deletion doc/source/getting_started/launcher.rst
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ to enter the path again. If you must change the default Ansys path
new_path = "C:\\Program Files\\ANSYS Inc\\v241\\ANSYS\\bin\\winx64\\ansys241.exe"
pymapdl.change_default_ansys_path(new_path)
For more information, see the :func:`change_default_ansys_path() <ansys.mapdl.core.change_default_ansys_path>` method and the :func:`find_ansys() <ansys.mapdl.core.find_ansys>` method.
For more information, see the :func:`change_default_ansys_path() <ansys.mapdl.core.change_default_ansys_path>` method and the :func:`find_mapdl() <ansys.mapdl.core.find_mapdl>` method.

Additionally, it is possible to specify the executable in each PyMAPDL script using the ``exec_file`` keyword argument.

Expand Down
2 changes: 1 addition & 1 deletion doc/source/user_guide/hpc/settings.rst
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ To print the version of Python you have available, use this code:
.. code-block:: console
user@machine:~$ python3 --version
Python 3.9.16
Python 3.10.15
You should be aware that your machine might have other Python versions
installed.
Expand Down
19 changes: 9 additions & 10 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,12 @@ dependencies = [
"ansys-mapdl-reader>=0.51.7",
"ansys-math-core>=0.1.2",
"ansys-platform-instancemanagement~=1.0",
"ansys-tools-visualization-interface>=0.2.6",
"ansys-tools-path>=0.3.1",
"ansys-tools-visualization-interface>=0.2.6",
"click>=8.1.3", # for CLI interface
"grpcio>=1.30.0", # tested up to grpcio==1.35
"matplotlib>=3.0.0", # for colormaps for pyvista
"numpy>=1.14.0,<1.25.0; python_version < '3.9'",
"numpy>=1.14.0,<3.0.0; python_version >= '3.9'",
"numpy>=1.14.0,<3.0.0",
"pexpect>=4.8.0 ; platform_system=='Linux'",
"platformdirs>=3.6.0",
"protobuf>=3.12.2", # minimum required based on latest ansys-grpc-mapdl
Expand All @@ -43,7 +42,6 @@ classifiers = [
"Operating System :: Microsoft :: Windows",
"Operating System :: POSIX",
"Operating System :: MacOS",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
Expand All @@ -67,21 +65,22 @@ tests = [
"pytest-cov==6.0.0",
"pytest-memprof<0.3.0",
"pytest-pyvista==0.1.9",
"pytest-rerunfailures==14.0",
"pytest-random-order==1.1.1",
"pytest-rerunfailures==15.0",
"pytest==8.3.3",
"scipy==1.14.1",
"vtk==9.3.1",
]
doc = [
"ansys-dpf-core==0.10.1",
"ansys-mapdl-reader==0.54.1",
"ansys-mapdl-reader==0.54.2",
"ansys-sphinx-theme==1.2.2",
"ansys-tools-visualization-interface==0.5.0",
"ansys-sphinx-theme==1.2.1",
"grpcio==1.67.1",
"grpcio==1.68.0",
"imageio-ffmpeg==0.5.1",
"imageio==2.36.0",
"jupyter==1.1.1",
"jupyter_sphinx==0.5.3",
"jupyter==1.1.1",
"jupyterlab>=3.2.8",
"matplotlib==3.9.2",
"nbformat==5.10.4",
Expand Down Expand Up @@ -119,7 +118,7 @@ pymapdl_convert_script = "ansys.mapdl.core.cli:old_pymapdl_convert_script_entry_
pymapdl = "ansys.mapdl.core.cli:main"

[tool.pytest.ini_options]
addopts = "-rxXsa -vvv --maxfail=10"
addopts = "-rxXsa -vvv --maxfail=10 --random-order-bucket=class --random-order --durations=10"
junit_family = "legacy"
filterwarnings = [
"ignore::FutureWarning",
Expand Down
6 changes: 3 additions & 3 deletions src/ansys/mapdl/core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
BUILDING_GALLERY: bool = False
RUNNING_TESTS: bool = False

DEPRECATING_MINIMUM_PYTHON_VERSION: bool = True
DEPRECATING_MINIMUM_PYTHON_VERSION: bool = False
MINIMUM_PYTHON_VERSION: Tuple[int, int] = (3, 10)

# Import related globals
Expand Down Expand Up @@ -115,7 +115,7 @@

from ansys.mapdl.core.information import Information
from ansys.mapdl.core.mapdl_grpc import MapdlGrpc as Mapdl
from ansys.mapdl.core.misc import _check_has_ansys
from ansys.mapdl.core.misc import check_has_mapdl
from ansys.mapdl.core.pool import MapdlPool
from ansys.mapdl.core.report import Report

Expand All @@ -127,7 +127,7 @@
if _HAS_ATP:
from ansys.tools.path.path import (
change_default_ansys_path,
find_ansys,
find_mapdl,
get_ansys_path,
get_available_ansys_installations,
save_ansys_path,
Expand Down
2 changes: 2 additions & 0 deletions src/ansys/mapdl/core/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@

# In descending order
SUPPORTED_ANSYS_VERSIONS = {
252: "2025R2",
251: "2025R1",
242: "2024R2",
241: "2024R1",
232: "2023R2",
Expand Down
13 changes: 10 additions & 3 deletions src/ansys/mapdl/core/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@

"""Module for helper functions"""

from functools import namedtuple
import importlib
import os
import sys
Expand All @@ -43,6 +44,10 @@ def is_installed(package_name: str) -> bool:
return False


def get_python_version() -> namedtuple:
return sys.version_info


def run_first_time() -> None:
"""Run this function the first time PyMAPDL is imported"""
from ansys.mapdl.core import (
Expand All @@ -61,19 +66,21 @@ def run_first_time() -> None:
os.makedirs(USER_DATA_PATH)

# Show warning about Python compatibility
py_ver = f"{sys.version_info[0]}.{sys.version_info[1]}"
version_info = get_python_version()

py_ver = f"{version_info[0]}.{version_info[1]}"
py_ver_min = f"{MINIMUM_PYTHON_VERSION[0]}.{MINIMUM_PYTHON_VERSION[1]}"

if (
sys.version_info[1] == MINIMUM_PYTHON_VERSION[1]
version_info[1] == MINIMUM_PYTHON_VERSION[1]
and DEPRECATING_MINIMUM_PYTHON_VERSION
):
warn(
f"Support for Python {py_ver} will be dropped in the next minor "
"release."
)

if sys.version_info[1] <= MINIMUM_PYTHON_VERSION[1]:
if version_info[1] < MINIMUM_PYTHON_VERSION[1]:
warn(
f"Python {py_ver} is not being tested or officially supported. "
"It is recommended you use a newer version of Python. "
Expand Down
15 changes: 11 additions & 4 deletions src/ansys/mapdl/core/launcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
import ansys.platform.instancemanagement as pypim

if _HAS_ATP:
from ansys.tools.path import find_ansys, get_ansys_path
from ansys.tools.path import find_mapdl, get_ansys_path
from ansys.tools.path import version_from_path as _version_from_path

@wraps(_version_from_path)
Expand Down Expand Up @@ -801,7 +801,7 @@ def get_default_ansys():
>>> get_default_ansys()
(/usr/ansys_inc/v211/ansys/bin/ansys211, 21.1)
"""
return find_ansys(supported_versions=SUPPORTED_ANSYS_VERSIONS)
return find_mapdl(supported_versions=SUPPORTED_ANSYS_VERSIONS)


def get_default_ansys_path():
Expand Down Expand Up @@ -914,8 +914,8 @@ def set_MPI_additional_switches(
add_sw_lower_case = add_sw.lower()

# known issues with distributed memory parallel (DMP)
if "smp" not in add_sw_lower_case: # pragma: no cover
if _HAS_ATP and os.name == "nt":
if os.name == "nt" and "smp" not in add_sw_lower_case: # pragma: no cover
if _HAS_ATP:
condition = not force_intel and version and (222 > version >= 210)
else:
warnings.warn(
Expand Down Expand Up @@ -1644,6 +1644,13 @@ def check_mode(mode: ALLOWABLE_MODES, version: Optional[int] = None):
"""
if not mode and not version:
return "grpc"
elif not version:
warnings.warn(
"PyMAPDL couldn't detect MAPDL version, hence it could not "
f"verify that the provided connection mode '{mode}' is compatible "
"with the current MAPDL installation."
)
return mode

if isinstance(mode, str):
mode = mode.lower()
Expand Down
1 change: 1 addition & 0 deletions src/ansys/mapdl/core/mapdl_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -1560,6 +1560,7 @@ def open_apdl_log(
"""
if self._apdl_log is not None:
raise MapdlRuntimeError("APDL command logging already enabled")

self._log.debug("Opening ANSYS log file at %s", filename)

if mode not in ["w", "a", "x"]:
Expand Down
7 changes: 5 additions & 2 deletions src/ansys/mapdl/core/misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ def random_string(stringLength: int = 10, letters: str = string.ascii_lowercase)
return "".join(secrets.choice(letters) for _ in range(stringLength))


def _check_has_ansys() -> bool:
def check_has_mapdl() -> bool:
"""Safely wraps check_valid_ansys
Returns
Expand All @@ -125,7 +125,10 @@ def _check_has_ansys() -> bool:

try:
return check_valid_ansys()
except:
except Exception as err:
LOG.error(
f"An error was obtained when checking for a valid MAPDL installation:\n{str(err)}"
)
return False


Expand Down
2 changes: 1 addition & 1 deletion src/ansys/mapdl/core/plotting/plotting_defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def __init__(self):
self._configured = False

def __call__(self, name):
if not self._configured:
if True: # not self._configured: # Temporal patch pending on #3568
self._set_configuration()
self._configured = True

Expand Down
Loading

0 comments on commit e5fc82b

Please sign in to comment.