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
get
/set
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("/path/to/config.yml")
# Getting value from the config
safitty.get(config, "very", "deep", "call", default="This is the default value")
# Setting value into
safitty.set(config, "clients", 0, "address", value="localhost:8888")
More examples in the getting-started notebook.
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.9.8.1.tar.gz
(7.9 kB
view hashes)
Built Distribution
Close
Hashes for safitty-0.9.8.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1a71412f911a90c2f701357f387e28d5508886391c511919b47c7083ab415d44 |
|
MD5 | d542d31a2a44e9ba0a05d6423595e214 |
|
BLAKE2b-256 | 3ffe1e88c3e58e800c70262c583e351c1b2157db0ea79b8cae45ad709a37c690 |