Return-Path: X-Original-To: apmail-airavata-dev-archive@www.apache.org Delivered-To: apmail-airavata-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 978D517B66 for ; Tue, 1 Sep 2015 16:38:11 +0000 (UTC) Received: (qmail 18490 invoked by uid 500); 1 Sep 2015 16:38:11 -0000 Delivered-To: apmail-airavata-dev-archive@airavata.apache.org Received: (qmail 18406 invoked by uid 500); 1 Sep 2015 16:38:11 -0000 Mailing-List: contact dev-help@airavata.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@airavata.apache.org Delivered-To: mailing list dev@airavata.apache.org Received: (qmail 18385 invoked by uid 99); 1 Sep 2015 16:38:11 -0000 Received: from mail-relay.apache.org (HELO mail-relay.apache.org) (140.211.11.15) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 01 Sep 2015 16:38:11 +0000 Received: from mail-io0-f170.google.com (mail-io0-f170.google.com [209.85.223.170]) by mail-relay.apache.org (ASF Mail Server at mail-relay.apache.org) with ESMTPSA id 217771A0044; Tue, 1 Sep 2015 16:38:11 +0000 (UTC) Received: by iofh134 with SMTP id h134so7806626iof.0; Tue, 01 Sep 2015 09:38:10 -0700 (PDT) X-Received: by 10.107.148.7 with SMTP id w7mr36671474iod.82.1441125490497; Tue, 01 Sep 2015 09:38:10 -0700 (PDT) MIME-Version: 1.0 References: <20150901162531.GA26409@einstein.sdsc.edu> In-Reply-To: <20150901162531.GA26409@einstein.sdsc.edu> From: Suresh Marru Date: Tue, 01 Sep 2015 16:38:01 +0000 Message-ID: Subject: Re: Python CLI Tools To: dev@airavata.apache.org Cc: "users@airavata.apache.org" Content-Type: multipart/alternative; boundary=001a113fe6bef02090051eb22c2d --001a113fe6bef02090051eb22c2d Content-Type: text/plain; charset=UTF-8 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 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 > 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 > 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 > > >> > > > > > > > --001a113fe6bef02090051eb22c2d Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Kenneth,

Thats true, it was = working, but I was looking to find a better alternative so I can avoid writ= ing lot of if else blocks to catch user errors.=C2=A0

<= div>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 he= lper text and validating which arguments to choose. For instance in the exa= mple [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 choose= n as default. We could write checks for all these, but I was looking for a = lazy solution.=C2=A0

Suresh

On Tue, Sep 1, 2015 at 12:2= 5 PM K Yoshimoto <kenneth@sdsc.edu> 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_airav= ata.py
>
> Suresh
>
> On Mon, Aug 31, 2015 at 11:10 PM John Weachock <jweachock@gmail.com> wrote: >
> > Hi Suresh,
> >
> > I've used argparse and Click and found myself preferring argp= arse, 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= 9;t offer any
> > advice about them.
> >
> > On Mon, Aug 31, 2015 at 10:04 PM, Suresh Marru <smarru@apache.org> 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/argp= arse.html#
> >> https://docs.python.org/2/library/cmd.html
> >>
> >> High level tools like Click, Clint -
> >>
http://docs.python-guide.org/en/l= atest/scenarios/cli/
> >>
> >> Any opinions?
> >>
> >> Thanks,
> >> Suresh
> >>
> >
> >
--001a113fe6bef02090051eb22c2d--