hexylena / argparse2tool

transparently build CWL and Galaxy XML tool definitions for any script that uses argparse
Apache License 2.0
26 stars 10 forks source link

subparser parents #60

Open bernt-matthias opened 6 years ago

bernt-matthias commented 6 years ago

one more request on this way .. the tool I want to wrap uses the parent feature of subparser, i.e. it defines subparsers that are reused in many other subbarsers.

check for the "parent" argument (in combination with add_help=False) here :

checkm.py.txt

I guess macros would be a great way to do this.

for now I will do this manually

hexylena commented 6 years ago

Wow you were not kidding about a lot of argparse options. Oh my word.

Thanks for the example. I see that it's under GPL3, would you mind if I included it into the examples/ folder in this repository as an example of the complexity it can support?

bernt-matthias commented 6 years ago

Sure, I took it from bioconda checkm-genome=1.0.11 (most recent version in https://github.com/Ecogenomics/CheckM/blob/master/bin/checkm) and adapted it to include only the argparse stuff (and replaced some imports by the actual code).

hexylena commented 6 years ago

Perfect, thanks!

hexylena commented 6 years ago

since I just stumbled across this again, still no time for development work, but

I guess macros would be a great way to do this.

I've often considered how nice it would be if I could find a good AST parser (or three), and then identify large common subsets (using the same code structure/same XML structure even if different parameter names) across N xml files and automatically rewrite it into a macro. But that's almost a masters-time/level project and hard to fit that in.

edit; @bgruening just in case you have any masters students who need another project? But I guess this isn't a very 'fun' or attractive project.

bernt-matthias commented 6 years ago

I now "solved" this in a shell script generating the macros. Made small progress here: https://github.com/bernt-matthias/mb-galaxy-tools/tree/master/tools/checkm

bgruening commented 6 years ago

I've often considered how nice it would be if I could find a good AST parser (or three), and then identify large common subsets (using the same code structure/same XML structure even if different parameter names) across N xml files and automatically rewrite it into a macro. But that's almost a masters-time/level project and hard to fit that in.

Great idea! I would like to see this as a planemo feature I think. It should be useful to a lot of tools. A master student for planemo development would be great!