Skip to content

Commit a679d6d

Browse files
authored
Merge branch 'build/pyvista-0.45' into fix/docstyle
2 parents f25eee1 + 30cce6d commit a679d6d

File tree

9 files changed

+31
-33
lines changed

9 files changed

+31
-33
lines changed

.github/workflows/ci_cd.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ on:
99
- main
1010

1111
env:
12-
MAIN_PYTHON_VERSION: '3.12'
12+
MAIN_PYTHON_VERSION: '3.13'
1313
PACKAGE_NAME: 'ansys-geometry-core'
1414
DOCUMENTATION_CNAME: 'geometry.docs.pyansys.com'
1515
ANSRV_GEO_IMAGE: 'ghcr.io/ansys/geometry'
@@ -20,6 +20,7 @@ env:
2020
RESET_IMAGE_CACHE: 5
2121
IS_WORKFLOW_RUNNING: True
2222
ARTIFACTORY_VERSION: v252
23+
VTK_DEFAULT_OPENGL_WINDOW: "vtkOSOpenGLRenderWindow"
2324

2425
concurrency:
2526
group: ${{ github.workflow }}-${{ github.ref }}
@@ -401,6 +402,12 @@ jobs:
401402
echo "SKIP_UNSTABLE=$Result" >> $GITHUB_ENV
402403
echo "SKIP_UNSTABLE will be: $Result"
403404
405+
- name: Set up headless display
406+
if: env.SKIP_UNSTABLE == 'false'
407+
uses: pyvista/setup-headless-display-action@52bda06d59c0fc422fc2512c9c670bf6b66616f8 # v3.2
408+
with:
409+
pyvista: false
410+
404411
- name: Login in Github Container registry
405412
if: env.SKIP_UNSTABLE == 'false'
406413
uses: docker/login-action@74a5d142397b4f367a81961eba4e8cd7edddf772 # v3.4.0
@@ -805,7 +812,6 @@ jobs:
805812
python-version: ${{ env.MAIN_PYTHON_VERSION }}
806813
pytest-extra-args: "--use-existing-service=yes"
807814
checkout: false
808-
requires-xvfb: true
809815
randomize: true
810816

811817
- name: "Compressing Linux Dockerfile"

.github/workflows/nightly_docker_test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ on:
2121
- v*
2222

2323
env:
24-
MAIN_PYTHON_VERSION: '3.12'
24+
MAIN_PYTHON_VERSION: '3.13'
2525
ANSRV_GEO_IMAGE_WINDOWS_CORE_TAG: ghcr.io/ansys/geometry:core-windows-latest-unstable
2626
ANSRV_GEO_IMAGE_LINUX_CORE_TAG: ghcr.io/ansys/geometry:core-linux-latest-unstable
2727
ANSRV_GEO_PORT: 710
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
bump PyVista and VTK versions (support Python 3.13)

pyproject.toml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ all = [
5858
tests = [
5959
"ansys-platform-instancemanagement==1.1.2",
6060
"ansys-tools-path==0.7.1",
61-
"ansys-tools-visualization-interface==0.8.3",
61+
"ansys-tools-visualization-interface==0.9.1",
6262
"beartype==0.20.2",
6363
"docker==7.1.0",
6464
"geomdl==5.3.1",
@@ -73,12 +73,12 @@ tests = [
7373
"pytest-cov==6.1.1",
7474
"pytest-pyvista==0.1.9",
7575
"pytest-xvfb==3.1.1",
76-
"pyvista[jupyter]==0.44.2",
76+
"pyvista[jupyter]==0.45.0",
7777
"requests==2.32.3",
7878
"scipy==1.15.2",
7979
"semver==3.0.4",
8080
"six==1.17.0",
81-
"vtk==9.3.1",
81+
"vtk==9.4.2",
8282
]
8383
tests-minimal = [
8484
"pytest==8.3.5",
@@ -89,7 +89,7 @@ tests-minimal = [
8989
doc = [
9090
"ansys-sphinx-theme[autoapi]==1.4.2",
9191
"ansys-tools-path==0.7.1",
92-
"ansys-tools-visualization-interface==0.8.3",
92+
"ansys-tools-visualization-interface==0.9.1",
9393
"beartype==0.20.2",
9494
"docker==7.1.0",
9595
"geomdl==5.3.1",
@@ -110,7 +110,7 @@ doc = [
110110
"Pint==0.24.4",
111111
"protobuf==5.29.3",
112112
"pygltflib==1.16.3",
113-
"pyvista[jupyter]==0.44.2",
113+
"pyvista[jupyter]==0.45.0",
114114
"quarto-cli==1.6.42",
115115
"requests==2.32.3",
116116
"scipy==1.15.2",
@@ -121,7 +121,7 @@ doc = [
121121
"sphinx-copybutton==0.5.2",
122122
"sphinx-jinja==2.0.2",
123123
"trame-vtk==2.8.15",
124-
"vtk==9.3.1",
124+
"vtk==9.4.2",
125125
]
126126

127127
[project.urls]

src/ansys/geometry/core/sketch/ellipse.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ def visualization_polydata(self) -> "pv.PolyData":
203203
return pv.Ellipse(
204204
semi_major_axis=self.major_radius.m_as(DEFAULT_UNITS.LENGTH),
205205
semi_minor_axis=self.minor_radius.m_as(DEFAULT_UNITS.LENGTH),
206-
).transform(transformation_matrix)
206+
).transform(transformation_matrix, inplace=True)
207207

208208
def plane_change(self, plane: Plane) -> None:
209209
"""Redefine the plane containing ``SketchEllipse`` objects.

src/ansys/geometry/core/sketch/polygon.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,4 +172,4 @@ def visualization_polydata(self) -> "pv.PolyData":
172172
return pv.Polygon(
173173
radius=self.inner_radius.m_as(DEFAULT_UNITS.LENGTH),
174174
n_sides=self.n_sides,
175-
).transform(transformation_matrix)
175+
).transform(transformation_matrix, inplace=True)

src/ansys/geometry/core/sketch/sketch.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -964,7 +964,9 @@ def plot_selection(
964964
sketches_polydata_selection = []
965965
sketches_polydata_selection.extend(
966966
[
967-
sketch_item.visualization_polydata.transform(self._plane.transformation_matrix)
967+
sketch_item.visualization_polydata.transform(
968+
self._plane.transformation_matrix, inplace=True
969+
)
968970
for sketch_item in self._current_sketch_context
969971
]
970972
)
@@ -998,7 +1000,7 @@ def sketch_polydata_faces(self) -> list["PolyData"]:
9981000
List of the polydata configuration for faces in the sketch.
9991001
"""
10001002
sketches_polydata_faces = [
1001-
face.visualization_polydata.transform(self._plane.transformation_matrix)
1003+
face.visualization_polydata.transform(self._plane.transformation_matrix, inplace=True)
10021004
for face in self.faces
10031005
]
10041006
return sketches_polydata_faces
@@ -1012,7 +1014,7 @@ def sketch_polydata_edges(self) -> list["PolyData"]:
10121014
List of the polydata configuration for edges in the sketch.
10131015
"""
10141016
sketches_polydata_edges = [
1015-
edge.visualization_polydata.transform(self._plane.transformation_matrix)
1017+
edge.visualization_polydata.transform(self._plane.transformation_matrix, inplace=True)
10161018
for edge in self.edges
10171019
]
10181020
return sketches_polydata_edges

tests/integration/test_plotter.py

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -578,25 +578,22 @@ def test_visualization_polydata():
578578
rel=1e-6,
579579
abs=1e-8,
580580
)
581-
assert polygon.visualization_polydata.n_faces == 2
582581
assert polygon.visualization_polydata.n_cells == 2
583582
assert polygon.visualization_polydata.n_points == 5
584583
assert polygon.visualization_polydata.n_open_edges == 5
585584

586585
# Test for arc visualization polydata
587586
arc = Arc(Point2D([10, 10]), Point2D([10, -10]), Point2D([10, 0]))
588-
assert arc.visualization_polydata.center == ([5.0, 0.0, 0.0])
587+
assert arc.visualization_polydata.center == pytest.approx([5.0, 0.0, 0.0])
589588
assert arc.visualization_polydata.bounds == pytest.approx([0.0, 10.0, -10.0, 10.0, 0.0, 0.0])
590-
assert arc.visualization_polydata.n_faces == 2
591589
assert arc.visualization_polydata.n_cells == 2
592590
assert arc.visualization_polydata.n_points == 202
593591
assert arc.visualization_polydata.n_open_edges == 0
594592

595593
# Test for segment visualization polydata
596594
segment = SketchSegment(Point2D([3, 2]), Point2D([2, 0]))
597-
assert segment.visualization_polydata.center == ([2.5, 1.0, 0.0])
595+
assert segment.visualization_polydata.center == pytest.approx([2.5, 1.0, 0.0])
598596
assert segment.visualization_polydata.bounds == pytest.approx([2.0, 3.0, 0.0, 2.0, 0.0, 0.0])
599-
assert segment.visualization_polydata.n_faces == 1
600597
assert segment.visualization_polydata.n_cells == 1
601598
assert segment.visualization_polydata.n_points == 2
602599
assert segment.visualization_polydata.n_open_edges == 0
@@ -609,20 +606,18 @@ def test_visualization_polydata():
609606
)
610607
assert slot.visualization_polydata
611608
assert slot.visualization_polydata.bounds == pytest.approx([0.0, 4.0, 2.0, 4.0, 0.0, 0.0])
612-
assert slot.visualization_polydata.center == ([2.0, 3.0, 0.0])
609+
assert slot.visualization_polydata.center == pytest.approx([2.0, 3.0, 0.0])
613610
# Two arcs and segments creates the slot, thus it should have 6 faces
614-
assert slot.visualization_polydata.n_faces == 6
615611
assert slot.visualization_polydata.n_cells == 6
616612
assert slot.visualization_polydata.n_points == 402
617613
assert slot.visualization_polydata.n_open_edges == 0
618614

619615
# Test for triangle visualization polydata
620616
triangle = Triangle(Point2D([10, 10]), Point2D([2, 1]), Point2D([10, -10]))
621-
assert triangle.visualization_polydata.center == ([6.0, 0.0, 0.0])
617+
assert triangle.visualization_polydata.center == pytest.approx([6.0, 0.0, 0.0])
622618
assert triangle.visualization_polydata.bounds == pytest.approx(
623619
[2.0, 10.0, -10.0, 10.0, 0.0, 0.0]
624620
)
625-
assert triangle.visualization_polydata.n_faces == 1
626621
assert triangle.visualization_polydata.n_cells == 1
627622
assert triangle.visualization_polydata.n_points == 3
628623
assert triangle.visualization_polydata.n_open_edges == 3
@@ -639,7 +634,6 @@ def test_visualization_polydata():
639634
rel=1e-6,
640635
abs=1e-8,
641636
)
642-
assert trapezoid.visualization_polydata.n_faces == 1
643637
assert trapezoid.visualization_polydata.n_cells == 1
644638
assert trapezoid.visualization_polydata.n_points == 4
645639
assert trapezoid.visualization_polydata.n_open_edges == 4
@@ -648,18 +642,16 @@ def test_visualization_polydata():
648642
circle = SketchCircle(
649643
Point2D([10, -10], DEFAULT_UNITS.LENGTH), Quantity(1, DEFAULT_UNITS.LENGTH)
650644
)
651-
assert circle.visualization_polydata.center == pytest.approx(([10.0, -10.0, 0.0]))
645+
assert circle.visualization_polydata.center == pytest.approx([10.0, -10.0, 0.0])
652646
assert circle.visualization_polydata.bounds == pytest.approx([9.0, 11.0, -11.0, -9.0, 0.0, 0.0])
653-
assert circle.visualization_polydata.n_faces == 1
654647
assert circle.visualization_polydata.n_cells == 1
655648
assert circle.visualization_polydata.n_points == 100
656649
assert circle.visualization_polydata.n_open_edges == 100
657650

658651
# Test for ellipse visualization polydata
659652
ellipse = SketchEllipse(Point2D([0, 0], UNITS.m), Quantity(1, UNITS.m), Quantity(1, UNITS.m))
660-
assert ellipse.visualization_polydata.center == pytest.approx(([0.0, 0.0, 0.0]))
653+
assert ellipse.visualization_polydata.center == pytest.approx([0.0, 0.0, 0.0])
661654
assert ellipse.visualization_polydata.bounds == pytest.approx([-1.0, 1.0, -1.0, 1.0, 0.0, 0.0])
662-
assert ellipse.visualization_polydata.n_faces == 1
663655
assert ellipse.visualization_polydata.n_cells == 1
664656
assert ellipse.visualization_polydata.n_points == 100
665657
assert ellipse.visualization_polydata.n_open_edges == 100
@@ -670,9 +662,8 @@ def test_visualization_polydata():
670662
Distance(4, unit=UNITS.meter),
671663
Distance(2, unit=UNITS.meter),
672664
)
673-
assert box.visualization_polydata.center == ([3.0, 1.0, 0.0])
665+
assert box.visualization_polydata.center == pytest.approx([3.0, 1.0, 0.0])
674666
assert box.visualization_polydata.bounds == pytest.approx([1.0, 5.0, 0.0, 2.0, 0.0, 0.0])
675-
assert box.visualization_polydata.n_faces == 1
676667
assert box.visualization_polydata.n_cells == 1
677668
assert box.visualization_polydata.n_points == 4
678669
assert box.visualization_polydata.n_open_edges == 4

tests/integration/test_tessellation.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ def test_body_tessellate(modeler: Modeler):
4949
# Number of blocks will be the number of faces
5050
assert blocks_1.n_blocks == 6
5151
# Test the center of the bounding box
52-
assert (blocks_1.center == ([2, 0, 0.5])).all()
52+
assert blocks_1.center == pytest.approx([2, 0, 0.5])
5353
# Test the values of blocks which are the length 6 tuple of floats
5454
# containing min/max along each axis
5555
assert blocks_1.bounds == pytest.approx([0.0, 4.0, -2.0, 2.0, 0.0, 1.0])
@@ -145,7 +145,6 @@ def test_component_tessellate(modeler: Modeler):
145145
assert "PolyData" in str(mesh)
146146
if not BackendType.is_core_service(modeler.client.backend_type):
147147
assert mesh.n_cells == 3280
148-
assert mesh.n_faces == 3280
149148
assert mesh.n_arrays == 0
150149
assert mesh.n_points == 3300
151150
assert mesh.bounds == pytest.approx(
@@ -155,7 +154,6 @@ def test_component_tessellate(modeler: Modeler):
155154
)
156155
else:
157156
assert mesh.n_cells == 3280
158-
assert mesh.n_faces == 3280
159157
assert mesh.n_arrays == 0
160158
assert mesh.n_points == 3300
161159
assert mesh.bounds == pytest.approx(

0 commit comments

Comments
 (0)