Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,6 @@
Custom operators
================

.. note::

This tutorial requires DPF 11.0 or above.

This tutorial shows the basics of creating a custom operator in Python and loading it ont a server for use.

.. note::
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@ For comprehensive examples on writing operator plugins, see :ref:`python_operato

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

+++
Requires DPF 11.0 or above

.. grid-item-card:: Create a DPF plugin with multiple operators
:text-align: center
:class-header: sd-bg-light sd-text-dark
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"""Example of a custom DPF operator in Python."""

from ansys.dpf import core as dpf
from ansys.dpf.core.changelog import Changelog
from ansys.dpf.core.custom_operator import CustomOperatorBase
from ansys.dpf.core.operator_specification import (
CustomSpecification,
Expand Down Expand Up @@ -75,14 +74,25 @@ def specification(self) -> CustomSpecification:
category="my_category", # Optional, defaults to 'other'
license="any_dpf_supported_increments", # Optional, defaults to None
)
# Set the changelog of the operator to track changes
spec.set_changelog(
Changelog()
.patch_bump("Describe a patch bump.")
.major_bump("Describe a major bump.")
.minor_bump("Describe a minor bump.")
.expect_version("1.1.0") # Checks the resulting version is as expected
)

# Operator changelog and versioning is only available after DPF 2025R2
try:
from ansys.dpf.core.changelog import Changelog

# Set the changelog of the operator to track changes
spec.set_changelog(
Changelog()
.patch_bump("Describe a patch bump.")
.major_bump("Describe a major bump.")
.minor_bump("Describe a minor bump.")
.expect_version("1.1.0") # Checks the resulting version is as expected
)
except ModuleNotFoundError as e:
if "ansys.dpf.core.changelog" in e.msg:
pass
else:
raise e

return spec

def run(self):
Expand Down
Loading