Python dotenv adapter that loads dotenv key value pairs from Azure Developer CLI (azd)
Project description
dotenv-azd
This library provides a Python python-dotenv wrapper function that loads dotenv key value pairs from the currently selected Azure Developer CLI (azd) environment.
Installation
pip install dotenv-azd
Usage
Create a new AZD env if you don't have one yet and set an initial variable value:
azd init
azd env set VAR1 OVERRIDE
In your Python code:
from dotenv_azd import load_azd_env
from os import getenv, environ
environ['VAR1'] = 'INITIAL'
load_azd_env()
print(getenv('AZURE_ENV_NAME')) # prints 'test', loaded from azd env
print(getenv('VAR1')) # prints 'INITIAL', was already in Python env
TIP: You can also override variables in Python env:
load_azd_env(override=True)
print(getenv('VAR1')) # prints 'OVERRIDE', loaded from azd env, overriding Python env
License
dotenv-azd
is distributed under the terms of the MIT license.
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
dotenv_azd-0.1.1.tar.gz
(4.1 kB
view hashes)
Built Distribution
Close
Hashes for dotenv_azd-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e7898b8eaf98f542fa4a4f68734aea3b842d32577b1c95731a1dfa6b9baf0bee |
|
MD5 | 443198190fea7b1490efba5f989a19a8 |
|
BLAKE2b-256 | 0f6bfcb607268bfe6d29a003db254e6db3a5110f937a9697d9da5f25ebe57149 |