Metadata-Version: 2.1
Name: configchain
Version: 0.3.8
Summary: hierarchical configuration
Home-page: https://github.com/lotreal/configchain
Author: Luo Tao
Author-email: lotreal@gmail.com
License: UNKNOWN
Platform: UNKNOWN
Classifier: License :: OSI Approved :: MIT License
Classifier: Development Status :: 4 - Beta
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Operating System :: POSIX :: Linux
Classifier: Operating System :: MacOS
Classifier: Operating System :: Microsoft :: Windows
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.6
Description-Content-Type: text/markdown

# ConfigChain
![Latest PyPI version](https://img.shields.io/pypi/v/configchain.svg)

The key feature of ConfigChain, is the ability to dynamically create a hierarchical configuration by composition and override it through config files and the command line. 

- Installation : `pip install configchain --upgrade`

### Usage

`````python
from configchain import configchain

cs = configchain("./tests/asset/a.yaml", "./tests/asset/b.yaml", name="app-${app}", profile="profile")
print(cs)

... ConfigSet([('app-hello',
            Config([('*',
                     ConfigSnippet([('by', 'tao'),
                                    ('env', ['ENV=${profile}', 'PROCESSES=32']),
                                    ('at', 'aws'),
                                    ('app', 'hello')])),
                    ('test',
                     ConfigSnippet([('by', 'tao'),
                                    ('env',
                                     ['ENV=${profile}',
                                      'PROCESSES=32',
                                      'PROCESSES=1']),
                                    ('at', 'docker'),
                                    ('profile', 'test'),
                                    ('app', 'hello')]))])),
           ('*',
            Config([('*',
                     ConfigSnippet([('by', 'luo'),
                                    ('env', ['ENV=${profile}']),
                                    ('at', 'aws')])),
                    ('test',
                     ConfigSnippet([('by', 'luo'),
                                    ('env', ['ENV=${profile}']),
                                    ('at', 'docker'),
                                    ('profile', 'test')]))]))])
`````

a.yaml

```yaml
by: luo
env:
  - ENV=${profile}
at: aws

---
profile: test
at: docker
```

b.yaml

```yaml
app: hello
by: tao
env:
  - PROCESSES=32

---
profile: test
env:
  - PROCESSES=1
```

### License

ConfigChain is licensed under [MIT License](LICENSE).

