Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/prahladyeri/cfgsaver

Module to save and fetch configuration data in a standard path and format
https://github.com/prahladyeri/cfgsaver

configuration configuration-management devops python

Last synced: 3 months ago
JSON representation

Module to save and fetch configuration data in a standard path and format

Awesome Lists containing this project

README

        

![pypi](https://img.shields.io/pypi/v/cfgsaver.svg)
![python](https://img.shields.io/pypi/pyversions/cfgsaver.svg)
![license](https://img.shields.io/github/license/prahladyeri/cfgsaver.svg)
![docs](https://readthedocs.org/projects/cfgsaver/badge/?version=latest)
[![patreon](https://img.shields.io/badge/Patreon-brown.svg?logo=patreon)](https://www.patreon.com/prahladyeri)
[![paypal](https://img.shields.io/badge/PayPal-blue.svg?logo=paypal)](https://paypal.me/prahladyeri)
[![follow](https://img.shields.io/twitter/follow/prahladyeri.svg?style=social)](https://twitter.com/prahladyeri)

# cfgsaver

![project logo](https://raw.githubusercontent.com/prahladyeri/cfgsaver/master/logo.png)

Python library to save and fetch configuration data in a standard/conventional path and format.

# Installation

```bash
pip install cfgsaver
```

# Usage

Import the `cfgsaver` module to save/read configuration values in your source files:

```python
from cfgsaver import cfgsaver

def save_config():
# saves configuration data to ~/.config//cfg.json
# unless cfgpath parameter is overridden:
config = {
'name': 'Prahlad',
'language': 'Python',
'framework': 'Flask'
}
cfgsaver.save('', config)

def get_config():
# gets configuration data from ~/.config//cfg.json
# unless cfgpath parameter is overridden:
config = cfgsaver.get("") #returns None if config file doesn't exist

def prompt_user():
# prompts user for config keys and saves resulting values as per save_config()
config = {
'name': '',
'language': '',
'framework': ''
}
config = cfgsaver.get_from_cmd("", config.keys())
```

For information on shipping default configuration data packaged with your app using `setup.py`, read [detailed docs](https://cfgsaver.readthedocs.io/en/latest/).

# Documentation

Detailed docs are available at .

# Attribution

Icons made by Smashicons from www.flaticon.com is licensed by CC 3.0 BY