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 MY_AZD_ENV
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 'MY_AZD_ENV', loaded from azd env
print(getenv('VAR1')) # prints 'INITIAL', was already in Python env
Override mode
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
Quiet mode
If you want to ignore errors when azd
is not initialized or no azd
environment is active, you can use the quiet
parameter. This is useful when integrating with azd
while avoiding dependency on it.
load_azd_env(quiet=True)
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
Built Distribution
File details
Details for the file dotenv_azd-0.2.0.tar.gz
.
File metadata
- Download URL: dotenv_azd-0.2.0.tar.gz
- Upload date:
- Size: 8.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.27.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 048a78d30b73fabb10b2f2851e09ef01b9ec9d4df3922e178bf00115b23f3a19 |
|
MD5 | 53f8827389c66275d6b9f7c0e999cc4c |
|
BLAKE2b-256 | ceef06777a1b597c37226a443f035cf4ccc2fb50a4436418c7faa96482f92dca |
File details
Details for the file dotenv_azd-0.2.0-py3-none-any.whl
.
File metadata
- Download URL: dotenv_azd-0.2.0-py3-none-any.whl
- Upload date:
- Size: 4.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-httpx/0.27.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f6c921536375b43da552c1044ca3b1ba9b991d3e97fd2af1e15c6bf1105f550b |
|
MD5 | d06c47eda7d6f5010950d8ba09c755c7 |
|
BLAKE2b-256 | d3441c15bc1b4cb450f9300d76111b22967417cfe3e139767a30f65f80aab179 |