FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

mypy INTERNAL ERROR with v1.18.1, related to pydantic · Issue #19835 · python/mypy · GitHub

Repository navigation

mypy INTERNAL ERROR with v1.18.1, related to pydantic #19835

Closed

Description

Crash Report

mypy crashes when running it on our internal package. this started happening with v1.18.1, it works with v1.17.1

Traceback

.venv/lib/python3.12/site-packages/pydantic/env_settings.py:23: 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.18.1
Traceback (most recent call last):
  File "mypy/semanal.py", line 7350, in accept
  File "mypy/nodes.py", line 1440, in accept
  File "mypy/semanal.py", line 1775, in visit_class_def
  File "mypy/semanal.py", line 1991, in analyze_class
  File "mypy/semanal.py", line 2038, in analyze_class_body_common
  File "mypy/semanal.py", line 2123, in apply_class_plugin_hooks
  File "pydantic/mypy.py", line 156, in pydantic.mypy.PydanticPlugin._pydantic_model_class_maker_callback
  File "pydantic/mypy.py", line 319, in pydantic.mypy.PydanticModelTransformer.transform
  File "pydantic/mypy.py", line 529, in pydantic.mypy.PydanticModelTransformer.add_construct_method
  File "pydantic/mypy.py", line 868, in pydantic.mypy.add_method
TypeError: tuple object expected; got list

To Reproduce

install eo-grow from https://github.com/sentinel-hub/eo-grow in dev mode and run mypy eogrow with mypy version v1.18.1

git clone https://github.com/sentinel-hub/eo-grow 
cd eo-grow
pip install -e .[dev]
mypy eogrow

Your Environment

  • Mypy version used: 1.18.1
  • Python version used: 3.12.11
  • Pydantic version used: 1.10.22
  • Operating system and version: mac OS, and also gitlab CI

pyproject.toml relevant content:

[tool.mypy]
follow_imports = "normal"
ignore_missing_imports = true
show_column_numbers = true
show_error_codes = true
no_implicit_optional = true
warn_redundant_casts = true
warn_unused_ignores = true
disallow_untyped_defs = true
disallow_untyped_decorators = true
warn_unreachable = true
strict_equality = true
pretty = true
plugins = ["pydantic.mypy"]
files = ["eogrow"]

[tool.pydantic-mypy]
# init_forbid_extra = true  # cant be used unless we change managers
init_typed = true

Activity

  1. ilevkivskyi commented on Sep 12, 2025

    Member

    Hm, it looks like this is caused by #19768 cc @JukkaL I would say type attribute setter type is technically private API, as types should be considered immutable by plugins (and .copy_modified() should be used instead). But can totally see how some people think this is public API. So even if we will not revert this, we need to mention such changes in the plugin announcement issue #6617

    Btw I see this was already fixed in Pydantic main branch pydantic/pydantic#12209 and see people already talking there about backporting this to v1.x

    @mlubej Does this also happen with Pydantic v2.x latest?

  2. mlubej commented on Sep 12, 2025

    Author

    @mlubej Does this also happen with Pydantic v2.x latest?

    I'm sorry, I wouldn't know, and I can't update pydantic to v2 because there are significant changes we'd need to implement, which we will in due time, but don't have resources right now

  3. DanielNoord commented on Sep 12, 2025

    Contributor

    We have successfully applied the patches from the PR @ilevkivskyi linked to pydantic in our environment. This did fix the issue for us.

    It is quite a bit of work, but this should be filed against pydantic. Although perhaps more as another request to release the fix, as they have already committed a fix. mypy can't do much.

  4. JukkaL commented on Sep 12, 2025

    Collaborator

    Wrote a comment in the plugin API issue about the change in CallableType: #6617 (comment)

  5. cdce8p commented on Sep 13, 2025

    Collaborator

    Pydantic released new versions today which resolve the issue. Going to close this one.
    https://github.com/pydantic/pydantic/releases/tag/v1.10.23
    https://github.com/pydantic/pydantic/releases/tag/v2.11.9

  6. cdce8p commented on Sep 13, 2025

    Collaborator

    @emmatyping I think this can be closed now or is there a reason to keep it open?

  7. emmatyping commented on Sep 13, 2025

    Member

    Uhhh, weird. I definitely did not intentionally re-open this issue. I am extremely confused how this could have happened. Perhaps some stray keyboard input re-opened without me realizing? Guess I should go rotate my credentials just in case...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    crashtopic-pluginsThe plugin API and ideas for new plugins

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL