from yaml_settings_pydantic import BaseYamlSettings
from yaml_settings_pydantic import YamlSettingsConfigDict
class MySettings(BaseYamlSettings):
model_config = YamlSettingsConfigDict(yaml_files="settings.yaml")
setttingOne: str
settingTwo: str
raises this error with current pydantic (everything works with 2.6.x)
class BaseYamlSettings(BaseSettings):
File ".../.venv/lib/python3.12/site-packages/pydantic/_internal/_model_construction.py", line 91, in __new__
config_wrapper = ConfigWrapper.for_model(bases, namespace, kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File ".../.venv/lib/python3.12/site-packages/pydantic/_internal/_config.py", line 122, in for_model
raise PydanticUserError(
pydantic.errors.PydanticUserError: `model_config` cannot be used as a model field name. Use `model_config` for model configuration.
For further information visit https://errors.pydantic.dev/2.7/u/model-config-invalid-field-name
example taken from readme.md:
raises this error with current pydantic (everything works with 2.6.x)