pydantic_settings isn’t calling ‘before’ validators properly
I’m writing a pydantic_settings class to read data from a .env file/environment variables. The relevant parts look like this:
Pydantic does not give precedence to os environment
I have the following
Pydantic-Settings: Environment Variables Prioritize Over Init Args with Aliases
I am using Pydantic v2 with BaseSettings (pydantic-settings
) to load configurations from environment variables. However, I encountered an issue where environment variables seem to override the initialization arguments, even when I expect the init arguments to take priority.
Is there a way to prevent pydantic from calling my function used to find config files on import?
My class looks something like this: