Skip to main content

Interpolate Yaml files with env vars

Project description

Build Status

Interpolate YaML files with environmental variables and other YaML files.

Given a YaML string like:

a: ${A}
b: 2

and an environmental variable $A with value hello, yamlenv.load would return:

{
    a: 'hello',
    b: 2
}

Default values are supported:

yamlenv.load('''
    a: ${A, 'hello'}
    b: 2
''') == {
    'a': 'hello',
    'b': 2
}

YaML files can include other YaML files, too. E.g. if b.yaml contains “2”, then:

yamlenv.load('''
    a: 1
    b: !include b.yaml
''') == {
    'a': 1
    'b': 2
}

The included YaML file can be as complex as necessary.

More examples are available in the tests.

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

yamlenv-0.3.0.tar.gz (3.2 kB view details)

Uploaded Source

File details

Details for the file yamlenv-0.3.0.tar.gz.

File metadata

  • Download URL: yamlenv-0.3.0.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for yamlenv-0.3.0.tar.gz
Algorithm Hash digest
SHA256 ad892541d24212c150bc1da768eeeef102de0157514611f25978eb632cbb4468
MD5 3283d11a3b6662db5d169f497ee689c8
BLAKE2b-256 f68c3ff2ce028749f870ea5ad20528f161066273ca23e43b16ec78c564eaaa68

See more details on using hashes here.

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