galaxyproject / galaxy

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

Refactor Tool Parameter Parsing #18537

Open jmchilton opened 1 month ago

jmchilton commented 1 month ago

The spookiest file in Galaxy lib/galaxy/tools/parameters/basic.py has a mix of parsing XML elements and parsing the abstractions in galaxy.tool_util.parser (e.g. ToolSource and its child components). Ideally these would be pre-parsed and basic.py would just consume the parameter models. Various pieces of Galaxy still call on basic.py stuff directly and parse XML fragments - so this might not be as straight forward as one would hope.

In order to consume both ToolSource stuff and XML - I've implemented this ensure_input_source abstraction - imported here https://github.com/galaxyproject/galaxy/blob/dev/lib/galaxy/tools/parameters/basic.py#L44C57-L44C76. I guess that could be extended to promote both input sources and XML into the parameter meta model and then the components could just consume the meta model. It wouldn't require cleaning up all the other code that uses basic.py but maybe those things should be cleaned up.

xref https://github.com/galaxyproject/galaxy/pull/18524#discussion_r1674353563

nsoranzo commented 1 month ago

My £0.02: given that (all?) third-party tools and libraries use tool_util and not tools, cleaning up our own code may be a better medium-term approach in this case. It's probably something we can do incrementally?