Argument checking for python programs
This is a minimum version for checking the input argument dict. It would examine argument's type, as well as keys and types of its sub-arguments.
A special case called variant is also handled,
where you can determine the items of a dict based the value of on one of its flag_name key.
There are three main methods of Argument class:
checkmethod that takes a dict and see if its type follows the definition in the classnormalizemethod that takes a dict and convert alias and add default value into itgendocmethod that outputs the defined argument structure and corresponding docs
There are also check_value and normalize_value that
ignore the leading key comparing to the base version.
When targeting to html rendering, additional anchor can be made for cross reference.
Set make_anchor=True when calling gendoc function and use standard ref syntax in rst.
The id is the same as the argument path. Variant types would be in square brackets.
Please refer to test files for detailed usage.
Additional features
- PEP 484 type annotations
- Native integration with Sphinx, DP-GUI, and Jupyter Notebook
- JSON encoder for
ArgumentandVariantclasses - Generate JSON schema from an
Argument, which can be further integrated with JSON editors such as Visual Studio Code - Load dict values from external JSON/YAML files via the
$refkey
Metadata
Release files for dargs 0.5.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| dargs-0.5.1.tar.gz | 62.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| dargs-0.5.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 96.9 kB
Release files / dargs-0.5.1.tar.gz
| Download URL | dargs-0.5.1.tar.gz |
|---|---|
| Size | 62.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
993f048ae893f06e0c9a3836a16ed08ecbea49d343b1063f1429bc26b4902d50
|
|
BLAKE2b-256 checksum How to use checksums |
6f14220f4e40748b00e219a9c9190a5cc809936ee3b14d1e296f15c73cb73daa
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.16
|
Release files / dargs-0.5.1-py3-none-any.whl
| Download URL | dargs-0.5.1-py3-none-any.whl |
|---|---|
| Size | 34.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
faa9660c3fbbca9dfa3c6950add079725be9cb0de4c005fcb5450ea460900c06
|
|
BLAKE2b-256 checksum How to use checksums |
f237c5f583357a8c0cca2f124835f2c6592cf4ffad4288cbee2830d0b871998c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.11.16
|