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

INTERNAL ERROR while running mypy 1.4 on Python 3.11.3 with Poetry #15492

Closed
Valaraucoo opened this issue Jun 21, 2023 · 1 comment
Closed

INTERNAL ERROR while running mypy 1.4 on Python 3.11.3 with Poetry #15492

Valaraucoo opened this issue Jun 21, 2023 · 1 comment
Labels

Comments

@Valaraucoo
Copy link

Crash Report

When running mypy on my application code using Poetry (version 1.3.2) I get INTERNAL ERROR every time. To run mypy, I use the following command: poetry run mypy app, where app is the folder containing my application code.

Traceback

/Users/kamil.wozniak/code/halina/.venv/lib/python3.11/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.0
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/kamil.wozniak/code/halina/.venv/lib/python3.11/site-packages/pydantic/env_settings.py:22: : note: use --pdb to drop into pdb

To Reproduce

I'm using Poetry (version 1.3.2) and mypy version (1.4). Moreover I'm using mypy's plugin for pydantic defined in pyproject.toml:

# pyproject.toml
[tool.mypy]
ignore_missing_imports = true
strict_optional = true
show_error_codes = true
plugins = ['pydantic.mypy']

The pydantic version I'm using is 1.10.7. To run mypy, I use the following command: poetry run mypy app, where app is the folder containing my application code.

Please note, that all works fine for mypy version 1.3 without any errors.

Your Environment

  • Mypy version used: 1.4
  • Mypy command-line flags:
  • Mypy configuration options from mypy.ini (and other config files):
# pyproject.toml
[tool.mypy]
ignore_missing_imports = true
strict_optional = true
show_error_codes = true
plugins = ['pydantic.mypy']
  • Python version used: 3.11.3
  • Operating system and version: MacOS Ventura 13.0 M1
@AlexWaygood
Copy link
Member

Duplicate of #15485. Upgrading to the latest version of pydantic should fix it.

@AlexWaygood AlexWaygood closed this as not planned Won't fix, can't repro, duplicate, stale Jun 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants