# Buildsheet autogenerated by ravenadm tool -- Do not edit. NAMEBASE= python-python-dotenv VERSION= 1.1.1 KEYWORDS= python VARIANTS= v12 v13 SDESC[v12]= Sets environment from .env file (3.12) SDESC[v13]= Sets environment from .env file (3.13) HOMEPAGE= https://github.com/theskumar/python-dotenv CONTACT= Python_Automaton[python@ironwolf.systems] DOWNLOAD_GROUPS= main SITES[main]= PYPIWHL/5f/ed/539768cf28c661b5b068d66d96a2f155c4971a5d55684a514c1a0e0dec2f DISTFILE[1]= python_dotenv-1.1.1-py3-none-any.whl:main DIST_SUBDIR= python-src DF_INDEX= 1 SPKGS[v12]= single SPKGS[v13]= single OPTIONS_AVAILABLE= PY312 PY313 OPTIONS_STANDARD= none VOPTS[v12]= PY312=ON PY313=OFF VOPTS[v13]= PY312=OFF PY313=ON DISTNAME= python_dotenv-1.1.1.dist-info GENERATED= yes [PY312].USES_ON= python:v12,wheel [PY313].USES_ON= python:v13,wheel [FILE:2580:descriptions/desc.single] # python-dotenv [![Build Status][build_status_badge]][build_status_link] [![PyPI version][pypi_badge]][pypi_link] python-dotenv reads key-value pairs from a `.env` file and can set them as environment variables. It helps in the development of applications following the [12-factor] principles. - [Getting Started] - [Other Use Cases] * [Load configuration without altering the environment] * [Parse configuration as a stream] * [Load .env files in IPython] - [Command-line Interface] - [File format] * [Multiline values] * [Variable expansion] - [Related Projects] - [Acknowledgements] ## Getting Started ```shell pip install python-dotenv ``` If your application takes its configuration from environment variables, like a 12-factor application, launching it in development is not very practical because you have to set those environment variables yourself. To help you with that, you can add python-dotenv to your application to make it load the configuration from a `.env` file when it is present (e.g. in development) while remaining configurable via the environment: ```python from dotenv import load_dotenv load_dotenv() # take environment variables # Code of your application, which uses environment variables (e.g. from `os.environ` or # `os.getenv`) as if they came from the actual environment. ``` By default, `load_dotenv` doesn't override existing environment variables and looks for a `.env` file in same directory as python script or searches for it incrementally higher up. To configure the development environment, add a `.env` in the root directory of your project: ``` . ├── .env └── foo.py ``` The syntax of `.env` files supported by python-dotenv is similar to that of Bash: ```bash # Development settings DOMAIN=example.org ADMIN_EMAIL=admin@${DOMAIN} ROOT_URL=${DOMAIN}/app ``` If you use variables in values, ensure they are surrounded with `{` and `}`, like `${DOMAIN}`, as bare variables such as `$DOMAIN` are not expanded. You will probably want to add `.env` to your `.gitignore`, especially if it contains secrets like a password. See the section "File format" below for more information about what you can write in a `.env` file. ## Other Use Cases ### Load configuration without altering the environment The function `dotenv_values` works more or less the same way as `load_dotenv`, except it doesn't touch the environment, it just returns a `dict` with the values parsed from the `.env` file. ```python from dotenv import dotenv_values config = dotenv_values(".env") # config = {"USER": "foo", "EMAIL": [FILE:126:distinfo] 31f23644fe2602f88ff55e1f5c79ba497e01224ee7737937930c448e4d0e24dc 20556 python-src/python_dotenv-1.1.1-py3-none-any.whl