Closed laipz8200 closed 1 week ago
Hi,
There are many parameters in BaseSettings such as _env_file and _case_sensitive, but these parameters are not fields of BaseSettings. According to the definition from the Python documentation, the init method of my own Settings class will not include these parameters unless I write them myself.
These are configuration params that you can pass when initializing your setting class. we have same params in SettingsConfigDict
as well but these are the params that have more priority over SettingsConfigDict
params.
As a result, when I inherit from BaseSettings and create my own Settings class, once I pass parameters like _env_file to the Settings, the type checker(both Pyright and Mypy) will complain.
Yes, you will get the error with pyright
but I think you don't get error in mypy
if you enable pydantic mypy plugin
@hramezani Thank you for your reply!
Hi!
There are many parameters in
BaseSettings
such as_env_file
and_case_sensitive
, but these parameters are not fields ofBaseSettings
. According to the definition from the Python documentation, the__init__
method of my own Settings class will not include these parameters unless I write them myself.As a result, when I inherit from
BaseSettings
and create my ownSettings
class, once I pass parameters like_env_file
to theSettings
, the type checker(both Pyright and Mypy) will complain.Do you have any plans to fix it? Or should we include these parameters as fields in the
BaseSettings
class? (I have tried this approach, it solves the problem but doesn't look very elegant.)