Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Imports ConfigDict from pydantic instead from pydantic_settings #52

Closed
sr-verde opened this issue Jul 5, 2023 · 1 comment · Fixed by #74
Closed

Imports ConfigDict from pydantic instead from pydantic_settings #52

sr-verde opened this issue Jul 5, 2023 · 1 comment · Fixed by #74

Comments

@sr-verde
Copy link

sr-verde commented Jul 5, 2023

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.

@Kludex
Copy link
Member

Kludex commented Jul 5, 2023

Yep. I'll fix this.

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 a pull request may close this issue.

2 participants