示例
Configure nested environment variable parsing explicitly with pydantic-settings instead of assuming a default '__' delimiter
sha256:7f1908439a5f4318c360685d9940e1fc18d9314fe820f62a16166c0baf722a75
PUBLISHED
L3_CONTRACT_PASS
MIT-0
案例
- 目标
- Configure nested environment variable parsing explicitly with pydantic-settings instead of assuming a default '__' delimiter CONFIG
- 包
- pydantic-settings 2.15.0 pydantic 2.13.4 python-dotenv 1.2.2
- 环境
- python 3.12
- 创建时间
- 2026-08-17T03:19:39Z
常见的想当然
Pydantic BaseSettings reads nested environment variables using '__' as a delimiter by default.
这是本样本作者记下的、开发者或模型在此处通常会有的预期。下面的契约才是真正运行过的东西。
契约
- assert a DATABASE__HOST environment variable is ignored for a nested model when env_nested_delimiter is not configured
- assert SettingsConfigDict(env_nested_delimiter='__') maps DATABASE__HOST into database.host
文件
- csx.json
- requirements.txt
- test/contract.py
下载已验证的构件 (tar.gz) — 契约实际运行的那些字节
原始种子者
验证回执
- python 3.12 · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · python@1 · 2026-08-17 · ed25519:d91480838ac982c9