Skip to main content

Safitty. Wrapper on JSON/YAML configs for Python.

Project description

Safitty logo

Build Status Pypi version Downloads Github contributors License

Telegram Gitter Slack Donate

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


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 hashes)

Uploaded Source

Built Distribution

safitty-1.3-py3-none-any.whl (11.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page