DearPyGui icon indicating copy to clipboard operation
DearPyGui copied to clipboard

Typing support

Open Jackenmen opened this issue 4 years ago • 2 comments
trafficstars

Is your feature request related to a problem? Please describe. I think it would be great if DearPyGui supported typing.

Describe the solution you'd like core.pyi stub file is already generated automatically by mvPythonParser, so adding py.typed as part of the source is enough for the type checkers to treat the library as typed.

While looking at the current core.pyi stub file, I noticed two issues:

  • currently, the constants are not typed in the stub file
    • this means that using names like mvKey_Down would still fail once the py.typed file is added until the constants get included in the stub file
  • arguments that accept sequences are typed so that they specifically require a list not just any sequence (for example a tuple), even though they do seem to support that just fine

Describe alternatives you've considered None.

Additional context N/A

Jackenmen avatar Jun 06 '21 18:06 Jackenmen

Will we look into this. Sounds like a good addition.

hoffstadt avatar Jun 17 '21 03:06 hoffstadt

It seems that simply adding py.typed to the library root directory allows using mypy (and probably other static type checkers). @hoffstadt any chance this can be done or is there anything slightly more complicated to be done? Kind of related, I'm also wondering why the dearpygui/_dearpygui.pyi stub file has a circular dependency. This can make tools like the Jedi autocomplete to fail with a RecursionError.

atallahade avatar Aug 19 '23 18:08 atallahade