Skip to content

allowing Configuration to use a pydantic class type instead of instance#963

Open
warmagedon007 wants to merge 2 commits into
ets-labs:developfrom
warmagedon007:pydantic_class_config
Open

allowing Configuration to use a pydantic class type instead of instance#963
warmagedon007 wants to merge 2 commits into
ets-labs:developfrom
warmagedon007:pydantic_class_config

Conversation

@warmagedon007
Copy link
Copy Markdown

This PR removes the error on loading and passing a pydantic.BaseSettings type when from_pydantic is called.

Instead, an instance will be directly initialized (with no kwargs) for use in the loading process.

The purpose of this and to allow declaration and import of a declarative container before all setting are initialized (via envvars, files, etc), especially in tests.

A little note.
kwargs that are used now in the Configuration are for passing kwargs for the pydantic dict or model_dump. I thought it will be too confusing to change it to be also kwargs for the pydantic model initialization.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants