{"id":19287173,"url":"https://github.com/opendilab/di-toolkit","last_synced_at":"2025-04-07T15:07:57.964Z","repository":{"id":63507231,"uuid":"562391313","full_name":"opendilab/DI-toolkit","owner":"opendilab","description":"A simple toolkit package for opendilab","archived":false,"fork":false,"pushed_at":"2024-01-17T12:37:33.000Z","size":9385,"stargazers_count":116,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-03-31T12:06:49.723Z","etag":null,"topics":["python","toolkit"],"latest_commit_sha":null,"homepage":"https://opendilab.github.io/DI-toolkit/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/opendilab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-11-06T07:45:03.000Z","updated_at":"2024-12-01T05:50:45.000Z","dependencies_parsed_at":"2024-06-18T21:53:12.591Z","dependency_job_id":null,"html_url":"https://github.com/opendilab/DI-toolkit","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opendilab%2FDI-toolkit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opendilab%2FDI-toolkit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opendilab%2FDI-toolkit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opendilab%2FDI-toolkit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/opendilab","download_url":"https://codeload.github.com/opendilab/DI-toolkit/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247675597,"owners_count":20977376,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["python","toolkit"],"created_at":"2024-11-09T22:05:35.923Z","updated_at":"2025-04-07T15:07:57.930Z","avatar_url":"https://github.com/opendilab.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DI-toolkit\n\n[![PyPI](https://img.shields.io/pypi/v/DI-toolkit)](https://pypi.org/project/DI-toolkit/)\n![PyPI - Python Version](https://img.shields.io/pypi/pyversions/DI-toolkit)\n![Loc](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/HansBug/82e5c38227081da9d25e729e5bd3b5b8/raw/loc.json)\n![Comments](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/HansBug/82e5c38227081da9d25e729e5bd3b5b8/raw/comments.json)\n\n[![Docs Deploy](https://github.com/opendilab/DI-toolkit/workflows/Docs%20Deploy/badge.svg)](https://github.com/opendilab/DI-toolkit/actions?query=workflow%3A%22Docs+Deploy%22)\n[![Code Test](https://github.com/opendilab/DI-toolkit/workflows/Code%20Test/badge.svg)](https://github.com/opendilab/DI-toolkit/actions?query=workflow%3A%22Code+Test%22)\n[![Badge Creation](https://github.com/opendilab/DI-toolkit/workflows/Badge%20Creation/badge.svg)](https://github.com/opendilab/DI-toolkit/actions?query=workflow%3A%22Badge+Creation%22)\n[![Package Release](https://github.com/opendilab/DI-toolkit/workflows/Package%20Release/badge.svg)](https://github.com/opendilab/DI-toolkit/actions?query=workflow%3A%22Package+Release%22)\n[![codecov](https://codecov.io/gh/opendilab/DI-toolkit/branch/main/graph/badge.svg?token=XJVDP4EFAT)](https://codecov.io/gh/opendilab/DI-toolkit)\n\n[![GitHub stars](https://img.shields.io/github/stars/opendilab/DI-toolkit)](https://github.com/opendilab/DI-toolkit/stargazers)\n[![GitHub forks](https://img.shields.io/github/forks/opendilab/DI-toolkit)](https://github.com/opendilab/DI-toolkit/network)\n![GitHub commit activity](https://img.shields.io/github/commit-activity/m/opendilab/DI-toolkit)\n[![GitHub issues](https://img.shields.io/github/issues/opendilab/DI-toolkit)](https://github.com/opendilab/DI-toolkit/issues)\n[![GitHub pulls](https://img.shields.io/github/issues-pr/opendilab/DI-toolkit)](https://github.com/opendilab/DI-toolkit/pulls)\n[![Contributors](https://img.shields.io/github/contributors/opendilab/DI-toolkit)](https://github.com/opendilab/DI-toolkit/graphs/contributors)\n[![GitHub license](https://img.shields.io/github/license/opendilab/DI-toolkit)](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![](./assets/ditk_doc_annotated_demo.png)\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├── assets\n│   ├── pylit.css\n│   └── solarized.css\n└── 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: \u003cUntitled\n                              Documentation\u003e]\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![tb_create_range_plots](docs/source/_static/tb_create_range_plots.svg)\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","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopendilab%2Fdi-toolkit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopendilab%2Fdi-toolkit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopendilab%2Fdi-toolkit/lists"}