Metadata-Version: 2.1
Name: multiconfparse
Version: 0.0.1
Summary: Parser for configuration from multiple sources
Home-page: https://github.com/jonathanhaigh/multiconfparse
Author: Jonathan Haigh
Author-email: jonathanhaigh@gmail.com
License: MIT
Keywords: config configuration
Platform: UNKNOWN
Classifier: Development Status :: 2 - Pre-Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Topic :: Software Development :: Libraries
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: ~=3.6
Description-Content-Type: text/markdown

<!--
Copyright 2020 Jonathan Haigh <jonathanhaigh@gmail.com>
SPDX-License-Identifier: MIT
-->
# `multiconfparse`

`multiconfparse` is a Python3 library for specifying and reading configuration
data from multiple sources.

## Installation

```shell
python -m pip install git+https://github.com/jonathanhaigh/multiconfparse
```

## Quickstart

1. Import the `multiconfparse` module:
   ```python
   import multiconfparse.multiconfparse as mcp
   ```

1. Create a `ConfigParser` object:
   ```python
   import multiconfparse.multiconfparse as mcp

   config_parser = mcp.ConfigParser()
   ```
   `ConfigParser`s:
   * contain the specifications of your configuration items;
   * have `source`s - objects that can obtain configuration values from
     different sources;
   * coordinate the parsing done by `source`s;
   * merge configuration values from `source`s into a single set of values.

1. Add specifications of your config items:
   ```python
   # Add config items
   config_parser.add_config("config_item1", required=True)
   config_parser.add_config("config_item2", default="default_value")
   ```

1. Add `source`s:
   ```python
    config_parser.add_source(mcp.SimpleArgparseSource)
    config_parser.add_source(mcp.JsonSource, "/path/to/config/file.json")
    ```

1. Parse config from all `source`s:
    ```python
    config = config_parser.parse_config()
    ```
    `ConfigParser.parse_config()` returns a `multiconfparse.Namespace` object
    which is essentially just a plain object with attributes for each config
    item.

1. Use the config
   ```python
   item1 = config.config_item1
   item2 = config.config_item2
   ```


