import sys; print(sys.version): 3.7.5 (default, Nov 7 2019, 10:50:52) import pydantic; print(pydantic.VERSION): 1.0b1 or 1.2, but works fine with 0.32import os
from pydantic import BaseSettings
class MyBaseSettings(BaseSettings):
var: int = 10
class MySubSettings(MyBaseSettings):
class Config:
env_prefix = 'PREFIX_'
os.environ['PREFIX_VAR'] = '2'
k = MySubSettings()
print(k.var) # 10, but should be 2
We expect that k.var will be equal to 2, but it has default value 10.
It's reproduced since 1.0b1.
I'm looking into this, but I'm afraid the solution isn't trivial.
Weird that this got 11 :+1: and 2 :eyes: in 2 hours. Any idea why this happened?
Yep, we are team.
Thanks for quick support! Hope fix won't be difficult.
That's what exactly happens when you upgrade your project with Pydantic from 0.32 to 1.2 directly... Thank you for support, @samuelcolvin !
See #1093, should be fixed there.
Most helpful comment
I'm looking into this, but I'm afraid the solution isn't trivial.
Weird that this got 11 :+1: and 2 :eyes: in 2 hours. Any idea why this happened?