Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type error after upgrading to mypy 1.4.1 #15573

Closed
scottmatth opened this issue Jul 3, 2023 · 2 comments
Closed

Type error after upgrading to mypy 1.4.1 #15573

scottmatth opened this issue Jul 3, 2023 · 2 comments
Labels
bug mypy got something wrong

Comments

@scottmatth
Copy link

After upgrading from mypy 1.30 to 1.41 I ran mypy against our code base to test that there were no compatibility issues:
mypy --show-traceback .

The following error is what we received:

/Users/scottmat/Development/gpo/venv/lib/python3.10/site-packages/pydantic/env_settings.py:22: 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.4.1
Traceback (most recent call last):
File "mypy/semanal.py", line 6451, in accept
File "mypy/nodes.py", line 1139, in accept
File "mypy/semanal.py", line 1582, in visit_class_def
File "mypy/semanal.py", line 1667, in analyze_class
File "mypy/semanal.py", line 1694, in analyze_class_body_common
File "mypy/semanal.py", line 1777, in apply_class_plugin_hooks
File "pydantic/mypy.py", line 154, in pydantic.mypy.PydanticPlugin._pydantic_model_class_maker_callback
File "pydantic/mypy.py", line 321, in pydantic.mypy.PydanticModelTransformer.transform
File "pydantic/mypy.py", line 500, in pydantic.mypy.PydanticModelTransformer.add_construct_method
TypeError: init() missing required argument 'default' (pos 6)
/Users/scottmat/Development/gpo/venv/lib/python3.10/site-packages/pydantic/env_settings.py:22: : note: use --pdb to drop into pdb

Your Environment

mypy --show-traceback .
Python version: Python 3.10.10
mypy version: 1.4.1
pydantic version: 1.10.7

Configuration in pyproject:

[tool.mypy]
plugins = ["pydantic.mypy","sqlalchemy.ext.mypy.plugin"]
[tool.pydantic-mypy]
init_forbid_extra = true
init_typed = true
warn_required_dynamic_aliases = true
warn_untyped_fields = true

@scottmatth scottmatth added the bug mypy got something wrong label Jul 3, 2023
@AlexWaygood
Copy link
Member

Duplicate of #15485.

It's an issue with pydantic's mypy plugin rather than mypy itself. You'll need to upgrade your version of pydantic; it's fixed in the latest pydantic version.

@AlexWaygood AlexWaygood closed this as not planned Won't fix, can't repro, duplicate, stale Jul 3, 2023
@scottmatth
Copy link
Author

Duplicate of #15485.

It's an issue with pydantic's mypy plugin rather than mypy itself. You'll need to upgrade your version of pydantic; it's fixed in the latest pydantic version.

Thank you. I'll try that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong
Projects
None yet
Development

No branches or pull requests

2 participants