Releases: swansonk14/typed-argument-parser
Releases · swansonk14/typed-argument-parser
Support for Tuples, bool boxed types, and empty boxed types
New support for Tuples, for example:
TupleTuple[int]Tuple[int, str, float, bool, str]Tuple[int, ...]
New support for bool boxed types, for example:
Optional[bool]List[bool]Set[bool]Tuple[bool]
New support for empty boxed types, which are equivalent to Type[str], for example:
Optional(same asOptional[str])List(same asList[str])Set(same asSet[str])Tuple(same asTuple[str])
Literals, explicit bools, dashes
Three main changes:
- Added support for
Literaltypes, which automatically specify thechoicesfor an argument based on the specifiedLiteralvalues (ex.arg: Literal['abc', 123]is equivalent toparser.add_argument('--arg', choices=['abc', 123]) - Created an option called
explicit_boolthat requires boolean arguments to be specified as--arg Trueor--arg False(or any prefix ofTrueorFalse, case insensitive) rather than--arg. - Created an option called
underscores_to_dasheswhich replaces the underscores in variables names with dashes when specified on the command line (ex.arg_1in theTapobject becomes--arg-1on the command line)
Fixes
Two bug fixes:
- Git url extraction now works for GitHub Enterprise urls
- Since
inspect.getsourcesometimes throws exceptions (e.g. when inside a Python shell), added atry/exceptto allow Tap to work even in these scenarios
Improved help strings
The primary change is that help strings are now parsed from single line comments on the same line as class variable definitions.
Additionally, Tap now supports Optional and Set by default.
v_1.1
Removing comment