Skip to main content
Pre-release

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

EnvYAML | Latest Version Build Status Coverage Status

Simple YAML configuration file parser with easy access for structured data

Why

Modern configuration file become to be more complex, flexible and readable. YAML file format are perfect to store configuration file but had no option to pass environment variables. This project try to simplify usage YAML file and environment variables as program configuration file with easy config key access.

Install

pip install envyaml

Basic usage

Let's assume we had a project with this config file env.yaml

# env.yaml
database:
    host: $DATABASE_HOST
    port: 3301
    username: username
    password: $DATABASE_PASSWORD
    database: test

    table:
      user: table_user
      blog: table_blog

redis:
    host: $REDIS_HOST
    port: 5040

    config:
      expire: 300
      prefix: $REDIS_PREFIX

and environment variables set to

$DATABASE_HOST=xxx.xxx.xxx.xxx
$DATABASE_PASSWORD=super-secret-password
$REDIS_PREFIX=state

parse file with EnvYAML

from envyaml import EnvYAML

# read file env.yaml and parse config
env = EnvYAML('env.yaml')

# access whole database section
print(env.database)

# {
# 'database': 'test',
# 'host': 'xxx.xxx.xxx.xxx',
# 'password': 'super-secret-password',
# 'port': 3301,
# 'table':
#   {
#       'blog': 'table_blog', 
#       'user': 'table_user'
#   },
# 'username': 'username'
# }

# access database host value as properties name
print(env.database__host)

# >> xxx.xxx.xxx.xxx

# access database user table value as properties name
print(env.database__table__user)

# >> table_user

access config parameters with key option ['name']

print(env['database__port'])
# >> 3301

access config with get function and default value

print(env.get('not__exist__value', 'default'))
# >> default

License

MIT licensed. See the LICENSE file for more details.

Metadata

Release files for envyaml 0.1901rc5

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

Source distribution (sdist)

Source distribution for envyaml 0.1901rc5
File Size Uploaded Provenance
envyaml-0.1901rc5.tar.gz 4.6 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for envyaml 0.1901rc5
File Interpreter ABI Platform
envyaml-0.1901rc5-py3-none-any.whl Python 3 none any Details

Total release size: 10.5 kB

Release files / envyaml-0.1901rc5.tar.gz

Download URL envyaml-0.1901rc5.tar.gz
Size 4.6 kB
Tags Source
SHA-256 checksum
How to use checksums
50e92f56c4f9b8d89ece83da4b539744cc84fcd93e74e8e320badda06517d575
BLAKE2b-256 checksum
How to use checksums
df35e38e8d269ed8e7eca4adcfcd657cf294a59a12276ad0c81e4c11afe2a059
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.3

Release files / envyaml-0.1901rc5-py3-none-any.whl

Download URL envyaml-0.1901rc5-py3-none-any.whl
Size 5.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
557999ff2631c8a2784284bf6fda861663ced9af8fb841f5212e8097e188017e
BLAKE2b-256 checksum
How to use checksums
e825de499392624c3ef010eea48fbcfd7e6495db2bc4ef8a8bff9ac998a74dfb
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/40.6.3 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.3

Security for envyaml 0.1901rc5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release
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