Safitty. Wrapper on JSON/YAML configs for Python.
Project description
Safitty
Safitty is a wrapper on JSON/YAML configs for Python.
Designed with a focus on the safe get
/set
operations for deep-nested dictionaries and lists.
Installation
pip install -U safitty
Features
- Safe
get
for dictionaries and lists - Safe
set
for dictionaries and lists - Multiple keys at one
getter
/setter
call. - Several strategies, includes: Get the most deep non-null value by your keys, Get the last non-null container and more
- Value transformations to classes
Quickstart
import safitty
# Loads config YAML or JSON
config = safitty.load_config("/path/to/config.yml")
# If there is no specific key for `config` dict it returns the `default`
safitty.safe_get(config, "very", "deep", "call", default="This is the default value")
safitty.safe_set(config, "clients", 0, "address", value="localhost:8888")
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
safitty-0.7.tar.gz
(7.0 kB
view hashes)
Built Distribution
safitty-0.7-py3-none-any.whl
(8.6 kB
view hashes)