python-python-dotenv
Port variant v13
Summary Sets environment from .env file (3.13)
BROKEN
Package version 1.0.1
Homepage https://github.com/theskumar/python-dotenv
Keywords python
Maintainer Python Automaton
License Not yet specified
Other variants v12
Ravenports Buildsheet | History
Ravensource Port Directory | History
Last modified 15 NOV 2024, 16:08:50 UTC
Port created 08 JAN 2023, 04:18:24 UTC
Subpackage Descriptions
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 from .env. # 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. 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": "foo@example.org"} ```
Configuration Switches (platform-specific settings discarded)
PY312 OFF Build using Python 3.12 PY313 ON Build using Python 3.13
Package Dependencies by Type
Build (only) python313:dev:std
python-pip:single:v13
autoselect-python:single:std
Build and Runtime python313:primary:std
Download groups
main mirror://PYPIWHL/6a/3e/b68c118422ec867fa7ab88444e1274aa40681c606d59ac27de5a5588f082
Distribution File Information
f7b63ef50f1b690dddf550d03497b66d609393b40b564ed0d674909a68ebf16a 19863 python-src/python_dotenv-1.0.1-py3-none-any.whl
Ports that require python-python-dotenv:v13
python-netbox-network-importer:v13 Tool to import network into Netbox (3.13)