Skip to content

Commit 60df80f

Browse files
docs: clarify strict takes precedence over verbose in docstrings
1 parent bdee098 commit 60df80f

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

src/dotenv/main.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -413,14 +413,17 @@ def load_dotenv(
413413
dotenv_path: Absolute or relative path to .env file.
414414
stream: Text stream (such as `io.StringIO`) with .env content, used if
415415
`dotenv_path` is `None`.
416-
verbose: Whether to output a warning the .env file is missing.
416+
verbose: Whether to output a warning the .env file is missing. Ignored
417+
when ``strict`` is ``True`` (strict raises instead of warning).
417418
override: Whether to override the system environment variables with the variables
418419
from the `.env` file.
419420
interpolate: Whether to interpolate variables using POSIX variable expansion.
420421
encoding: Encoding to be used to read the file.
421422
strict: Whether to raise errors instead of silently ignoring them. When
422423
``True``, a ``FileNotFoundError`` is raised if the .env file is not
423424
found and a ``ValueError`` is raised if any line cannot be parsed.
425+
Takes precedence over ``verbose`` — when both are ``True``, the
426+
exception is raised without emitting a warning first.
424427
Returns:
425428
Bool: True if at least one environment variable is set else False
426429
@@ -471,12 +474,15 @@ def dotenv_values(
471474
Parameters:
472475
dotenv_path: Absolute or relative path to the .env file.
473476
stream: `StringIO` object with .env content, used if `dotenv_path` is `None`.
474-
verbose: Whether to output a warning if the .env file is missing.
477+
verbose: Whether to output a warning if the .env file is missing. Ignored
478+
when ``strict`` is ``True`` (strict raises instead of warning).
475479
interpolate: Whether to interpolate variables using POSIX variable expansion.
476480
encoding: Encoding to be used to read the file.
477481
strict: Whether to raise errors instead of silently ignoring them. When
478482
``True``, a ``FileNotFoundError`` is raised if the .env file is not
479483
found and a ``ValueError`` is raised if any line cannot be parsed.
484+
Takes precedence over ``verbose`` — when both are ``True``, the
485+
exception is raised without emitting a warning first.
480486
481487
If both `dotenv_path` and `stream` are `None`, `find_dotenv()` is used to find the
482488
.env file.

0 commit comments

Comments
 (0)