Skip to content

1.9.1 breaks backward compatibility #4106

@pvicente

Description

@pvicente

Checks

  • I added a descriptive title to this issue
  • I have searched (google, github) for similar issues and couldn't find anything
  • I have read and followed the docs and still think this is a bug

Bug

Output of python -c "import pydantic.utils; print(pydantic.utils.version_info())":

             pydantic version: 1.9.1
            pydantic compiled: True
                 install path: /Users/pedrovicente/cytora/risk-stream-service/.venv/lib/python3.9/site-packages/pydantic
               python version: 3.9.11 (main, May  4 2022, 15:54:04)  [Clang 13.1.6 (clang-1316.0.21.2.3)]
                     platform: macOS-12.3.1-arm64-arm-64bit
     optional deps. installed: ['email-validator', 'typing-extensions']
...

#3713 PR breaks backward compatibility.

I think it should have been released as 2.0 and not as 1.9.1.

No matter it has a default value because there are field_definitions kwargs after it. Mypy was complaining and I had to add cls_kwargs={}, when calling it after updating from 1.9.0 to 1.9.1, so the change is not backward compatible and shouldn't have been a semver patch version release.

   model = pydantic.create_model(
        model_name,
        __config__=None,
        __base__=None,
        __module__=__name__,
        __validators__={},
        **{k: (v, ...) for k, v in attributes.items()},
...

After upgrade from 1.9.0 to 1.9.1 mypy is complaining with:

error: No overload variant of "create_model" matches argument types "str", "None", "None", "str", "Dict[<nothing>, <nothing>]", "Dict[str, Tuple[type, ellipsis]]"

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug V1Bug related to Pydantic V1.X

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions