Feature request: custom merge logic or variables
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 35/100
調査の方向性
Start with the dotenv methods that accept the existing override parameter and trace how values from .env are applied to the environment. Define how a variable-to-callable API would coexist with current override and non-override behavior, using the LD_LIBRARY_PATH example as the target case. Done means custom merge logic can extend and normalize a colon-separated value without changing existing defaults.
索引モデルが issue の本文から書いたものです。
説明
Hello, this is a feature request for enabling custom merge logic when the environment variables are updated with values read from .env file.
My use case is that I would like to append an element to a colon-separated list of paths. Typical colon-separated environment variables are PATH or LD_LIBRARY_PATH. So the reading of the .env file should neither override, nor leave the original environment variables, instead it should extend the list.
Currently I use the following pseudo-code for this:
cfg = dotenv_values()
path_elems = []
if 'LD_LIBRARY_PATH' in os.environ:
path_elems.extend(os.environ['LD_LIBRARY_PATH'].split(':'))
if 'LD_LIBRARY_PATH' in cfg:
path_elems.append(cfg['LD_LIBRARY_PATH'])
path_elems = list(OrderedDict.fromkeys(path_elems)) # remove duplicates
path = ':'.join(path_elems)
path = path.replace('::', ':') # remove empty elements
os.environ['LD_LIBRARY_PATH'] = path
I think such logic could be integrated into the dotenv library. This would require changing the API: instead of / apart the override parameter the dotenv methods could take a variable name -> callable dictionary, where the callable would take as parameters the current and the new value and handle the merge logic for the specified variable. Senseful default behavior could be configured to simulate the current override/not override functionality.
- 主要言語
- Python
- スター
- 8.9k
- フォーク
- 581
- PR マージ指標
- 30日以内にマージされた PR はありません
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
theskumar/python-dotenv のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
theskumar/python-dotenv#699 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 35/100
theskumar/python-dotenv#697 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 28/100
theskumar/python-dotenv#693 · コメント 1 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 55/100
theskumar/python-dotenv#683 · コメント 4 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 55/100
theskumar/python-dotenv#644 · コメント 2 件 ·
theskumar/python-dotenv の issue をすべて見る
似ている issue
-
area/auth bug comp/agent P3 platform/discord type/security
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
NousResearch/hermes-agent#117848 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
bancolombia/sentinel#23 ·
-
test md オープンCI
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
-
integration:quickjs org:external priority:backlog topic:code-interpreter topic:middleware type:feature
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
langchain-ai/deepagents#6450 ·
-
bug client
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100