Important
Warning: work in progress. until complete, please use github.com/dotenvx/dotenvx directly.
see python examples
a better dotenv–from the creator of dotenv
.
- run anywhere (cross-platform)
- multi-environment
- encrypted envs
Install and use it in code just like python-dotenv
.
pip install python-dotenvx
Then run dotenvx-postinstall
to install the dotenvx
binary (python-dotenvx is a wrapper).
dotenvx-postinstall
# or to specify the os-arch – useful for building binaries to a specific target such as linux-x86_64 on aws lambda
dotenvx-postinstall --os linux --arch x86_64
# you might also find you need to specify PYTHONPATH depend on how/where dotenvx installs to
PYTHONPATH=. bin/dotenvx-postinstall --os linux --arch x86_64
Then use it in code.
# main.py
import os
from dotenvx import load_dotenvx
load_dotenvx() # take environment variables from .env.
print(os.getenv("S3_BUCKET"))