theskumar / theskumar/python-dotenv
Unable to escape posix expansion
オープン
@theskumar がすでに取り組んでいます。
2025年4月8日 から。
- 主要言語
- Python
- スター
- 8.9k
- フォーク
- 581
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
What
Unable to elegantly escape the $ in ${VARIABLE} expansion.
Scenario
.env
VAR=${VARIABLE}
script.py
import os
import dotenv
if dotenv.find_dotenv():
dotenv.load_dotenv(interpolate=False)
print(f"VAR={os.getenv('VAR')}"
I do not see the interpolate kwarg in the documentation, however looking at the stub: https://github.com/theskumar/python-dotenv/blob/914c68ef0e4c2c085d2753f5cbbf304852f37850/src/dotenv/main.py#L307-L330
*Edit: and the pypi documentation:

Expected Behavior
output
>> VAR='${VARIABLE}'
Actual Behavior
output
>> VAR=''
Workaround
My current workaround is to provide the desired string as a default value for variable expansion.
.env
VAR=${_:-${VARIABLE}]
output
>> VAR='${VARIABLE}'
System
Host: Windows 11
Python: 3.10 w/ Poetry environment
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
評価
この issue はまだ評価されていません。