git.net

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


Hi Sam,
I?ve been using abseil python API.

https://abseil.io/docs/python/guides/flags <https://abseil.io/docs/python/guides/flags>
https://abseil.io/docs/python/quickstart <https://abseil.io/docs/python/quickstart>

It?s a distributed command line system with features that appear to support your needs.

Karen


> On Oct 15, 2020, at 4:09 PM, Samuel Marks <samuelmarks at gmail.com> wrote:
> 
> Yes it?s my module, and I?ve been using argparse
> https://github.com/SamuelMarks/ml-params <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 Maurer <dieter at handshake.de <mailto:dieter at handshake.de>> wrote:
> 
>> 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`),
>> it is up to the "application" whether it uses such a module (and which one)
>> or whether it handle arguments on its own.
>> 
>> Apparently, `ml_param` is not a staudard Python module.
>> Is it a package of your own? Then I suggest to check `argparse` whether
>> it supports your use case (I know, it can be customized to do it,
>> but maybe, it does it already out of the box).
>> 
>> If `ml_param` is a third party module, then the question
>> is actually an `ml_param` question. Ask its support mailing lists
>> or have a look at its source.
>> 
>> --
> Samuel Marks
> Charity <https://sydneyscientific.org <https://sydneyscientific.org/>> | consultancy
> <https://offscale.io <https://offscale.io/>> | open-source
> <https://github.com/offscale <https://github.com/offscale>> | LinkedIn <
> https://linkedin.com/in/samuelmarks <https://linkedin.com/in/samuelmarks>>
> -- 
> https://mail.python.org/mailman/listinfo/python-list <https://mail.python.org/mailman/listinfo/python-list>