Skip to main content

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

Coverage badge Testing workflow codeql workflow

⚠️ 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}
        
  • 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
        
  • You are writing a pytest plugin 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
        

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

granular_configuration_language-2.0.0.tar.gz (27.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

granular_configuration_language-2.0.0-py3-none-any.whl (44.3 kB view details)

Uploaded Python 3

File details

Details for the file granular_configuration_language-2.0.0.tar.gz.

File metadata

File hashes

Hashes for granular_configuration_language-2.0.0.tar.gz
Algorithm Hash digest
SHA256 7e841aa12670d8568ce34ce6852114e92954dc27e3fa40a7b5aeb9d6ee321979
MD5 b9ec475990ea64b9f6bde9c65f6a619f
BLAKE2b-256 20412a4b46d0bc32fe8632cc5bb4d682176180a605bd25d78fccfbaa1535f7d6

See more details on using hashes here.

Provenance

The following attestation bundles were made for granular_configuration_language-2.0.0.tar.gz:

Publisher: release.yaml on lifedox/granular-configuration-language

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file granular_configuration_language-2.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for granular_configuration_language-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 df0a8efb4574f351d5012891e8aaf6a88f70e8968931f9b29329049d0b9b5880
MD5 d4fb976ef614636e179aaf4945aadcdc
BLAKE2b-256 ac524c2bebde69d0ef2b12bb7c8c59468f27ed8e9d0723a4d31ee161cdeb9cea

See more details on using hashes here.

Provenance

The following attestation bundles were made for granular_configuration_language-2.0.0-py3-none-any.whl:

Publisher: release.yaml on lifedox/granular-configuration-language

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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