Skip to content

Commit c760f4e

Browse files
committed
Add a changelog to the operator in custom_operator_example.py
1 parent ce841df commit c760f4e

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

doc/source/user_guide/tutorials/custom_operators_and_plugins/custom_operator_example.py

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from ansys.dpf import core as dpf
2+
from ansys.dpf.core.changelog import Changelog
23
from ansys.dpf.core.custom_operator import CustomOperatorBase, record_operator # noqa: F401
34
from ansys.dpf.core.operator_specification import CustomSpecification, SpecificationProperties, \
45
PinSpecification
@@ -12,19 +13,27 @@ def name(self):
1213
@property
1314
def specification(self) -> CustomSpecification:
1415
spec = CustomSpecification()
15-
spec.description = "What the Operator does."
16+
spec.description = "What the Operator does. You can use MarkDown and LaTeX in descriptions."
1617
spec.inputs = {
17-
0: PinSpecification("name_of_pin_0", [dpf.Field, dpf.FieldsContainer],
18-
"Describe pin 0."),
18+
0: PinSpecification(name="name_of_pin_0", type_names=[dpf.Field, dpf.FieldsContainer],
19+
document="Describe input pin 0."),
1920
}
2021
spec.outputs = {
21-
0: PinSpecification("name_of_pin_0", [dpf.Field], "Describe pin 0."),
22+
0: PinSpecification(name="name_of_pin_0", type_names=[dpf.Field], document="Describe output pin 0."),
2223
}
2324
spec.properties = SpecificationProperties(
2425
user_name="user name",
2526
category="category",
2627
license="license",
2728
)
29+
# Set the changelog of the operator to track changes
30+
spec.set_changelog(Changelog()
31+
.expect_version("0.0.0")
32+
.patch_bump("Describe a patch bump.")
33+
.major_bump("Describe a major bump.")
34+
.minor_bump("Describe a minor bump.")
35+
.expect_version("1.1.0")
36+
)
2837
return spec
2938

3039
def run(self):

0 commit comments

Comments
 (0)