Typed-argument-parser

Latest version: v1.10.0

Safety actively analyzes 629811 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 4 of 4

1.4.2

Several improvements and additions to saving, loading, and deepcopying Tap objects.
1. `save`: Improved JSON encoding to enable saving of arbitrary Python objects with pickle strings inside the JSON file. Additionally, added native JSON support for tuples and sets.
2. `load`: Implemented a `load` function which can load args from a JSON file (e.g. the JSON file created by `save`).
3. `from_dict`: Implemented a `from_dict` function which can load args from a dictionary.
4. `deepcopy`: Fixed several issues to enable deepcopying of Tap objects.

1.4.1

New support for Tuples, for example:
- `Tuple`
- `Tuple[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 as `Optional[str]`)
- ` List` (same as `List[str]`)
- ` Set` (same as `Set[str]`)
- ` Tuple` (same as `Tuple[str]`)

1.4

Three main changes:

1) Added support for `Literal` types, which automatically specify the `choices` for an argument based on the specified `Literal` values (ex. `arg: Literal['abc', 123]` is equivalent to `parser.add_argument('--arg', choices=['abc', 123]`)
2) Created an option called `explicit_bool` that requires boolean arguments to be specified as `--arg True` or `--arg False` (or any prefix of `True` or `False`, case insensitive) rather than `--arg`.
3) Created an option called `underscores_to_dashes` which replaces the underscores in variables names with dashes when specified on the command line (ex. `arg_1` in the `Tap` object becomes `--arg-1` on the command line)

1.3

Two bug fixes:
- Git url extraction now works for GitHub Enterprise urls
- Since `inspect.getsource` sometimes throws exceptions (e.g. when inside a Python shell), added a `try/except` to allow Tap to work even in these scenarios

1.2

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.

1.1

Page 4 of 4

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.