Skip to content

Modifiers

Maturity labels

  • Now: Stable and supported in current releases.
  • Preview: Usable today, but behavior and APIs may evolve.
  • Planned: Not yet implemented.

Note

Status: Now

Modifiers let you adapt task/flow templates without rewriting core function bodies.

param_key_map example

>>> import omnipy as om
>>> @om.TaskTemplate()
... def plus_other(number: int, other: int) -> int:
...     return number + other
>>> plus_x = plus_other.refine(name='plus_x', param_key_map={'other': 'x'})
>>> plus_x.run(number=1, x=2)

result_key example

>>> import omnipy as om
>>> @om.TaskTemplate()
... def plus_other(number: int, other: int) -> int:
...     return number + other
>>> plus_one_dict = plus_other.refine(name='plus_one', fixed_params={'other': 1}).refine(result_key='number')
>>> plus_one_dict.run(number=10)