Use with Jupyter Notebook
In a Jupyter Notebook, with dargs.notebook.JSON()
, one can render an JSON string with an Argument.
from dargs.sphinx import _test_argument
from dargs.notebook import JSON
jstr = """
{
"test_argument": "test1",
"test_list": [
1,
2,
3
],
"test_variant": "test_variant_argument",
"test_repeat": [
{"test_repeat_item": false},
{"test_repeat_item": true}
],
"_comment": "This is an example data"
}
"""
JSON(jstr, _test_argument())
{
"test_argument"
test_argument: type: str
This argument/variant is only used to test.
:
"test1",
"test_list"
test_list: type: typing.List[int], optional
:
[
1,
2,
3
],
"test_variant"
test_variant:type: str
This argument/variant is only used to test.
:
"test_variant_argument",
"test_repeat"
test_repeat: type: list
This argument/variant is only used to test.
:
[
{
"test_repeat_item"
test_repeat_item: type: bool
This argument/variant is only used to test.
:
false
},
{
"test_repeat_item"
test_repeat_item: type: bool
This argument/variant is only used to test.
:
true
}
],
"_comment"
:
"This is an example data"
}
When the monse stays on an argument key, the documentation of this argument will pop up.