Howdy devs,
I put together a library recently, and since it seems to be functional I thought I'd share with the rest of -dev in case it's of interest to anyone. If anyone has feedback, bugs/issues, or PRs, I'd be happy to receive them!
So, what is it?
gxargparse is a drop in replacement for argparse which can generate Galaxy Tool XML on demand.
When I say "drop in" replacement, I mean it. Through some python magic, as soon as you `pip install gxargparse`, your argparse will (maybe*) be transparently wrapped by gxargparse, and you'll have the --generate_galaxy_xml flag available, which will generate Galaxy Tool XML. This means no code changes required, and free tool XML generation.
However, beware that it is "free tool XML"; you will likely need to make some manual corrections to it before publishing tools (repeat labels for instance). However, if you're converting an argparse tool with hundreds of arguments for use in Galaxy, this could save you a lot of initial manual work.
* I say
maybe because it depends a bit on your python module load order, which is something completely outside of my control. The package
comes with a command line tool which spits out a path you can stick in PYTHONPATH to fix this issue.
Where to get it?
Now available on pypi (
gxargparse) and github (
erasche/gxargparse). I
strongly recommend against installing it system wide, as any bugs in it could render all argparse based python tools broken on your system. It's much more reasonable to use it in a virtualenv.
(gx
Known Problems
- argument_groups are not dealt with specially
- prefix_chars and other lesser used features are not (yet) supported
- anything with a repeat is a bit of a hack
- no translation from argparse to conditionals/which yet figured out.
Cheers,
Eric
--
Eric Rasche
Programmer II
Center for Phage Technology
Rm 312A, BioBio
Texas A&M University
College Station, TX 77843
404-692-2048