Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/singulared/conflow
Python configuration manager
https://github.com/singulared/conflow
configuration configuration-management library mypy python3
Last synced: 3 months ago
JSON representation
Python configuration manager
- Host: GitHub
- URL: https://github.com/singulared/conflow
- Owner: singulared
- License: mit
- Created: 2018-01-16T15:51:20.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2021-02-23T17:41:03.000Z (almost 4 years ago)
- Last Synced: 2024-09-29T09:10:44.569Z (4 months ago)
- Topics: configuration, configuration-management, library, mypy, python3
- Language: Python
- Size: 190 KB
- Stars: 8
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.rst
- License: LICENSE
Awesome Lists containing this project
README
=======
Conflow
=======.. image:: https://travis-ci.org/singulared/conflow.svg?branch=master
:target: https://travis-ci.org/singulared/conflow
.. image:: https://codecov.io/gh/singulared/conflow/branch/master/graph/badge.svg
:target: https://codecov.io/gh/singulared/conflowConflow organizes layered configurations for Python applications.
Conflow allows you to use default settings and extend or override it
via merging settings from different sources:
- Python dictionaries
- Files: yaml, json, ini
- Environment variablesQuickstart
==========.. code-block:: bash
pip install conflow
Usage
=====.. code-block:: python
import os
from conflow import Config, from_env, from_yamlDEFAULT_SETTINGS = {
'db': {
'master': {
'host': 'localhost',
'port': 5432,
},
'slave': {
'host': 'localhost',
'port': 5433,
}
}
}config = Config().merge(DEFAULT_SETTINGS)
assert config.db.master.host() == 'localhost'os.environ['APP_DB__MASTER__HOST'] = 'remote_host'
env_settings = from_env('APP')config = Config().merge(DEFAULT_SETTINGS).merge(env_settings)
assert config.db.master.host() == 'remote_host'develop_settings = from_yaml('config/develop.yaml', required=False)
config = Config().merge(DEFAULT_SETTINGS).merge(env_settings).merge(develop_settings)
assert config.db.master.host() == 'develop'Motivation
==========
If you are tired of making local, test, stage and production profiles in each project, then Conflow is for you.
Conflow allows you to fetch and merge configs from different places - yaml files, environment variables etc.