You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Jsonschema computation fails at mypy level (get_type_hints) when usin str typing for a function (init for example) that is defined inside cython compiled module.
This is due to unicode beeing used as typing (cython is running with Python2 ?) and failing in typing.get_type_hints accordingly to this discussion :
This issue is a bit harsh but it does basically say that unicode type (py2) and str (py3) are incompatible. Instead typing.Text is a type alias that checks for Union[str, unicode]
If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem Avoid reference to other packages
import volmdlr
from typing import get_type_hints
print(volmdlr.Point3D.__init__.__annotations__)
get_type_hints(volmdlr.Point3D.__init__)
Traceback :
File "/home/jezequel/Documents/Dessia/git/dessia-platform-backend/dessia_platform_backend/routes/classes.py", line 54, in get_jsonschema
jsonschema = class_.jsonschema()
File "/home/jezequel/Documents/Dessia/git/dessia-common/dessia_common/core.py", line 340, in jsonschema
annotations = get_type_hints(init)
File "/usr/lib/python3.9/typing.py", line 1442, in get_type_hints
value = _eval_type(value, globalns, localns)
File "/usr/lib/python3.9/typing.py", line 277, in _eval_type
return t._evaluate(globalns, localns, recursive_guard)
File "/usr/lib/python3.9/typing.py", line 533, in _evaluate
eval(self.__forward_code__, globalns, localns),
File "<string>", line 1, in <module>
What is the expected behavior?
What is the motivation / use case for changing the behavior?
Good jsonchema computation of volmdlr.core_compiled.pyx classes. At the moment it breaks on platform side :
I'm submitting a ...
What is the current behavior?
Jsonschema computation fails at mypy level (get_type_hints) when usin str typing for a function (init for example) that is defined inside cython compiled module.
This is due to unicode beeing used as typing (cython is running with Python2 ?) and failing in typing.get_type_hints accordingly to this discussion :
python/typing#208
This issue is a bit harsh but it does basically say that unicode type (py2) and str (py3) are incompatible. Instead typing.Text is a type alias that checks for Union[str, unicode]
Traceback :
What is the expected behavior?
What is the motivation / use case for changing the behavior?
Good jsonchema computation of volmdlr.core_compiled.pyx classes. At the moment it breaks on platform side :
https://gitea.dessia.tech/DessiA/frontend/issues/394
Replace every
str
typing bytyping.Text
as for Point3D :This fixes the issue. I opened a branch with the example for Point3D if we want to implement this fix
Please tell us about your environment:
The text was updated successfully, but these errors were encountered: