Skip to content

Imports ConfigDict from pydantic instead from pydantic_settings #52

Closed
@sr-verde

Description

@sr-verde

As a follow-up from this non-issue in pydantic_settings, I want to file this issue here. pydantic-bump seem to import ConfigDict from wrong package. And – if I got it right – it should import SettingsConfigDict in my example instead of ConfigDict.

I had this config in Pydantic v1:

from typing import Literal
from pydantic import BaseSettings


class Config(BaseSettings):
    log_level: Literal["NOTSET", "DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"] = "WARNING"

    class Config:
        env_file = ".env"

Then, I executed dump-pydantic and got the following config file:

from typing import Literal
from pydantic import ConfigDict
from pydantic_settings import BaseSettings


class Config(BaseSettings):
    log_level: Literal["NOTSET", "DEBUG", "INFO", "WARNING", "ERROR", "CRITICAL"] = "WARNING"
    model_config = ConfigDict(env_file=".env")

As one can see bump-pydantic imported ConfigDict from pydantic instead from pydantic_settings. And as the example uses SettingsConfigDict, I think bump-pydantic should use that as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions