Skip to content

Properly type operator inputs/outputs #2701

@PProfizi

Description

@PProfizi

Before submitting the issue

  • I have checked for Compatibility issues
  • I have searched among the existing issues
  • I am using a Python virtual environment

Description of the bug

Typing of operator pins is not working properly.

Taking stress as an example, no typing is generated for the constructor, and
no type deduction or propagation is done when creating the Input or Output instance for each input/output of the operator (see for example here).
Everything is based on the typing of the base Input.connect or Output.get_data.

Operator code generation is handled here.

Steps To Reproduce

Here is a simple example where we connect a DataSources to the data_sources input pin of an operator.
My IDE marks ds as of unexpected type in the call to connect in s_op.inputs.data_sources.connect(ds).
In the same manner, one would expect s_out type to be understood as FieldsContainer or dpf.types.fields_container but it is instead marked as Any.

import ansys.dpf.core as dpf
from ansys.dpf.core import examples


ds = dpf.DataSources(examples.find_static_rst())

s_op = dpf.operators.result.stress()
s_op.inputs.data_sources.connect(ds)  # Should accept a DataSources type
s_out: dpf.FieldsContainer = s_op.outputs.fields_container()  # Should return a FieldsContainer type

Which Operating System causes the issue?

Windows

Which DPF/Ansys version are you using?

Ansys 2026 R1

Which Python version causes the issue?

3.11

Installed packages

NA

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions