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, exp

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 op

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 parameter (the "value"), wher

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 c

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 name[,optio

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 you

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 S

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, introducing

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 >semantic

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 Mau

Re: Simple question - end a raw string with a single backslash ?

2020-10-15 Thread Serhiy Storchaka
15.10.20 22:16, Roland Müller via Python-list пише: > I used the triple single quotes as delimiter: > s = r'''a single quote ', a double quote "''' s > > 'a single quote \', a double quote "' It does not help if the string contains both kinds of triple quotes You have to use triple

Re: Simple question - end a raw string with a single backslash ?

2020-10-15 Thread Roland Müller via Python-list
On 10/13/20 4:14 PM, Serhiy Storchaka wrote: 13.10.20 11:52, Tony Flury via Python-list пише: I am trying to write a simple expression to build a raw string that ends in a single backslash. My understanding is that a raw string should ignore attempts at escaping characters but I get this :   

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 `argparse`

Efficient authorization for Django list views with oso

2020-10-15 Thread Stephie Glaser
Hi All! We're building an open source policy engine for adding access control (permissions, roles, etc.) to apps, called oso. oso policies are declarative, and enable users to cleanly separate authorization logic from the rest of their application code. In our latest release of django-oso, we adde

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

2020-10-15 Thread Samuel Marks
Previously I have solved related problems with explicit `-}` and `-{` (or `-b`) as in `nginxctl`: ``` $ python -m nginxctl serve --temp_dir '/tmp' \ -b 'server' \ --server_name 'localhost' --listen '8080' \ -b location '/' \ --root '/tmp/wwwro