Kenneth, Thats true, it was working, but I was looking to find a better alternative so I can avoid writing lot of if else blocks to catch user errors.
My early impressions with argparse seems to be that its more robust in terms of argument parsing. It is pretty handy to set defaults, providing helper text and validating which arguments to choose. For instance in the example [1] see -r option, its doing all the needed logic to ensure users only submit jobs to comet and stampede and if none is specified comet is choosen as default. We could write checks for all these, but I was looking for a lazy solution. Suresh [1] - https://github.com/SciGaP/PythonClients/blob/master/samples/workbench_submit_airavata.py On Tue, Sep 1, 2015 at 12:25 PM K Yoshimoto <[email protected]> wrote: > > I was working with Airavata-remote, and that was working as > a command-line client. > > Kenneth > > On Tue, Sep 01, 2015 at 04:21:50PM +0000, Suresh Marru wrote: > > Hi John, > > > > Thank you, this was a fine suggestion. I did not try Click, but looks > like > > argparse is good for what I wanted. It being the standard library is a > nice > > plus. I used it for a quick example for to launch experiments for a > > specific application wrapper, please critique - > > > https://github.com/SciGaP/PythonClients/blob/master/samples/workbench_submit_airavata.py > > > > Suresh > > > > On Mon, Aug 31, 2015 at 11:10 PM John Weachock <[email protected]> > wrote: > > > > > Hi Suresh, > > > > > > I've used argparse and Click and found myself preferring argparse, but > I > > > think either option is perfectly acceptable. Click is an external > > > dependency, however, while argparse is in the standard library. > > > > > > I have no experience with the cmd or Clint libraries, so I can't offer > any > > > advice about them. > > > > > > On Mon, Aug 31, 2015 at 10:04 PM, Suresh Marru <[email protected]> > wrote: > > > > > >> Hi All, > > >> > > >> Any recommendations on creating good command line interfaces using > > >> Python? We have a usecase to wrap Airavata Python SDK samples to > create > > >> good command line tool to submit jobs. > > >> > > >> Here are some tools I found with varying opinions: > > >> https://docs.python.org/2/library/argparse.html# > > >> https://docs.python.org/2/library/cmd.html > > >> > > >> High level tools like Click, Clint - > > >> http://docs.python-guide.org/en/latest/scenarios/cli/ > > >> > > >> Any opinions? > > >> > > >> Thanks, > > >> Suresh > > >> > > > > > > >
