Re: CLI parsing—with `--help` text—`--foo bar`, how to give additional parameters to `bar`?

2020-10-16 Thread Mats Wichmann
On 10/15/20 5:09 PM, Samuel Marks wrote: > Yes it’s my module, and I’ve been using argparse > https://github.com/SamuelMarks/ml-params > > No library I’ve found provides a solution to CLI argument parsing for my > use-case. > > So I’ll write one. But what should it look like, syntactically and >

Re: CLI parsing—with `--help` text—`--foo bar`, how to give additional parameters to `bar`?

2020-10-16 Thread Samuel Marks
Yeah, but the risk with config files is you need a website—and/or full JSON schema output—to figure out what’s needed. (Although I should mention that with my doctrans project you can generate a config class—and class method—from/to your argparse parser; enabling the config file scenario rather

Re: Re: CLI parsing—with `--help` text—`--foo bar`, how to give additional parameters to `bar`?

2020-10-15 Thread Samuel Marks
Yeah I've played with custom actions before https://github.com/offscale/argparse-utils/tree/master/argparse_utils/actions But this would only help in one phase, the important phase of providing help text will need to be provided out-of-argparse and thrown in (like my trivial absl alternative,

Re: Re: CLI parsing—with `--help` text—`--foo bar`, how to give additional parameters to `bar`?

2020-10-15 Thread Dieter Maurer
Samuel Marks wrote at 2020-10-16 10:09 +1100: >Yes it’s my module, and I’ve been using argparse >https://github.com/SamuelMarks/ml-params > >No library I’ve found provides a solution to CLI argument parsing for my >use-case. Do you know that with `argparse` you can specify how many arguments an

Re: CLI parsing—with `--help` text—`--foo bar`, how to give additional parameters to `bar`?

2020-10-15 Thread 2QdxY4RzWzUUiLuE
On 2020-10-16 at 11:27:56 +1100, Regarding "Re: CLI parsing—with `--help` text—`--foo bar`, how to give additional parameters to `bar`?," Samuel Marks wrote: > The feature that existing CLI parsers are missing is a clean syntax > for specifying options on the second param

Re: CLI parsing—with `--help` text—`--foo bar`, how to give additional parameters to `bar`?

2020-10-15 Thread Cameron Simpson
On 16Oct2020 10:59, Samuel Marks wrote: >--optimizer Adam,learning_rate=0.01,something_else=3 > >That syntax isn’t so bad! =] > >How would you suggest the help text for this looks? (don’t worry about >implementation, just what goes to stdout/stderr) Maybe: Usage: ...

Re: CLI parsing—with `--help` text—`--foo bar`, how to give additional parameters to `bar`?

2020-10-15 Thread Samuel Marks
Hi Dan, The feature that existing CLI parsers are missing is a clean syntax for specifying options on the second parameter (the "value"), where there may be different options available depending on which you choose. For example: https://www.tensorflow.org/api_docs/python/tf/keras/optimizers/Adam

Re: CLI parsing—with `--help` text—`--foo bar`, how to give additional parameters to `bar`?

2020-10-15 Thread 2QdxY4RzWzUUiLuE
On 2020-10-16 at 10:20:40 +1100, Cameron Simpson wrote: > On 16Oct2020 10:09, Samuel Marks wrote: > >Yes it’s my module, and I’ve been using argparse > >https://github.com/SamuelMarks/ml-params > > > >No library I’ve found provides a solution to CLI argument parsing for my > >use-case. Out of

Re: CLI parsing—with `--help` text—`--foo bar`, how to give additional parameters to `bar`?

2020-10-15 Thread 2QdxY4RzWzUUiLuE
On 2020-10-16 at 10:59:16 +1100, Samuel Marks wrote: > --optimizer Adam,learning_rate=0.01,something_else=3 > > That syntax isn’t so bad! =] > > How would you suggest the help text for this looks? (don’t worry about > implementation, just what goes to stdout/stderr) --optimizer

Re: CLI parsing—with `--help` text—`--foo bar`, how to give additional parameters to `bar`?

2020-10-15 Thread Karen Shaeffer via Python-list
Hi Sam, I’ve been using abseil python API. https://abseil.io/docs/python/guides/flags https://abseil.io/docs/python/quickstart It’s a distributed command line system with features that appear to support

Re: CLI parsing—with `--help` text—`--foo bar`, how to give additional parameters to `bar`?

2020-10-15 Thread Samuel Marks
--optimizer Adam,learning_rate=0.01,something_else=3 That syntax isn’t so bad! =] How would you suggest the help text for this looks? (don’t worry about implementation, just what goes to stdout/stderr) PS: Yeah I used square brackets for my Bash arrays On Fri, 16 Oct 2020 at 10:26 am, Cameron

Re: CLI parsing—with `--help` text—`--foo bar`, how to give additional parameters to `bar`?

2020-10-15 Thread Cameron Simpson
One other thing: On 15Oct2020 20:53, Samuel Marks wrote: >Idea: preprocess `sys.argv` so that this syntax would work >`--optimizer Adam[learning_rate=0.01]`* > >*square rather than round so as not to require escape characters or >quoting in `sh` Square brackets are also shell syntax,

Re: CLI parsing—with `--help` text—`--foo bar`, how to give additional parameters to `bar`?

2020-10-15 Thread Cameron Simpson
On 16Oct2020 10:09, Samuel Marks wrote: >Yes it’s my module, and I’ve been using argparse >https://github.com/SamuelMarks/ml-params > >No library I’ve found provides a solution to CLI argument parsing for my >use-case. > >So I’ll write one. But what should it look like, syntactically and

Re: CLI parsing—with `--help` text—`--foo bar`, how to give additional parameters to `bar`?

2020-10-15 Thread Samuel Marks
Yes it’s my module, and I’ve been using argparse https://github.com/SamuelMarks/ml-params No library I’ve found provides a solution to CLI argument parsing for my use-case. So I’ll write one. But what should it look like, syntactically and semantically? On Fri, 16 Oct 2020 at 3:14 am, Dieter

Re: CLI parsing—with `--help` text—`--foo bar`, how to give additional parameters to `bar`?

2020-10-15 Thread Dieter Maurer
Samuel Marks wrote at 2020-10-15 20:53 +1100: > ... >To illustrate the issue, using `ml-params` and ml-params-tensorflow: > ... >What's the right solution here? While Python provides several modules in its standard library to process parameters (e.g. the simple `getopt` and the flexible