Skip to content

Commit

Permalink
Remove restraint of vtk<9.1.0 (#132)
Browse files Browse the repository at this point in the history
* Remove restrain on vtk<9.1.0

* Use the new DpfPlotter instead of the old.

* Revert "Use the new DpfPlotter instead of the old."

This reverts commit 8abdec8.

* Remove problematic line to test the rest

* Output info on renderer

* Force renderer info

* Comment out other plotting tests

* revert changes

* conditional VTK version for testing

* fix python_requires

* conditionally disable lighting

* Fix naming error

* Remove matplotlib requirements as well since a dependency of PyVista

* Remove doctest +SKIP

* Add a global conftest for doctest

* Revert "Add a global conftest for doctest"

This reverts commit 078b647.

* Revert "Remove doctest +SKIP"

This reverts commit 0534ef7.

Co-authored-by: Alex Kaszynski <akascap@gmail.com>
  • Loading branch information
PProfizi and akaszynski authored Aug 19, 2022
1 parent 93d6fa9 commit bbd5125
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9"]
python-version: ["3.8", "3.9", "3.10"]
os: ["windows-latest", "ubuntu-latest"]

steps:
Expand Down
5 changes: 2 additions & 3 deletions ansys/dpf/post/result_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
user will be able to use to compute through the DPF Post API.
This is a fields container wrapper."""

from textwrap import wrap

from ansys.dpf.core import FieldsContainer, Operator
Expand Down Expand Up @@ -296,7 +295,7 @@ def plot_contour(
>>> solution = post.load_solution(examples.download_all_kinds_of_complexity())
>>> stress = solution.stress(location=post.locations.nodal)
>>> sx = stress.xx
>>> pl = sx.plot_contour("time", [1], off_screen=True)
>>> pl = sx.plot_contour("time", [1], off_screen=True) # doctest: +SKIP
The labels can be obtained using:
Expand Down Expand Up @@ -348,7 +347,7 @@ def plot_contour(
else:
# sorts and creates a new fields_container with only the desired labels
fc = self._sort_fields_container_with_labels(option_id, display_option)
# Call Plotter.plot_contour (to change for use of DpfPlotter

pl.plot_contour(fc, **kwargs)

def _plot_chart(self):
Expand Down
1 change: 0 additions & 1 deletion requirements/requirements_docs.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
pypandoc==1.8.1
matplotlib==3.5.3
imageio==2.21.1
imageio-ffmpeg==0.4.7
Sphinx==5.1.1
Expand Down
4 changes: 2 additions & 2 deletions requirements/requirements_test.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pytest==7.1.2
coverage==6.4.4
pytest-cov==3.0.0
pytest-rerunfailures==10.2
coverage==6.4.4
pytest==7.1.2
5 changes: 3 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,11 @@
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
],
python_requires=">=3.7.*,!=3.10.*",
python_requires=">=3.7.*,<4.0",
extras_require={
"plotting": ["vtk<9.1.0", "pyvista>=0.24.0", "matplotlib"],
"plotting": ["pyvista>=0.24.0"],
},
install_requires=install_requires,
license='MIT',
Expand Down
23 changes: 23 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
Launch or connect to a persistent local DPF service to be shared in
pytest as a sesson fixture
"""
import re
import os

import pytest
Expand All @@ -16,6 +17,28 @@
pv.OFF_SCREEN = True
mpl.use("Agg")


def get_lighting():
"""Get lighting configuration.
Disable lighting when using OSMesa on Windows. See:
https://github.com/pyvista/pyvista/issues/3185
"""
pl = pv.Plotter(notebook=False, off_screen=True)
pl.add_mesh(pv.Sphere())
pl.show(auto_close=False)
gpu_info = pl.ren_win.ReportCapabilities();
pl.close()

regex = re.compile("OpenGL version string:(.+)\n")
version = regex.findall(gpu_info)[0]
return not(os.name == 'nt' and 'Mesa' in version)


pv.global_theme.lighting = get_lighting()


# currently running dpf on docker. Used for testing on CI
running_docker = os.environ.get("DPF_DOCKER", False)

Expand Down

0 comments on commit bbd5125

Please sign in to comment.