DI-toolkit


NameDI-toolkit JSON
Version 0.2.1 PyPI version JSON
download
home_pagehttps://github.com/opendilab/DI-toolkit
SummaryA simple tool for opendilab.
upload_time2024-01-17 12:37:50
maintainer
docs_urlNone
authorHansBug
requires_python>=3.6
licenseApache License, Version 2.0
keywords a simple tool for automatic parameter tuning.
VCS
bugtrack_url
requirements hbutils rich yattag click pandas tensorboard tqdm scipy scikit-learn seaborn matplotlib
Travis-CI No Travis.
coveralls test coverage
            # DI-toolkit

[![PyPI](https://img.shields.io/pypi/v/DI-toolkit)](https://pypi.org/project/DI-toolkit/)
![PyPI - Python Version](https://img.shields.io/pypi/pyversions/DI-toolkit)
![Loc](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/HansBug/82e5c38227081da9d25e729e5bd3b5b8/raw/loc.json)
![Comments](https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/HansBug/82e5c38227081da9d25e729e5bd3b5b8/raw/comments.json)

[![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)
[![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)
[![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)
[![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)
[![codecov](https://codecov.io/gh/opendilab/DI-toolkit/branch/main/graph/badge.svg?token=XJVDP4EFAT)](https://codecov.io/gh/opendilab/DI-toolkit)

[![GitHub stars](https://img.shields.io/github/stars/opendilab/DI-toolkit)](https://github.com/opendilab/DI-toolkit/stargazers)
[![GitHub forks](https://img.shields.io/github/forks/opendilab/DI-toolkit)](https://github.com/opendilab/DI-toolkit/network)
![GitHub commit activity](https://img.shields.io/github/commit-activity/m/opendilab/DI-toolkit)
[![GitHub issues](https://img.shields.io/github/issues/opendilab/DI-toolkit)](https://github.com/opendilab/DI-toolkit/issues)
[![GitHub pulls](https://img.shields.io/github/issues-pr/opendilab/DI-toolkit)](https://github.com/opendilab/DI-toolkit/pulls)
[![Contributors](https://img.shields.io/github/contributors/opendilab/DI-toolkit)](https://github.com/opendilab/DI-toolkit/graphs/contributors)
[![GitHub license](https://img.shields.io/github/license/opendilab/DI-toolkit)](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

![](./assets/ditk_doc_annotated_demo.png)

#### 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()
```

![tb_create_range_plots](docs/source/_static/tb_create_range_plots.svg)

## 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[![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\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![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",
    "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"
}
        
Elapsed time: 0.16875s