# DI-toolkit
[](https://pypi.org/project/DI-toolkit/)



[](https://github.com/opendilab/DI-toolkit/actions?query=workflow%3A%22Docs+Deploy%22)
[](https://github.com/opendilab/DI-toolkit/actions?query=workflow%3A%22Code+Test%22)
[](https://github.com/opendilab/DI-toolkit/actions?query=workflow%3A%22Badge+Creation%22)
[](https://github.com/opendilab/DI-toolkit/actions?query=workflow%3A%22Package+Release%22)
[](https://codecov.io/gh/opendilab/DI-toolkit)
[](https://github.com/opendilab/DI-toolkit/stargazers)
[](https://github.com/opendilab/DI-toolkit/network)

[](https://github.com/opendilab/DI-toolkit/issues)
[](https://github.com/opendilab/DI-toolkit/pulls)
[](https://github.com/opendilab/DI-toolkit/graphs/contributors)
[](https://github.com/opendilab/DI-toolkit/blob/master/LICENSE)
A simple toolkit package for opendilab, including the following utilities:
- `ditk.logging`, a easy-to-use logger system
- `ditk.annonated`, an annotated documentation generation script
- `ditk.tensorboard`, a utility for extract data from tensorboard log file
- `ditk.tensorboard.plot`, plot utilities for plotting data extracted from tensorboard log file
## Installation
You can simply install it with `pip` command line from the official PyPI site.
```shell
pip install DI-toolkit
```
Or installing from the latest source code as follows:
```shell
git clone https://github.com/opendilab/DI-toolkit.git
cd di-toolkit
pip install . --user
```
## Quick Start
### Example of ditk.logging
Here is an example of logging.
```python
from ditk import logging
if __name__ == '__main__':
logging.try_init_root(logging.INFO)
logging.info('This is info')
logging.warning('This is warning with integer 233')
logging.error('This is a error with string \'233\'.')
try:
_ = 1 / 0
except ZeroDivisionError as err:
logging.exception(err)
```
`ditk.logging`has almost the same interface as native `logging` module. You can directly replace `import logging` in the
code with `from ditk import logging`.
### ditk.annonated
Python annotated documentation generation script like the following

#### Usage
```shell
python -m ditk.doc.annotated create -i ditk/doc/annotated/ppo.py -o my_doc/index.html -L zh
```
You will get
```text
my_doc
├── assets
│ ├── pylit.css
│ └── solarized.css
└── index.html
```
#### Help Information
* `python -m ditk.doc.annotated --help`
```text
Usage: python -m ditk.doc.annotated [OPTIONS] COMMAND [ARGS]...
Utils for creating annotation documentation.
Options:
-v, --version Show version information.
-h, --help Show this message and exit.
Commands:
create Utils for creating annotation documentation from local code.
```
* `python -m ditk.doc.annotated create --help`
```text
Usage: python -m ditk.doc.annotated create [OPTIONS]
Utils for creating annotation documentation from local code.
Options:
-i, --input_file FILE Input source code. [required]
-o, --output_file FILE Output annotated documentation code. [required]
-A, --assets_dir DIRECTORY Directory for assets file of this documentation.
-L, --language [zh|en] Language for documentation. [default: en]
-T, --title TEXT Title of the documentation. [default: <Untitled
Documentation>]
-h, --help Show this message and exit.
```
#### Related Library
- [KaTex](https://github.com/KaTeX/KaTeX)
- [codemirror5](https://github.com/codemirror/codemirror5)
- [yattag](https://www.yattag.org/)
### Create Multi-Seed Multi-Algorithm Benchmark Plots
```python
import matplotlib.pyplot as plt
import seaborn as sns
from ditk.tensorboard.plots import tb_create_range_plots
sns.set()
tb_create_range_plots(
'test/testfile/pong_tb', # directory of tensorboard log
xname='step',
yname='evaluator_step/reward_mean',
)
plt.show()
```

## Contributing
We appreciate all contributions to improve `DI-toolkit`, both logic and system designs. Please refer to CONTRIBUTING.md
for more guides.
## License
`DI-toolkit` released under the Apache 2.0 license.
Raw data
{
"_id": null,
"home_page": "https://github.com/opendilab/DI-toolkit",
"name": "DI-toolkit",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "",
"keywords": "A simple tool for automatic parameter tuning.",
"author": "HansBug",
"author_email": "hansbug@buaa.edu.cn",
"download_url": "https://files.pythonhosted.org/packages/b6/12/cbb41a1f7673c8d8623e4b2452a7d2ee148f22205de97d84d46e9bca299e/DI-toolkit-0.2.1.tar.gz",
"platform": null,
"description": "# DI-toolkit\n\n[](https://pypi.org/project/DI-toolkit/)\n\n\n\n\n[](https://github.com/opendilab/DI-toolkit/actions?query=workflow%3A%22Docs+Deploy%22)\n[](https://github.com/opendilab/DI-toolkit/actions?query=workflow%3A%22Code+Test%22)\n[](https://github.com/opendilab/DI-toolkit/actions?query=workflow%3A%22Badge+Creation%22)\n[](https://github.com/opendilab/DI-toolkit/actions?query=workflow%3A%22Package+Release%22)\n[](https://codecov.io/gh/opendilab/DI-toolkit)\n\n[](https://github.com/opendilab/DI-toolkit/stargazers)\n[](https://github.com/opendilab/DI-toolkit/network)\n\n[](https://github.com/opendilab/DI-toolkit/issues)\n[](https://github.com/opendilab/DI-toolkit/pulls)\n[](https://github.com/opendilab/DI-toolkit/graphs/contributors)\n[](https://github.com/opendilab/DI-toolkit/blob/master/LICENSE)\n\nA simple toolkit package for opendilab, including the following utilities:\n\n- `ditk.logging`, a easy-to-use logger system\n- `ditk.annonated`, an annotated documentation generation script\n- `ditk.tensorboard`, a utility for extract data from tensorboard log file\n - `ditk.tensorboard.plot`, plot utilities for plotting data extracted from tensorboard log file\n\n## Installation\n\nYou can simply install it with `pip` command line from the official PyPI site.\n\n```shell\npip install DI-toolkit\n```\n\nOr installing from the latest source code as follows:\n\n```shell\ngit clone https://github.com/opendilab/DI-toolkit.git\ncd di-toolkit\npip install . --user\n```\n\n## Quick Start\n\n### Example of ditk.logging\n\nHere is an example of logging.\n\n```python\nfrom ditk import logging\n\nif __name__ == '__main__':\n logging.try_init_root(logging.INFO)\n logging.info('This is info')\n logging.warning('This is warning with integer 233')\n logging.error('This is a error with string \\'233\\'.')\n\n try:\n _ = 1 / 0\n except ZeroDivisionError as err:\n logging.exception(err)\n\n```\n\n`ditk.logging`has almost the same interface as native `logging` module. You can directly replace `import logging` in the\ncode with `from ditk import logging`.\n\n### ditk.annonated\n\nPython annotated documentation generation script like the following\n\n\n\n#### Usage\n\n```shell\npython -m ditk.doc.annotated create -i ditk/doc/annotated/ppo.py -o my_doc/index.html -L zh\n```\n\nYou will get\n\n```text\nmy_doc\n\u251c\u2500\u2500 assets\n\u2502 \u251c\u2500\u2500 pylit.css\n\u2502 \u2514\u2500\u2500 solarized.css\n\u2514\u2500\u2500 index.html\n```\n\n#### Help Information\n\n* `python -m ditk.doc.annotated --help`\n\n```text\nUsage: python -m ditk.doc.annotated [OPTIONS] COMMAND [ARGS]...\n\n Utils for creating annotation documentation.\n\nOptions:\n -v, --version Show version information.\n -h, --help Show this message and exit.\n\nCommands:\n create Utils for creating annotation documentation from local code.\n```\n\n* `python -m ditk.doc.annotated create --help`\n\n```text\nUsage: python -m ditk.doc.annotated create [OPTIONS]\n\n Utils for creating annotation documentation from local code.\n\nOptions:\n -i, --input_file FILE Input source code. [required]\n -o, --output_file FILE Output annotated documentation code. [required]\n -A, --assets_dir DIRECTORY Directory for assets file of this documentation.\n -L, --language [zh|en] Language for documentation. [default: en]\n -T, --title TEXT Title of the documentation. [default: <Untitled\n Documentation>]\n -h, --help Show this message and exit.\n```\n\n#### Related Library\n\n- [KaTex](https://github.com/KaTeX/KaTeX)\n- [codemirror5](https://github.com/codemirror/codemirror5)\n- [yattag](https://www.yattag.org/)\n\n### Create Multi-Seed Multi-Algorithm Benchmark Plots\n\n```python\nimport matplotlib.pyplot as plt\nimport seaborn as sns\n\nfrom ditk.tensorboard.plots import tb_create_range_plots\n\nsns.set()\n\ntb_create_range_plots(\n 'test/testfile/pong_tb', # directory of tensorboard log\n xname='step',\n yname='evaluator_step/reward_mean',\n)\n\nplt.show()\n```\n\n\n\n## Contributing\n\nWe appreciate all contributions to improve `DI-toolkit`, both logic and system designs. Please refer to CONTRIBUTING.md\nfor more guides.\n\n## License\n\n`DI-toolkit` released under the Apache 2.0 license.\n",
"bugtrack_url": null,
"license": "Apache License, Version 2.0",
"summary": "A simple tool for opendilab.",
"version": "0.2.1",
"project_urls": {
"Homepage": "https://github.com/opendilab/DI-toolkit"
},
"split_keywords": [
"a",
"simple",
"tool",
"for",
"automatic",
"parameter",
"tuning."
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "971294245389c1e4a4dafe05119a1c2cb24f8f56dcf2a903a3b8cc6b157f2f17",
"md5": "8bcf74b6e70a8dfffe0edddd740a1847",
"sha256": "a026c4539a80d7c521685204d73e87155e2d41f512651b672a8b94a937961288"
},
"downloads": -1,
"filename": "DI_toolkit-0.2.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "8bcf74b6e70a8dfffe0edddd740a1847",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 29154,
"upload_time": "2024-01-17T12:37:48",
"upload_time_iso_8601": "2024-01-17T12:37:48.425134Z",
"url": "https://files.pythonhosted.org/packages/97/12/94245389c1e4a4dafe05119a1c2cb24f8f56dcf2a903a3b8cc6b157f2f17/DI_toolkit-0.2.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "b612cbb41a1f7673c8d8623e4b2452a7d2ee148f22205de97d84d46e9bca299e",
"md5": "5e87559e6848e5597d44cc1a234ea0ba",
"sha256": "e5cc656d4b343963f95e2ab2ad12914ed93fc6c47617bdbb3f04af46634f0ae8"
},
"downloads": -1,
"filename": "DI-toolkit-0.2.1.tar.gz",
"has_sig": false,
"md5_digest": "5e87559e6848e5597d44cc1a234ea0ba",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 28142,
"upload_time": "2024-01-17T12:37:50",
"upload_time_iso_8601": "2024-01-17T12:37:50.214743Z",
"url": "https://files.pythonhosted.org/packages/b6/12/cbb41a1f7673c8d8623e4b2452a7d2ee148f22205de97d84d46e9bca299e/DI-toolkit-0.2.1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-01-17 12:37:50",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "opendilab",
"github_project": "DI-toolkit",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"requirements": [
{
"name": "hbutils",
"specs": [
[
">=",
"0.9.1"
]
]
},
{
"name": "rich",
"specs": [
[
">=",
"12.2.0"
]
]
},
{
"name": "yattag",
"specs": [
[
">=",
"1.14.0"
]
]
},
{
"name": "click",
"specs": [
[
">=",
"7.0.0"
]
]
},
{
"name": "pandas",
"specs": []
},
{
"name": "tensorboard",
"specs": []
},
{
"name": "tqdm",
"specs": []
},
{
"name": "scipy",
"specs": []
},
{
"name": "scikit-learn",
"specs": []
},
{
"name": "seaborn",
"specs": []
},
{
"name": "matplotlib",
"specs": []
}
],
"lcname": "di-toolkit"
}