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 authored Aug 3, 2023
1 parent f7d4ef9 commit 5b2d120
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 12 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
10 changes: 5 additions & 5 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ dependencies = [
"pyansys-tools-versioning>=0.3.3",
"ansys-tools-path>=0.3.1",
"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,7 +56,7 @@ classifiers = [

[project.optional-dependencies]
tests = [
"ansys-dpf-core==0.8.1",
"ansys-dpf-core==0.9.0",
"autopep8==2.0.2",
"matplotlib==3.7.2",
"scipy==1.10.1; python_version < '3.9'", # to support python 3.8
Expand All @@ -65,14 +65,14 @@ tests = [
"pyiges[full]==0.3.1",
"pytest==7.4.0",
"pytest-cov==4.1.0",
"pyvista==0.40.1",
"pyvista==0.41.1",
"pyansys-tools-report==0.6.0",
"vtk==9.2.6",
"pytest-rerunfailures==12.0",
]
doc = [
"sphinx==7.1.1",
"ansys-dpf-core==0.8.1",
"ansys-dpf-core==0.9.0",
"ansys-mapdl-reader==0.52.19",
"ansys-sphinx-theme==0.10.0",
"grpcio==1.51.1",
Expand All @@ -88,7 +88,7 @@ doc = [
"pypandoc==1.11",
"pytest-sphinx==0.5.0",
"pythreejs==2.4.2",
"pyvista[trame]==0.40.1",
"pyvista[trame]==0.41.1",
"sphinx-autobuild==2021.3.14",
"sphinx-autodoc-typehints==1.24.0",
"sphinx-copybutton==0.5.2",
Expand Down
12 changes: 9 additions & 3 deletions src/ansys/mapdl/core/theme.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,16 @@
if _HAS_PYVISTA:
from pyvista.plotting.colors import get_cycler

try: # new in pyvista 0.40
from pyvista.themes import Theme
try:
from pyvista.plotting.themes import Theme

except ImportError:
from pyvista.themes import DefaultTheme as Theme
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

Expand Down
14 changes: 12 additions & 2 deletions tests/test_dpf.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
"""Test the DPF implementation"""
import os

from ansys.dpf import core as dpf
from ansys.dpf.core.server_types import DPF_DEFAULT_PORT
import pytest

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


Expand Down
2 changes: 1 addition & 1 deletion tests/test_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,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 5b2d120

Please sign in to comment.