dolfinx icon indicating copy to clipboard operation
dolfinx copied to clipboard

Add stubs for MeshTagsMetaClass

Open jorgensd opened this issue 3 years ago • 2 comments

To make it possible to use mypy with external libraries.

Otherwise, one would get errors like:

library/file.py:74: error: "MeshTagsMetaClass" has no attribute "dim"
library/file.py:114: error: "MeshTagsMetaClass" has no attribute "indices"
library/file.py:114: error: "MeshTagsMetaClass" has no attribute "values"

Also add the correct ignores to make sure we catch other API changes.

jorgensd avatar May 31 '22 10:05 jorgensd

Perhaps you need to define an explicit setter for name?

jhale avatar May 31 '22 12:05 jhale

Perhaps you need to define an explicit setter for name?

To do that I had to rename the C++ property name, otherwise I got a recursion error.. However, then the signature of MeshTagsMetaClass and cpp.MeshTags<T> are different, and dolfinx.mesh.meshtags_from_entities returns a different object than

jorgensd avatar May 31 '22 15:05 jorgensd

Close this for now. Issue made: https://github.com/FEniCS/dolfinx/issues/2348

jorgensd avatar Sep 06 '22 07:09 jorgensd