Skip to content

Commit 7087e4f

Browse files
committed
Make custom_operators.rst tutorial compatible with DPF 25R2
1 parent 3852478 commit 7087e4f

File tree

3 files changed

+19
-16
lines changed

3 files changed

+19
-16
lines changed

doc/source/user_guide/tutorials/custom_operators_and_plugins/custom_operators.rst

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@
44
Custom operators
55
================
66

7-
.. note::
8-
9-
This tutorial requires DPF 11.0 or above.
10-
117
This tutorial shows the basics of creating a custom operator in Python and loading it ont a server for use.
128

139
.. note::

doc/source/user_guide/tutorials/custom_operators_and_plugins/index.rst

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,6 @@ For comprehensive examples on writing operator plugins, see :ref:`python_operato
4545

4646
This tutorial shows how to create, load, and use a custom plugin containing a single custom operator.
4747

48-
+++
49-
Requires DPF 11.0 or above
50-
5148
.. grid-item-card:: Create a DPF plugin with multiple operators
5249
:text-align: center
5350
:class-header: sd-bg-light sd-text-dark

src/ansys/dpf/core/examples/python_plugins/custom_operator_example.py

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
"""Example of a custom DPF operator in Python."""
2424

2525
from ansys.dpf import core as dpf
26-
from ansys.dpf.core.changelog import Changelog
2726
from ansys.dpf.core.custom_operator import CustomOperatorBase
2827
from ansys.dpf.core.operator_specification import (
2928
CustomSpecification,
@@ -75,14 +74,25 @@ def specification(self) -> CustomSpecification:
7574
category="my_category", # Optional, defaults to 'other'
7675
license="any_dpf_supported_increments", # Optional, defaults to None
7776
)
78-
# Set the changelog of the operator to track changes
79-
spec.set_changelog(
80-
Changelog()
81-
.patch_bump("Describe a patch bump.")
82-
.major_bump("Describe a major bump.")
83-
.minor_bump("Describe a minor bump.")
84-
.expect_version("1.1.0") # Checks the resulting version is as expected
85-
)
77+
78+
# Operator changelog and versioning is only available after DPF 2025R2
79+
try:
80+
from ansys.dpf.core.changelog import Changelog
81+
82+
# Set the changelog of the operator to track changes
83+
spec.set_changelog(
84+
Changelog()
85+
.patch_bump("Describe a patch bump.")
86+
.major_bump("Describe a major bump.")
87+
.minor_bump("Describe a minor bump.")
88+
.expect_version("1.1.0") # Checks the resulting version is as expected
89+
)
90+
except ModuleNotFoundError as e:
91+
if "ansys.dpf.core.changelog" in e.msg:
92+
pass
93+
else:
94+
raise e
95+
8696
return spec
8797

8898
def run(self):

0 commit comments

Comments
 (0)