Skip to main content

Easy Configuration

Project description

ezkfg

Easy Configuration

Installation

pip install ezkfg

Usage

Basic Usage

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

    config.dump('config.json')
    config.load('config.json')

Advanced Usage


Acknowledgements

This project is inspired by the addict and mmdetection.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ezkfg-0.0.1a2.tar.gz (8.1 kB view hashes)

Uploaded Source

Built Distribution

ezkfg-0.0.1a2-py3-none-any.whl (10.7 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page