diff --git a/dsi_pydantic_shim.py b/dsi_pydantic_shim.py index 3ea00720..9c333cbf 100644 --- a/dsi_pydantic_shim.py +++ b/dsi_pydantic_shim.py @@ -1,3 +1,13 @@ +"""Shim to allow support for both Pydantic 1 and Pydantic 2. + +DSI must support both major versions of Pydantic because dbt-core depends on DSI. dbt-core users might be using an +environment with either version, and we can't restrict them to one or the other. Here, we essentially import all +Pydantic objects from version 1. Throughout the repo, we import those objects from this file instead of from Pydantic +directly, meaning that we essentially only use Pydantic 1 in this repo, but without forcing that restriction on dbt +users. The development environment for this repo should be pinned to Pydantic 1 to ensure devs get appropriate type +hints. +""" + from importlib.metadata import version pydantic_version = version("pydantic")