Safitty. Wrapper on JSON/YAML configs for Python.
Project description
Safitty is a wrapper on JSON/YAML
configs for Python.
Designed with a focus on safe data reading and writing 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-1.3.tar.gz
(9.6 kB
view details)
Built Distribution
safitty-1.3-py3-none-any.whl
(11.4 kB
view details)
File details
Details for the file safitty-1.3.tar.gz
.
File metadata
- Download URL: safitty-1.3.tar.gz
- Upload date:
- Size: 9.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ab5a6e1931e2dea4fa4222d16d97691a005055ac1385b535c2cd30e39940b892 |
|
MD5 | 17d02258e66c59e35a19e9fbdfe7b0b6 |
|
BLAKE2b-256 | 9ce5f8eb5ec0000b91c0ea11b3bedba35e0993bce23711918b37a3bd3d8bc5a4 |
File details
Details for the file safitty-1.3-py3-none-any.whl
.
File metadata
- Download URL: safitty-1.3-py3-none-any.whl
- Upload date:
- Size: 11.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.6.7
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | df35a3f60869e407d35c948542a5b8b2c037c97462c1da99aac3fcce1877afb1 |
|
MD5 | 1e354ce3c964da0d89b1d319512f3203 |
|
BLAKE2b-256 | 37ea51fedb7c8802b09d557a04db13661939bb483f40e1450958961ce50f15d6 |