diff --git a/RELEASE.md b/RELEASE.md new file mode 100644 index 0000000000..35f90fbd65 --- /dev/null +++ b/RELEASE.md @@ -0,0 +1,3 @@ +Release type: minor + +Fix import error in `strawberry.ext.mypy_plugin` for users who don't use pydantic. diff --git a/strawberry/ext/mypy_plugin.py b/strawberry/ext/mypy_plugin.py index 10757482f8..0dca642717 100644 --- a/strawberry/ext/mypy_plugin.py +++ b/strawberry/ext/mypy_plugin.py @@ -52,7 +52,6 @@ ) from mypy.typevars import fill_typevars from mypy.util import get_unique_redefinition_name -from strawberry.experimental.pydantic._compat import IS_PYDANTIC_V1 # Backwards compatible with the removal of `TypeVarDef` in mypy 0.920. try: @@ -64,8 +63,11 @@ try: from pydantic.mypy import METADATA_KEY as PYDANTIC_METADATA_KEY from pydantic.mypy import PydanticModelField + + from strawberry.experimental.pydantic._compat import IS_PYDANTIC_V1 except ImportError: PYDANTIC_METADATA_KEY = "" + IS_PYDANTIC_V1 = False if TYPE_CHECKING: