Hello. I have updated pydantic to version > 2.0. After found problems with mypy
.\common\graphql\pagination.py:29: error: INTERNAL ERROR -- Please try using mypy master on GitHub:
https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
If this issue continues with mypy master, please report a bug at https://github.com/python/mypy/issues
version: 1.5.1
.\common\graphql\pagination.py:29: : note: please use --show-traceback to print a traceback when reporting a bug
# pagination.py
import pydantic
import strawberry
from pydantic import ConfigDict
class PagePaginationPydantic(pydantic.BaseModel):
model_config = ConfigDict(from_attributes=True)
page: int = pydantic.Field(default=1, ge=1)
page_size: int = pydantic.Field(default=100, ge=1, le=1_000)
@strawberry.experimental.pydantic.input(
PagePaginationPydantic,
name="PagePaginationInput",
)
class PagePaginationInputGQL:
page: strawberry.auto = 1
page_size: strawberry.auto = 100
After calling mypy . --show-traceback
.\common\graphql\pagination.py:29: error: INTERNAL ERROR -- Please try using mypy master on GitHub:
https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
Please report a bug at https://github.com/python/mypy/issues
version: 1.5.1
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "mypy\semanal.py", line 6475, in accept
File "mypy\nodes.py", line 1141, in accept
File "mypy\semanal.py", line 1600, in visit_class_def
File "mypy\semanal.py", line 1685, in analyze_class
File "mypy\semanal.py", line 1714, in analyze_class_body_common
File "mypy\semanal.py", line 1787, in apply_class_plugin_hooks
File "D:\Dev\strana\common\.venv\Lib\site-packages\strawberry\ext\mypy_plugin.py", line 422, in strawberry_pydantic_class_callback
field = PydanticModelField.deserialize(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "D:\Dev\strana\common\.venv\Lib\site-packages\pydantic\mypy.py", line 382, in deserialize
data = data.copy()
^^^^^^^^^
AttributeError: 'tuple' object has no attribute 'copy'
.\common\graphql\pagination.py:29: : note: use --pdb to drop into pdb
# pyproject.toml
[tool.mypy]
python_version = "3.11"
plugins = [
"strawberry.ext.mypy_plugin",
"pydantic.mypy",
]
follow_imports = "silent"
ignore_missing_imports = true
check_untyped_defs = true
disallow_untyped_calls = true
disallow_untyped_defs = true
disallow_incomplete_defs = true
disallow_any_generics = true
no_implicit_optional = true
warn_redundant_casts = true
warn_unused_ignores = true
warn_return_any = true
warn_unreachable = true
strict_optional = true
strict_equality = true
Package versions:
mypy: 1.5.1
strawberry-graphql: 0.205.0
pydantic: 2.3.0
Pay now to fund the work behind this issue.
Get updates on progress being made.
Maintainer is rewarded once the issue is completed.
You're funding impactful open source efforts
You want to contribute to this effort
You want to get funding like this too