mirror of
https://github.com/kennethreitz/pydantic.git
synced 2026-06-05 23:00:18 +00:00
be246701c5
* Environment names for complex types #2304 * nested env disabled by default * cleanup * nested env settings: simplified and mypy fixes * nested env settings: config, test, doc * nested env settings: changes file * nested env settings: cleanup * Apply suggestions from code review Co-authored-by: Samuel Colvin <samcolvin@gmail.com> * Apply suggested changes from code review * lint fix * changes from code review * simplify explosing env vars * linting Co-authored-by: Mark Trifonov <> Co-authored-by: Samuel Colvin <samcolvin@gmail.com> Co-authored-by: Samuel Colvin <s@muelcolvin.com>
24 lines
330 B
Python
24 lines
330 B
Python
from pydantic import BaseModel, BaseSettings
|
|
|
|
|
|
class DeepSubModel(BaseModel):
|
|
v4: str
|
|
|
|
|
|
class SubModel(BaseModel):
|
|
v1: str
|
|
v2: bytes
|
|
v3: int
|
|
deep: DeepSubModel
|
|
|
|
|
|
class Settings(BaseSettings):
|
|
v0: str
|
|
sub_model: SubModel
|
|
|
|
class Config:
|
|
env_nested_delimiter = '__'
|
|
|
|
|
|
print(Settings().dict())
|