From 9d0af6699f79104b3a6ec3511645c93348d33c25 Mon Sep 17 00:00:00 2001 From: German <28149841+germa89@users.noreply.github.com> Date: Wed, 9 Aug 2023 11:54:37 +0200 Subject: [PATCH] Update release branch for 0.65.2 (#2234) * Updating pyvista to 0.41 (#2194) * Updating pyvista to 0.41 * Updating reader * Removing rcParams * Using pyvista 0.41.1 * Avoiding importing dpf. * adding missing import * Update tests/test_dpf.py * maint: updating `ansys-dpf-core` version * test: fixing `test_heal` * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * test: revert last commit --------- Co-authored-by: Camille <78221213+clatapie@users.noreply.github.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> * Including import into try clause. --------- Co-authored-by: Camille <78221213+clatapie@users.noreply.github.com> Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> --- doc/source/conf.py | 6 +++++- pyproject.toml | 18 +++++++++--------- src/ansys/mapdl/core/theme.py | 13 +++++++++++-- tests/test_dpf.py | 18 ++++++++++++++++-- tests/test_pool.py | 2 +- 5 files changed, 42 insertions(+), 15 deletions(-) diff --git a/doc/source/conf.py b/doc/source/conf.py index e63af53c94..5a742d3193 100755 --- a/doc/source/conf.py +++ b/doc/source/conf.py @@ -20,7 +20,11 @@ pyvista.OFF_SCREEN = True # must be less than or equal to the XVFB window size -pyvista.rcParams["window_size"] = np.array([1024, 768]) +try: + pyvista.global_theme.window_size = np.array([1024, 768]) +except AttributeError: + # for compatibility with pyvista < 0.40 + pyvista.rcParams["window_size"] = np.array([1024, 768]) # Save figures in specified directory pyvista.FIGURE_PATH = os.path.join(os.path.abspath("./images/"), "auto-generated/") diff --git a/pyproject.toml b/pyproject.toml index 1fc845e960..e30afdb429 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,7 +34,7 @@ dependencies = [ "pyansys-tools-versioning>=0.3.3", "ansys-tools-path>=0.2.4", "pyiges[full]>=0.3.1", # Since v0.3.0, the 'full' flag is needed in order to install 'geomdl' - "pyvista>=0.33.0,<0.41", + "pyvista>=0.33.0", "scipy>=1.3.0", # for sparse (consider optional?) "tqdm>=4.45.0", "vtk>=9.0.0", @@ -56,23 +56,23 @@ classifiers = [ [project.optional-dependencies] tests = [ - "ansys-dpf-core==0.8.1", + "ansys-dpf-core==0.9.0", "autopep8==2.0.2", "matplotlib==3.7.1", "scipy==1.10.1", "pandas==2.0.1", "pytest==7.3.1", "pytest-cov==4.1.0", - "pyvista==0.39.1", - "pyansys-tools-report==0.5.0", + "pyvista==0.41.1", + "pyansys-tools-report==0.6.0", "vtk==9.2.6", "pytest-rerunfailures==11.1.2", ] doc = [ - "sphinx==6.2.1", - "ansys-dpf-core==0.8.1", - "ansys-mapdl-reader==0.52.13", - "ansys-sphinx-theme==0.9.9", + "sphinx==7.1.1", + "ansys-dpf-core==0.9.0", + "ansys-mapdl-reader==0.52.19", + "ansys-sphinx-theme==0.10.0", "grpcio==1.51.1", "imageio-ffmpeg==0.4.8", "imageio==2.30.0", @@ -85,7 +85,7 @@ doc = [ "pypandoc==1.11", "pytest-sphinx==0.5.0", "pythreejs==2.4.2", - "pyvista==0.39.1", + "pyvista[trame]==0.41.1", "sphinx-autobuild==2021.3.14", "sphinx-autodoc-typehints==1.23.0", "sphinx-copybutton==0.5.2", diff --git a/src/ansys/mapdl/core/theme.py b/src/ansys/mapdl/core/theme.py index aeb7f0402a..7eb406cebe 100644 --- a/src/ansys/mapdl/core/theme.py +++ b/src/ansys/mapdl/core/theme.py @@ -2,9 +2,18 @@ from ansys.mapdl.core import _HAS_PYVISTA if _HAS_PYVISTA: - from pyvista import themes + try: + from pyvista.plotting.themes import Theme - base_class = themes.DefaultTheme + except ImportError: + from pyvista import __version__ as pyvista_version + + if "0.40" in pyvista_version: + from pyvista.themes import Theme + else: # older versions + from pyvista.themes import DefaultTheme as Theme + + base_class = Theme else: # pragma: no cover diff --git a/tests/test_dpf.py b/tests/test_dpf.py index 574c0d99aa..ef2428cf33 100644 --- a/tests/test_dpf.py +++ b/tests/test_dpf.py @@ -1,9 +1,23 @@ """Test the DPF implementation""" import os -from ansys.dpf import core as dpf +import pytest -DPF_PORT = os.environ.get("DPF_PORT", 21002) # Set in ci.yaml +try: + from ansys.dpf import core as dpf + from ansys.dpf.core.server_types import DPF_DEFAULT_PORT + + from conftest import skip_if_no_has_dpf + +except ImportError: + skip_if_no_has_dpf = pytest.mark.skipif( + True, + reason="""DPF couldn't be imported.""", + ) + DPF_DEFAULT_PORT = None + + +DPF_PORT = os.environ.get("DPF_PORT", DPF_DEFAULT_PORT) # Set in ci.yaml def test_dpf_connection(): diff --git a/tests/test_pool.py b/tests/test_pool.py index 5218c794d2..d35c3276f6 100644 --- a/tests/test_pool.py +++ b/tests/test_pool.py @@ -70,7 +70,7 @@ def pool(): @skip_requires_194 def test_invalid_exec(): with pytest.raises(VersionError): - mapdl_pool = LocalMapdlPool(4, exec_file="/usr/ansys_inc/v194/ansys/bin/mapdl") + LocalMapdlPool(4, exec_file="/usr/ansys_inc/v194/ansys/bin/mapdl") @skip_if_not_local