galaxyproject / galaxy

Data intensive science for everyone.
https://galaxyproject.org
Other
1.42k stars 1.01k forks source link

PEP484 Galaxy code type annotations #10428

Open innovate-invent opened 4 years ago

innovate-invent commented 4 years ago

With the move to python 3 there is now the possibility of adding type annotations as part of the code documentation. It is often very difficult to understand the code due to the lack of documentation of the type of object being accessed within a function.

There are two options: inline, or a stub file.

https://www.python.org/dev/peps/pep-0484/#stub-files https://www.python.org/dev/peps/pep-0484/ https://docs.python.org/3/library/typing.html

nsoranzo commented 4 years ago

Inline seems a much better option than stub files, but I'm not an expert.

jmchilton commented 4 years ago

I'm open to the idea in general. Every time I research this, I find the lack of integration with sphinx to be the most frustrating part of Python types though 😅 - so I don't find the documentation piece to be compelling. Maybe this has changed though? But we need stubs for integrating galaxy-tool-util with CWL for instance (https://github.com/common-workflow-language/cwltool/tree/main/typeshed/2and3/galaxy) so those would be better packaged with the code for sure.

I've done some work on adding annotations to other Galaxy projects.

innovate-invent commented 4 years ago

@jmchilton https://pypi.org/project/sphinx-autodoc-typehints/ ?