Skip to content

Commit

Permalink
Updating pyvista to 0.41 (#2194)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
  • Loading branch information
3 people committed Aug 8, 2023
1 parent 2221a7b commit 52fb6a1
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 15 deletions.
6 changes: 5 additions & 1 deletion doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -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/")
Expand Down
18 changes: 9 additions & 9 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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",
Expand All @@ -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",
Expand Down
13 changes: 11 additions & 2 deletions src/ansys/mapdl/core/theme.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
17 changes: 15 additions & 2 deletions tests/test_dpf.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
"""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
from conftest import skip_if_no_has_dpf

try:
from ansys.dpf import core as dpf
from ansys.dpf.core.server_types import DPF_DEFAULT_PORT
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():
Expand Down
2 changes: 1 addition & 1 deletion tests/test_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 52fb6a1

Please sign in to comment.