ezkfg


Nameezkfg JSON
Version 0.1.2 PyPI version JSON
download
home_pagehttp://github.com/beiyuouo/ezkfg
SummaryEasy Configuration
upload_time2023-09-12 02:35:59
maintainer
docs_urlNone
authorBingjie Yan
requires_python>=3.6
licenseApache-2.0 License
keywords configuration config
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # ezkfg

Easy Configuration

## Installation

```bash
pip install ezkfg
```

## Usage

### Basic Usage

```python
import ezkfg as ez
from ezkfg import Config

if __name__ == '__main__':
    config = Config({"a": 1, "b": {"c": 2}, "z.y.x": 233})  # or ez.load("xxx")
    assert config.a == 1
    assert config.b.c == 2
    assert config.z.y.x == 233

    config.a = 3
    assert config.a == 3

    config["d.e.f"] = 3
    assert config["d.e.f"] == 3
    assert config.d.e.f == 3

    config["e.f.g.h"] = 4
    assert config.e.f.g.h == 4
    assert config["e.f.g.h"] == 4

    config.e["h.i.j"] = 5
    assert config.e["h.i.j"] == 5
    assert config.e.h.i.j == 5
    assert config["e.h.i.j"] == 5

    config["g.h.i.j"] = 7
    assert config.g.h.i.j == 7
    assert config["g.h.i.j"] == 7

    config.load(["--model=resnet18", "--batch-size=32", "--lr=0.01"])
    assert config.model == "resnet18"
    assert config.batch_size == "32"
    assert config.lr == "0.01"

    config.dump('config.json')  # support json, yaml, py, ini
    config.load('config.json')
```

You can find more examples in [tests](https://github.com/beiyuouo/ezkfg/tree/main/tests).

### Advanced Usage

```python

```

## Acknowledgements

This project is inspired by the [addict](https://github.com/mewwts/addict), [CHANfiG](https://github.com/ZhiyuanChen/CHANfiG) and [mmdetection](https://github.com/open-mmlab/mmdetection).

            

Raw data

            {
    "_id": null,
    "home_page": "http://github.com/beiyuouo/ezkfg",
    "name": "ezkfg",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "configuration,config",
    "author": "Bingjie Yan",
    "author_email": "bj.yan.pa@qq.com",
    "download_url": "https://files.pythonhosted.org/packages/ec/1f/db070224587f0885a8dd216ac6f22678310adf6d03287861a1e84b68b263/ezkfg-0.1.2.tar.gz",
    "platform": null,
    "description": "# ezkfg\n\nEasy Configuration\n\n## Installation\n\n```bash\npip install ezkfg\n```\n\n## Usage\n\n### Basic Usage\n\n```python\nimport ezkfg as ez\nfrom ezkfg import Config\n\nif __name__ == '__main__':\n    config = Config({\"a\": 1, \"b\": {\"c\": 2}, \"z.y.x\": 233})  # or ez.load(\"xxx\")\n    assert config.a == 1\n    assert config.b.c == 2\n    assert config.z.y.x == 233\n\n    config.a = 3\n    assert config.a == 3\n\n    config[\"d.e.f\"] = 3\n    assert config[\"d.e.f\"] == 3\n    assert config.d.e.f == 3\n\n    config[\"e.f.g.h\"] = 4\n    assert config.e.f.g.h == 4\n    assert config[\"e.f.g.h\"] == 4\n\n    config.e[\"h.i.j\"] = 5\n    assert config.e[\"h.i.j\"] == 5\n    assert config.e.h.i.j == 5\n    assert config[\"e.h.i.j\"] == 5\n\n    config[\"g.h.i.j\"] = 7\n    assert config.g.h.i.j == 7\n    assert config[\"g.h.i.j\"] == 7\n\n    config.load([\"--model=resnet18\", \"--batch-size=32\", \"--lr=0.01\"])\n    assert config.model == \"resnet18\"\n    assert config.batch_size == \"32\"\n    assert config.lr == \"0.01\"\n\n    config.dump('config.json')  # support json, yaml, py, ini\n    config.load('config.json')\n```\n\nYou can find more examples in [tests](https://github.com/beiyuouo/ezkfg/tree/main/tests).\n\n### Advanced Usage\n\n```python\n\n```\n\n## Acknowledgements\n\nThis project is inspired by the [addict](https://github.com/mewwts/addict), [CHANfiG](https://github.com/ZhiyuanChen/CHANfiG) and [mmdetection](https://github.com/open-mmlab/mmdetection).\n",
    "bugtrack_url": null,
    "license": "Apache-2.0 License",
    "summary": "Easy Configuration",
    "version": "0.1.2",
    "project_urls": {
        "Homepage": "http://github.com/beiyuouo/ezkfg"
    },
    "split_keywords": [
        "configuration",
        "config"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b57438387419ef624948cbea3705eb06cd8533ac92787117025ea7e714cabd3d",
                "md5": "fbdff136569a5dcc190717c8bada1f49",
                "sha256": "5b980bf0d546e82008878604138b9ec37c31856a72f67b09fb4011f1271410cb"
            },
            "downloads": -1,
            "filename": "ezkfg-0.1.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "fbdff136569a5dcc190717c8bada1f49",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 12013,
            "upload_time": "2023-09-12T02:35:57",
            "upload_time_iso_8601": "2023-09-12T02:35:57.465016Z",
            "url": "https://files.pythonhosted.org/packages/b5/74/38387419ef624948cbea3705eb06cd8533ac92787117025ea7e714cabd3d/ezkfg-0.1.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ec1fdb070224587f0885a8dd216ac6f22678310adf6d03287861a1e84b68b263",
                "md5": "90b3421acfe5463604e05907c4891816",
                "sha256": "563fd1ebc160590741dcef95141c745499068bda3fb82cc5bafae4c9422fe4b0"
            },
            "downloads": -1,
            "filename": "ezkfg-0.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "90b3421acfe5463604e05907c4891816",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 11079,
            "upload_time": "2023-09-12T02:35:59",
            "upload_time_iso_8601": "2023-09-12T02:35:59.052597Z",
            "url": "https://files.pythonhosted.org/packages/ec/1f/db070224587f0885a8dd216ac6f22678310adf6d03287861a1e84b68b263/ezkfg-0.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-09-12 02:35:59",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "beiyuouo",
    "github_project": "ezkfg",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "ezkfg"
}
        
Elapsed time: 0.14984s