Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Add support for pydantic v2 via pydantic.v1 compat module #16332

Merged
merged 7 commits into from
Sep 25, 2023

Commits on Sep 21, 2023

  1. Add support for pydantic v2 via pydantic.v1 compat module

    This adds support for pydantic v2 by using the `pydantic.v1` compat module
    when pydantic v2 is installed and otherwise falling back to the `pydantic` module.
    
    In order to satisfy mypy, we only import `pydantic.v1` during type
    checking. This allows proper type checking without needing to clutter
    the code with `type: ignores`.
    
    Once some time is passed, we can entirely drop compatibility for pydantic v1 and
    start using the actual pydantic v2 code to reap the additional
    performance benefits and other improvements of pydantic v2.
    
    Signed-off-by: Maxwell G <maxwell@gtmx.me>
    gotmax23 committed Sep 21, 2023
    Configuration menu
    Copy the full SHA
    3a69364 View commit details
    Browse the repository at this point in the history
  2. _pydantic_compat: fix HAS_PYDANTIC_V2 version check

    Old pydantic v1 versions do not define `__version__`.
    
    Signed-off-by: Maxwell G <maxwell@gtmx.me>
    gotmax23 committed Sep 21, 2023
    Configuration menu
    Copy the full SHA
    319fc2b View commit details
    Browse the repository at this point in the history
  3. pyproject.toml: bump packaging minimum version to 20.0.

    Signed-off-by: Maxwell G <maxwell@gtmx.me>
    gotmax23 committed Sep 21, 2023
    Configuration menu
    Copy the full SHA
    2dcd89f View commit details
    Browse the repository at this point in the history
  4. Remove newline from changelog entry

    Apparently, towncrier doesn't like this.
    
    Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
    gotmax23 and clokep committed Sep 21, 2023
    Configuration menu
    Copy the full SHA
    4707549 View commit details
    Browse the repository at this point in the history

Commits on Sep 25, 2023

  1. Configuration menu
    Copy the full SHA
    0bb7f3d View commit details
    Browse the repository at this point in the history
  2. Update packaging comment.

    clokep committed Sep 25, 2023
    Configuration menu
    Copy the full SHA
    7f9482e View commit details
    Browse the repository at this point in the history
  3. Newsfragment

    clokep committed Sep 25, 2023
    Configuration menu
    Copy the full SHA
    ac41f59 View commit details
    Browse the repository at this point in the history