ezkfg


Nameezkfg JSON
Version 0.0.1 PyPI version JSON
download
home_pagehttp://github.com/beiyuouo/ezkfg
SummaryEasy Configuration
upload_time2022-05-14 18:37:21
maintainer
docs_urlNone
authorBingjie Yan
requires_python>=3.6
licenseApache-2.0 License
keywords configuration config
VCS
bugtrack_url
requirements PyYAML
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # ezkfg

Easy Configuration

## Installation

```bash
pip install ezkfg
```

## Usage

### Basic Usage

```python
from ezkfg import Config

if __name__ == '__main__':
    config = Config()
    config = Config({"a": 1, "b": {"c": 2}, "z.y.x": 233})
    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.f["i.j.k"].l = 6
    assert config.f["i.j.k"].l == 6
    assert config.f.i.j.k.l == 6
    assert config["f.i.j.k.l"] == 6

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

    config.g["123.456.789"] = 8
    assert config.g["123.456.789"] == 8

    config["g.111.222.333"] = 9
    assert config.g["111.222.333"] == 9
    assert config.get("g.111.222.333") == 9
    assert config.get("g.111.222.333.544", "default") == "default"

    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')
```

### Advanced Usage

```python

```

## Acknowledgements

This project is inspired by the [addict](https://github.com/mewwts/addict) 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/3a/db/f722ee6bacc3de6f971ab4b65a5472d4e273da67619e23376d24fd645c61/ezkfg-0.0.1.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\nfrom ezkfg import Config\n\nif __name__ == '__main__':\n    config = Config()\n    config = Config({\"a\": 1, \"b\": {\"c\": 2}, \"z.y.x\": 233})\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.f[\"i.j.k\"].l = 6\n    assert config.f[\"i.j.k\"].l == 6\n    assert config.f.i.j.k.l == 6\n    assert config[\"f.i.j.k.l\"] == 6\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.g[\"123.456.789\"] = 8\n    assert config.g[\"123.456.789\"] == 8\n\n    config[\"g.111.222.333\"] = 9\n    assert config.g[\"111.222.333\"] == 9\n    assert config.get(\"g.111.222.333\") == 9\n    assert config.get(\"g.111.222.333.544\", \"default\") == \"default\"\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\n### Advanced Usage\n\n```python\n\n```\n\n## Acknowledgements\n\nThis project is inspired by the [addict](https://github.com/mewwts/addict) and [mmdetection](https://github.com/open-mmlab/mmdetection).\n",
    "bugtrack_url": null,
    "license": "Apache-2.0 License",
    "summary": "Easy Configuration",
    "version": "0.0.1",
    "split_keywords": [
        "configuration",
        "config"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "md5": "3d8ea595a66f6bc05cdb2728e7bc1597",
                "sha256": "082e4e7e206abe7054f6e55644300e2ace5d143e62672da5c5904f746c95b068"
            },
            "downloads": -1,
            "filename": "ezkfg-0.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "3d8ea595a66f6bc05cdb2728e7bc1597",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.6",
            "size": 11430,
            "upload_time": "2022-05-14T18:37:20",
            "upload_time_iso_8601": "2022-05-14T18:37:20.228008Z",
            "url": "https://files.pythonhosted.org/packages/4b/d1/8d68a1a9239d49e5a47ff45aee15a5856b06b4a30a366bb248004832d56a/ezkfg-0.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "md5": "1f78e5fdd1ca61a57cd692f420ee33ca",
                "sha256": "080a3051a7c739d205f01b5ec729aef4b7095bfab63285e0c47e4904d2bcaed3"
            },
            "downloads": -1,
            "filename": "ezkfg-0.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "1f78e5fdd1ca61a57cd692f420ee33ca",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 9297,
            "upload_time": "2022-05-14T18:37:21",
            "upload_time_iso_8601": "2022-05-14T18:37:21.722211Z",
            "url": "https://files.pythonhosted.org/packages/3a/db/f722ee6bacc3de6f971ab4b65a5472d4e273da67619e23376d24fd645c61/ezkfg-0.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2022-05-14 18:37:21",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "beiyuouo",
    "github_project": "ezkfg",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "PyYAML",
            "specs": []
        }
    ],
    "lcname": "ezkfg"
}
        
Elapsed time: 0.34659s