Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

Library for handling variable resolution in scalars found within strings and “tree”-like data such as dict (internally), JSON/YAML content.

Overview

This is to support YAML settings files that may have embedded variable references in scalar values that reference keys found within the same, or other content.

ROOT_DIR: "/var/log/my_project"

LOG_FILENAME: "!ROOT_DIR!/my_log_file.log"

The use-cases for this include:

  • Reducing redundancy in YAML data

  • Support for “local overrides” to replace some data at run-time

  • Support for tests where the content is changed (overloaded) for unit tests

Features

This library provides a number of features including:

  • A TreeData class for easily loading files from JSON/YAML or from native dict objects

  • Visitor base classes for inspecting/manipulating the tree data

  • Support for specifying primary content, overload content, and variable content

  • Both variable resolution at load time and dynamically at run-time

  • A set of standard “resolvers”

Resolvers

The library includes a set of standard resolvers. New resolvers can be defined easily by extending the Resolver base class.

  • TreeDataResolver - Resolution from a TreeData (dict) object/YAML files

  • DockerSwarmResolver - Resolution from Docker swarm configs/secrets

  • EnvVarResolver - Resolve from environment variables

Visitors

The library includes a set of visitors for inspecting and updating TreeData objects.

Library Usage

A service (both standard “system-d” and container services) may use this to handle settings.

Overview

The settings are accessed via the ServiceSettings (or custom, extended class) Singleton. The specifics of what actors are involved in providing the settings are specified within a SettingsContext instance. These include the location of the primary settings file (generally a YAML file), the location of an optional override settings file, and the inclusion of resolvers for environment variables, Docker swarm secrets/configs, and any other optional resolvers (such as pulling settings from a database).

Startup Sequence

One of the first steps that a service should perform is creating an instance of the SettingsContext object. This instance is passed into the ServiceSettings and provides contextual details for loading the settings and resolving variables.

Metadata

Release files for flexi-settings 1.0.1.dev270685584

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for flexi-settings 1.0.1.dev270685584
File Interpreter ABI Platform
flexi_settings-1.0.1.dev270685584-py2.py3-none-any.whl Python 3, Python 2 none any Details

Release files / flexi_settings-1.0.1.dev270685584-py2.py3-none-any.whl

Download URL flexi_settings-1.0.1.dev270685584-py2.py3-none-any.whl
Size 31.5 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
48807061dcb1603b16fae2725b10a4ff48a1b464f5e368b95dc55ef400b6d1ea
BLAKE2b-256 checksum
How to use checksums
d9555b0384018bac4c6cdc774e99d7e849ae0ccef2c5c264f1f4daa88224f550
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/54.1.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page