This configuration utility library allows your code use YAML as a configuration language for internal and external parties, allowing configuration to be crafted from multiple sources and merged just before use, with added YAML Tags that run lazily for added functionality.
Project description
granular-configuration-language
⚠️ This library is meant for trusted configuration files. ⚠️
Get started or read more at the documentation site.
Why does this exist?
This library exists to allow your code use YAML as a configuration language for internal and external parties, allowing configuration to be crafted from multiple sources and merged just before use, with added YAML Tags that run lazily for added functionality, and plugin support for creating custom YAML Tags.
Some use cases:
- You are writing a library to help connect to some databases. You want users to easily changes settings and defined databases by name.
- Conceptual Example:
- Library Code:
CONFIG = LazyLoadConfiguration( Path(__file___).parent / "config.yaml", "./database-util-config.yaml", "~/configs/database-util-config.yaml", base_path="database-util", env_location_var_name="ORG_COMMON_CONFIG_LOCATIONS", )
- Library configuration:
database-util: common_settings: use_decimal: true encryption_type: secure databases: {} # Empty mapping, for users define
- User application configuration:
database-util: common_settings: use_decimal: false databases: datebase1: location: http://somewhere user: !Mask ${DB_USERNAME} password: !Mask ${DB_PASSWORD}
- Library Code:
- Conceptual Example:
- You are deploying an application that has multiple deployment types with specific settings.
- Conceptual Example:
- Library Code:
CONFIG = LazyLoadConfiguration( Path(__file___).parent / "config.yaml", "./database-util-config.yaml", base_path="app", )
- Base configuration:
app: log_as: really cool app name log_to: nowhere
- AWS Lambda deploy:
app: log_to: std_out
- Server deploy:
app: log_to: !Sub file://var/log/${$.app.log_as}.log
- Library Code:
- Conceptual Example:
- You are writing a
pytestplugin that create test data using named fixtures configured by the user.- Conceptual Examples:
- Library Code:
CONFIG = LazyLoadConfiguration( Path(__file___).parent / "fixture_config.yaml", *Path().rglob("fixture_config.yaml"), base_path="fixture-gen", ).config # for name, spec in CONFIG.fixtures: generate_fixture(name, spec)
- Library configuration:
fixture-gen: fixtures: {} # Empty mapping, for users define
- User application configuration:
fixture-gen: fixtures: fixture1: api: does something
- Library Code:
- Conceptual Examples:
Why the long name?
- It's "granular" because you can specify settings across multiple files at a fine granularity for overriding values.
- It is meant for trusted "configuration" files.
- Including "language" make it clear that this is not the source of configuration.
- A valid piece of feedback was that it sounded like it was the source for configuration, not the processing of generic configuration files.
- "Format" sounded weirder than "language".
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file granular_configuration_language-2.0.0rc1.tar.gz.
File metadata
- Download URL: granular_configuration_language-2.0.0rc1.tar.gz
- Upload date:
- Size: 27.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
72ec312cbc315bfa001dc1987e1f1317c2c7b0ea8bdb59525e831fbe35efa466
|
|
| MD5 |
852b747aa8807351bdaa90fabeff9bb1
|
|
| BLAKE2b-256 |
7b3571c344e9c3bd4c5110e356c762398a9a07efeec9393c014ae48e3d6d775d
|
Provenance
The following attestation bundles were made for granular_configuration_language-2.0.0rc1.tar.gz:
Publisher:
release.yaml on lifedox/granular-configuration-language
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
granular_configuration_language-2.0.0rc1.tar.gz -
Subject digest:
72ec312cbc315bfa001dc1987e1f1317c2c7b0ea8bdb59525e831fbe35efa466 - Sigstore transparency entry: 170108382
- Sigstore integration time:
-
Permalink:
lifedox/granular-configuration-language@1f2b66463c26ce2a56cc1a6588cbcf3739ccf716 -
Branch / Tag:
refs/tags/v2.0.0-rc1 - Owner: https://github.com/lifedox
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@1f2b66463c26ce2a56cc1a6588cbcf3739ccf716 -
Trigger Event:
release
-
Statement type:
File details
Details for the file granular_configuration_language-2.0.0rc1-py3-none-any.whl.
File metadata
- Download URL: granular_configuration_language-2.0.0rc1-py3-none-any.whl
- Upload date:
- Size: 44.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3911ccdaefbe32142d5c0f164b6b35ddaceea5cfd07a8aef0b2c63e2a6d030c3
|
|
| MD5 |
7a874a4ddb0e5f8ca3c1237044e3a750
|
|
| BLAKE2b-256 |
a7e13090f3b80d5eaba589c4e034b7b153e3ac103caec6a7527cb2a893125b1d
|
Provenance
The following attestation bundles were made for granular_configuration_language-2.0.0rc1-py3-none-any.whl:
Publisher:
release.yaml on lifedox/granular-configuration-language
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
granular_configuration_language-2.0.0rc1-py3-none-any.whl -
Subject digest:
3911ccdaefbe32142d5c0f164b6b35ddaceea5cfd07a8aef0b2c63e2a6d030c3 - Sigstore transparency entry: 170108383
- Sigstore integration time:
-
Permalink:
lifedox/granular-configuration-language@1f2b66463c26ce2a56cc1a6588cbcf3739ccf716 -
Branch / Tag:
refs/tags/v2.0.0-rc1 - Owner: https://github.com/lifedox
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@1f2b66463c26ce2a56cc1a6588cbcf3739ccf716 -
Trigger Event:
release
-
Statement type: