Skip to main content

An easy way to manage environment specific configuration

Project description

Yamz

An easy way to manage environment specific configuration in Python using PyYAML.

Python package

Requirements

  • Python >=3.6
  • PyYAML >=5.1

Why Yamz?

All the other names I managed to think of were already taken, so... here we are.

How to use

  • pip install yamz
  • Configure your environment in settings.yaml
    • I recommend using environments names such as: production, development, etc., Note: global environment settings will be available in all environments
    • If you would like to include variables from your environment, make sure to add a $ prefix ($HOME) and Yamz will make sure it's included.
    global:
      TEST: some_test
    production:
      HOME: $HOME
      MYSQL_DB_HOST: 1.2.3.4
      MYSQL_DB_PASS: $MYSQL_DB_PASS
    
import os

from yamz import Yamz


base = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
path = os.path.join(base, 'settings.yaml')

env = Yamz(path)
prod_env = env.load("production")

prod_env.MYSQL_DB_HOST # 1.2.3.4

prod_env.YAMZ_ENV # production

Contributions

If you'd like to contribute and make Yamz better, feel free to open up a PR. I'll review it at my earliest convenience!

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

yamz-0.2.1.tar.gz (3.3 kB view hashes)

Uploaded Source

Built Distribution

yamz-0.2.1-py3-none-any.whl (5.3 kB view hashes)

Uploaded Python 3

Supported by

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