Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/deepmodeling/dargs
Argument processing for the deep modeling project.
https://github.com/deepmodeling/dargs
python
Last synced: 6 days ago
JSON representation
Argument processing for the deep modeling project.
- Host: GitHub
- URL: https://github.com/deepmodeling/dargs
- Owner: deepmodeling
- License: lgpl-3.0
- Created: 2020-09-19T22:20:28.000Z (about 4 years ago)
- Default Branch: master
- Last Pushed: 2024-10-28T05:22:59.000Z (7 days ago)
- Last Synced: 2024-10-28T08:46:20.607Z (7 days ago)
- Topics: python
- Language: Python
- Homepage: https://docs.deepmodeling.com/projects/dargs/
- Size: 177 KB
- Stars: 5
- Watchers: 7
- Forks: 3
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- deepmodeling-projects - GitHub - 25% open · ⏱️ 17.07.2024): (Others)
README
# Argument checking for python programs
[![conda-forge](https://img.shields.io/conda/dn/conda-forge/dargs?color=red&label=conda-forge&logo=conda-forge)](https://anaconda.org/conda-forge/dargs)
[![pip install](https://img.shields.io/pypi/dm/dargs?label=pip%20install&logo=pypi)](https://pypi.org/project/dargs)
[![Documentation Status](https://readthedocs.org/projects/dargs/badge/)](https://dargs.readthedocs.io/)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:
- `check` method that takes a dict and see if its type follows the definition in the class
- `normalize` method that takes a dict and convert alias and add default value into it
- `gendoc` method that outputs the defined argument structure and corresponding docsThere 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](https://peps.python.org/pep-0484/) type annotations
- Native integration with [Sphinx](https://github.com/sphinx-doc/sphinx), [DP-GUI](https://github.com/deepmodeling/dpgui), and [Jupyter Notebook](https://jupyter.org/)
- JSON encoder for `Argument` and `Variant` classes
- Generate [JSON schema](https://json-schema.org/) from an `Argument`, which can be further integrated with JSON editors such as [Visual Studio Code](https://code.visualstudio.com/)