Hi,

I started writing the proposal, here I have attached it. I would be
thankful if you can help me improve it.
​
 Proposal : Python based Command Line Tool (CLI) for Stratos
<https://docs.google.com/document/d/1ORkVPtFnJQi6szswKaim8ZCIKMHi3d3eCVOuA18GOG4/edit?usp=drive_web>
​

On Wed, Mar 11, 2015 at 12:57 AM, Imesh Gunaratne <[email protected]> wrote:

> Hi Milindu,
>
> Yes you seems to be on track. Please use Kubernetes getting started guide
> here:
> https://gist.github.com/imesh/b8f81fac8de39183a504
>
> Thanks
>
>
> On Mon, Mar 9, 2015 at 8:22 PM, Milindu Sanoj Kumarage <
> [email protected]> wrote:
>
>> Hi,
>>
>> I could fix that "-" problem, everything is now works exactly as Java
>> CLI. I think I can do a demo app with some functionality, then we can
>> discuss further, right?
>>
>> And I'm currently setting up the Stratos on my machine, it seems setting
>> up  OpenStack ( DevStack ) is not easy, I found that Kubernetes Vagrant
>> Setup, trying it, and seems it is working fine. Going on that path would
>> not  be a problem, right?
>>
>>
>>
>> On Fri, Mar 6, 2015 at 9:37 AM, Imesh Gunaratne <[email protected]> wrote:
>>
>>> Great! Nice to hear that. We might not need to use "_", it would be
>>> better if auto completion could also use commands with "-" pattern.
>>>
>>> At the moment we do not have much client side validations, most of them
>>> are done in server. You could refer [1] for this.
>>>
>>> [1] https://cwiki.apache.org/confluence/display/STRATOS/4.1.0+CLI+Guide
>>>
>>> On Thu, Mar 5, 2015 at 6:23 PM, Milindu Sanoj Kumarage <
>>> [email protected]> wrote:
>>>
>>>> Hi,
>>>>
>>>> With this workaround ( actually it is not a workaround, Cmd2 really has
>>>> aliases feature! but in different name ) we can have both "list-tenants"
>>>> and "list_tenants" working without a problem. Therefor the  Single
>>>> command line mode would work exactly like the Java CLI, and also the
>>>> Interactive mode. But in Interactive mode, auto-complete still  suggests "
>>>> list_tenants" instead of "list-tenants". we can change that too if you
>>>> really need, but needs some alternations that may not be very beautiful,
>>>> but not ugly too.
>>>>
>>>> one more question, we have to validate the parameters before sending to
>>>> the REST API, right? Do we have any document for these validations, or is
>>>> it the codes I have to follow?
>>>>
>>>>
>>>>
>>>> On Thu, Mar 5, 2015 at 3:50 AM, Imesh Gunaratne <[email protected]>
>>>> wrote:
>>>>
>>>>> Hi Milindu,
>>>>>
>>>>> Great work! We will have a look at this and get back to you. In the
>>>>> mean time can you provide some details on this sample?
>>>>>
>>>>> Thanks
>>>>>
>>>>> On Thu, Mar 5, 2015 at 12:12 AM, Milindu Sanoj Kumarage <
>>>>> [email protected]> wrote:
>>>>>
>>>>>> Hi,
>>>>>> I spend last few days investigating a workarounds to solve that '-'
>>>>>> problem :) It seems it is possible.
>>>>>>
>>>>>> BTW, I checked the possibility of uploading the final product to Pip
>>>>>> where anyone can  install Stratos CLI using Pip like
>>>>>> $Pip install stratos
>>>>>>
>>>>>> and then run like
>>>>>>
>>>>>> $ stratos -u abcdef
>>>>>>
>>>>>> What's your idea on that? ( We can also provide python script with a
>>>>>> wrapper for Windows and Linux  )
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> On Fri, Feb 27, 2015 at 9:45 PM, Milindu Sanoj Kumarage <
>>>>>> [email protected]> wrote:
>>>>>>
>>>>>>> Hi,
>>>>>>>
>>>>>>> the reason is  Cmd2 ( and most of the python CLI frameworks ) uses
>>>>>>> function mapping to CLI commands, that is,
>>>>>>>
>>>>>>> // stratos>greet
>>>>>>> def do_greet():
>>>>>>>     print("hi")
>>>>>>>
>>>>>>> will become the 'greet' command.
>>>>>>>
>>>>>>> But if we need,
>>>>>>>
>>>>>>> 'list-tenants' we have to code it as
>>>>>>>
>>>>>>> def do_list-tenants:
>>>>>>>    #codes of list tenant command
>>>>>>>
>>>>>>> But using '-' in names of functions ( def*enitions* ) in Python is
>>>>>>> not allowed.
>>>>>>> What shall we do? I'm okay even to write it from the scratch.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> On Fri, Feb 27, 2015 at 9:29 PM, Imesh Gunaratne <[email protected]>
>>>>>>> wrote:
>>>>>>>
>>>>>>>> Hi Milindu,
>>>>>>>>
>>>>>>>> Is there any way of using "-" in the CLI commands. I did not get
>>>>>>>> why a CLI framework would block "-" character.
>>>>>>>>
>>>>>>>> Thanks
>>>>>>>>
>>>>>>>> On Fri, Feb 27, 2015 at 2:49 PM, Milindu Sanoj Kumarage <
>>>>>>>> [email protected]> wrote:
>>>>>>>>
>>>>>>>>> Hi,
>>>>>>>>>
>>>>>>>>> Then shall we go with Cmd2 python package? Only change we have to
>>>>>>>>> do is call CLI commands with '_ '  instead '-', like 'list_tenants' 
>>>>>>>>> instead
>>>>>>>>> of 'list-tenants'.
>>>>>>>>>
>>>>>>>>> And for HTTP request/response handling,  we can use either
>>>>>>>>> Python's urllib3 or Requests, a wrapper around urllib3 which gives 
>>>>>>>>> much
>>>>>>>>> simpler API that leads to  cleaner codes. It's been praised in the
>>>>>>>>> community from the beginning.
>>>>>>>>>
>>>>>>>>> Licence: Apache2
>>>>>>>>>
>>>>>>>>> http://docs.python-requests.org/en/latest/#
>>>>>>>>>
>>>>>>>>> On Wed, Feb 25, 2015 at 3:26 PM, Milindu Sanoj Kumarage <
>>>>>>>>> [email protected]> wrote:
>>>>>>>>>
>>>>>>>>>> Hi,
>>>>>>>>>>
>>>>>>>>>> Here I have included the licences of each framework :)
>>>>>>>>>>
>>>>>>>>>> *Cement *(6/10)
>>>>>>>>>> A complex framework, every CLI commands is bound to a separate
>>>>>>>>>> Python class that acts like an controller, and each controller have 
>>>>>>>>>> several
>>>>>>>>>> functions. But no 'Interactive Mode' support, just 'Single command 
>>>>>>>>>> line
>>>>>>>>>> mode'. Supports having  '-' in CLI Commands ( like 'create-tenant' )
>>>>>>>>>> via aliases. But no much developments in Github repo recently.
>>>>>>>>>>
>>>>>>>>>> http://cement.readthedocs.org/
>>>>>>>>>>
>>>>>>>>>> Licence : http://cement.readthedocs.org/en/latest/license/
>>>>>>>>>> Redistribution and use in source and binary forms, with or
>>>>>>>>>> without modification, are permitted under given conditions.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> *Click *(7/10)
>>>>>>>>>> Rich with features, uses Python Decorators to bind CLI commands
>>>>>>>>>> to functions. But no 'Interactive Mode' support, just 'Single 
>>>>>>>>>> command line
>>>>>>>>>> mode'.
>>>>>>>>>>
>>>>>>>>>> http://click.pocoo.org/3/
>>>>>>>>>>
>>>>>>>>>> Licence :  http://click.pocoo.org/3/license/
>>>>>>>>>>  three-clause BSD License
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> *Plac *(4/10)
>>>>>>>>>> A scaled down version of Python argparse package.  Uses set of if
>>>>>>>>>> else statements to process the commands. But no 'Interactive Mode' 
>>>>>>>>>> support.
>>>>>>>>>>
>>>>>>>>>> http://plac.googlecode.com/hg/doc/plac.html
>>>>>>>>>>
>>>>>>>>>> Licence: http://plac.googlecode.com/hg/doc/plac.html
>>>>>>>>>> BSD license
>>>>>>>>>>
>>>>>>>>>> *Cliapp *(3/10)
>>>>>>>>>> No 'Interactive Mode' support.
>>>>>>>>>>
>>>>>>>>>> http://code.liw.fi/cliapp/docs/
>>>>>>>>>>
>>>>>>>>>> Licence : https://github.com/rshk/CliApp/blob/master/LICENSE
>>>>>>>>>> Apache License
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> *pyCLI  *(3/10)
>>>>>>>>>> No 'Interactive Mode' support.
>>>>>>>>>>
>>>>>>>>>> http://pythonhosted.org//pyCLI/
>>>>>>>>>>
>>>>>>>>>> Licence: http://sourceforge.net/projects/pycli/
>>>>>>>>>> GNU General Public License version 2.0 (GPLv2)
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> *Cliff *(9/10)
>>>>>>>>>> A framework for building command line programs by OpenStack. It
>>>>>>>>>> uses plugins to define sub-commands, output formatters, and other
>>>>>>>>>> extensions.
>>>>>>>>>> Supports  'Interactive Mode'  using 'cmd2' and 'cmd'
>>>>>>>>>>
>>>>>>>>>> http://docs.openstack.org/developer/cliff/index.html
>>>>>>>>>>
>>>>>>>>>> Licence: https://launchpad.net/python-cliff
>>>>>>>>>> Apache Licence
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> *cmd *(8/10)
>>>>>>>>>> Python in built packages for 'Interactive Mode' applications.
>>>>>>>>>> Maps CLI commands to functions by function name, as def
>>>>>>>>>> do_<whatever the command name> ( eg: def do_command1 is for
>>>>>>>>>> command1 ). Support only arguments but no support for Unix-style 
>>>>>>>>>> flags.
>>>>>>>>>> Have features like automatic command completion in 'Interactive 
>>>>>>>>>> Mode'.
>>>>>>>>>>
>>>>>>>>>> https://docs.python.org/2/library/cmd.html
>>>>>>>>>>
>>>>>>>>>> Licence: https://docs.python.org/2/license.html
>>>>>>>>>> GPL compatible
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> *cmd2 *(9/10)
>>>>>>>>>> Extends the Python Standard Library’s cmd package.  Can handle
>>>>>>>>>> arguments and flags.  Supports for Output Redirection and Piping ( 
>>>>>>>>>> As in a
>>>>>>>>>> Unix shell ). Searchable command history (  bash-like history list 
>>>>>>>>>> editing
>>>>>>>>>> ), can get last commands with arrow keys. Able to perform shell 
>>>>>>>>>> commands
>>>>>>>>>> while in Interactive mode.  ( eg: stratos>!ls or stratos>shell ls ) 
>>>>>>>>>> output
>>>>>>>>>> can be colored.
>>>>>>>>>>
>>>>>>>>>> https://pythonhosted.org/cmd2
>>>>>>>>>>
>>>>>>>>>> Licence: https://pypi.python.org/pypi/cmd2/0.6.8
>>>>>>>>>> MIT License
>>>>>>>>>>
>>>>>>>>>> On Wed, Feb 25, 2015 at 10:29 AM, Chamila De Alwis <
>>>>>>>>>> [email protected]> wrote:
>>>>>>>>>>
>>>>>>>>>>> Great work Milindu. It would be better to add the licenses for
>>>>>>>>>>> each library too, in case any non-compatible or ambiguous ones 
>>>>>>>>>>> might be
>>>>>>>>>>> there.
>>>>>>>>>>>
>>>>>>>>>>> IMO using a framework from the standard library would be better,
>>>>>>>>>>> since the pre-requisites will be minimal.
>>>>>>>>>>> On Feb 25, 2015 9:55 AM, "Milindu Sanoj Kumarage" <
>>>>>>>>>>> [email protected]> wrote:
>>>>>>>>>>>
>>>>>>>>>>>> Hi,
>>>>>>>>>>>>
>>>>>>>>>>>> Here is the JIRA issue on this,
>>>>>>>>>>>> https://issues.apache.org/jira/browse/STRATOS-1187
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> Here I have added some of the Python CLI frameworks I checked,
>>>>>>>>>>>> I have added a brief for each of them. I also have state a score 
>>>>>>>>>>>> out of 10
>>>>>>>>>>>> to indicate how best they matches for our need. ( But they are as 
>>>>>>>>>>>> of my
>>>>>>>>>>>> understanding! I may not be very correct in some cases.  Because 
>>>>>>>>>>>> some of
>>>>>>>>>>>> the ones I could write some codes and check, but for some I could 
>>>>>>>>>>>> not,
>>>>>>>>>>>> manly because of errors )
>>>>>>>>>>>>
>>>>>>>>>>>> *Cement *(6/10)
>>>>>>>>>>>> A complex framework, every CLI commands is bound to a separate
>>>>>>>>>>>> Python class that acts like an controller, and each controller 
>>>>>>>>>>>> have several
>>>>>>>>>>>> functions. But no 'Interactive Mode' support, just 'Single command 
>>>>>>>>>>>> line
>>>>>>>>>>>> mode'. Supports having  '-' in CLI Commands ( like 'create-tenant' 
>>>>>>>>>>>> )
>>>>>>>>>>>> via aliases. But no much developments in Github repo recently.
>>>>>>>>>>>>
>>>>>>>>>>>> http://cement.readthedocs.org/
>>>>>>>>>>>>
>>>>>>>>>>>> *Click *(7/10)
>>>>>>>>>>>> Rich with features, uses Python Decorators to bind CLI commands
>>>>>>>>>>>> to functions. But no 'Interactive Mode' support, just 'Single 
>>>>>>>>>>>> command line
>>>>>>>>>>>> mode'.
>>>>>>>>>>>>
>>>>>>>>>>>> http://click.pocoo.org/3/
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> *Plac *(4/10)
>>>>>>>>>>>> A scaled down version of Python argparse package.  Uses set of
>>>>>>>>>>>> if else statements to process the commands. But no 'Interactive 
>>>>>>>>>>>> Mode'
>>>>>>>>>>>> support.
>>>>>>>>>>>>
>>>>>>>>>>>> http://plac.googlecode.com/hg/doc/plac.html
>>>>>>>>>>>>
>>>>>>>>>>>> *Cliapp *(3/10)
>>>>>>>>>>>> No 'Interactive Mode' support.
>>>>>>>>>>>>
>>>>>>>>>>>> http://code.liw.fi/cliapp/docs/
>>>>>>>>>>>>
>>>>>>>>>>>> *pyCLI  *(3/10)
>>>>>>>>>>>> No 'Interactive Mode' support.
>>>>>>>>>>>>
>>>>>>>>>>>> http://pythonhosted.org//pyCLI/
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> *Cliff *(9/10)
>>>>>>>>>>>> A framework for building command line programs by OpenStack. It
>>>>>>>>>>>> uses plugins to define sub-commands, output formatters, and other
>>>>>>>>>>>> extensions.
>>>>>>>>>>>> Supports  'Interactive Mode'  using 'cmd2' and 'cmd'
>>>>>>>>>>>>
>>>>>>>>>>>> http://docs.openstack.org/developer/cliff/index.html
>>>>>>>>>>>>
>>>>>>>>>>>> *cmd *(8/10)
>>>>>>>>>>>> Python in built packages for 'Interactive Mode' applications.
>>>>>>>>>>>> Maps CLI commands to functions by function name, as def
>>>>>>>>>>>> do_<whatever the command name> ( eg: def do_command1 is for
>>>>>>>>>>>> command1 ). Support only arguments but no support for Unix-style 
>>>>>>>>>>>> flags.
>>>>>>>>>>>> Have features like automatic command completion in 'Interactive 
>>>>>>>>>>>> Mode'.
>>>>>>>>>>>>
>>>>>>>>>>>> https://docs.python.org/2/library/cmd.html
>>>>>>>>>>>>
>>>>>>>>>>>> *cmd2 *(9/10)
>>>>>>>>>>>> Extends the Python Standard Library’s cmd package.  Can handle
>>>>>>>>>>>> arguments and flags.  Supports for Output Redirection and Piping ( 
>>>>>>>>>>>> As in a
>>>>>>>>>>>> Unix shell ). Searchable command history (  bash-like history list 
>>>>>>>>>>>> editing
>>>>>>>>>>>> ), can get last commands with arrow keys. Able to perform shell 
>>>>>>>>>>>> commands
>>>>>>>>>>>> while in Interactive mode.  ( eg: stratos>!ls or stratos>shell ls 
>>>>>>>>>>>> ) output
>>>>>>>>>>>> can be colored.
>>>>>>>>>>>>
>>>>>>>>>>>> https://pythonhosted.org/cmd2
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> Imesh Gunaratne
>>>>>>>>
>>>>>>>> Technical Lead, WSO2
>>>>>>>> Committer & PMC Member, Apache Stratos
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Imesh Gunaratne
>>>>>
>>>>> Technical Lead, WSO2
>>>>> Committer & PMC Member, Apache Stratos
>>>>>
>>>>
>>>>
>>>
>>>
>>> --
>>> Imesh Gunaratne
>>>
>>> Technical Lead, WSO2
>>> Committer & PMC Member, Apache Stratos
>>>
>>
>>
>
>
> --
> Imesh Gunaratne
>
> Technical Lead, WSO2
> Committer & PMC Member, Apache Stratos
>

Reply via email to