defopt
defopt copied to clipboard
Effortless argument parser
Hi, I really like defopt! It's my new go-to CLI library 🙏 One feature I miss from Argh (I think?) is the ability to modify argument names such that the...
As the module grows, I think this is not elegant to put separate modules starting with _, but it should be combined in a package.
When given the same argument multiple times, defopt silently discards all but the last: ``` >>> import defopt >>> def foo(*, directory: str): ... print(directory) >>> with suppress(BaseException): defopt.run(foo, argv=['--directory',...
I really like the fact that defopt works without mandatory decorators. But, practically, I find myself repeatedly writing some small utility that allows using decorators to register subcommands to pass...
I'm a huge fan of defopt: it perfectly embodies contemporary Python idioms. I've recommended it inside my firm. Something that concerns me is backwards-compatibility. If I upgrade defopt, it would...
See : `'append'` - This stores a list, and appends each argument value to the list. This is useful to allow an option to be specified multiple times. Example usage:...
I'd like to be able to use the argparase "count" action. A common use for this is something like `program -v` to enable verbose message and then `program -vv` or...
# MWE ```python from dataclasses import dataclass import defopt def main( args: list[str], ): pass def ok( *args: str, ): pass @dataclass class Main: args: list[str] @dataclass class Ok: arg:...
While I can't see a good way of passing arbitrary keyword arguments, users should absolutely be able to pass documented keyword arguments. `defopt.run` is itself an example of a function...
All of my commands have some common setup and teardown. One paradigm for this is to have a class with an `__init__()` and `__del__()` method, and then have each command...