python / python/mypy

mypy crashes with "Cannot find component" on subsequent runs

Đang mở
#18,751 8 bình luận 2 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

crash topic-daemon
Ngôn ngữ chính
Python
Star
20.6k
Fork
3.3k
Chỉ số merge pull request
Chỉ số pull request đang chờ

Mô tả

Crash Report

Running mypy after the first run sometimes crashes.

rm -rf .mypy_cache fixes the issue, but if I then run mypy a few more times, it crashes again.

Traceback

$ mypy
Traceback (most recent call last):
File "/path/to/mypy/mypy", line 8, in <module> sys.exit(console_entry())
File "/path/to/mypy/_-main_-.py",line 15, in console_entry main(
File "mypy/main.py", line 119, in main
File "mypy/main.py"
File "mypy/build.py"
, line 203, in run_build , line 191, in build
File "mypy/build.py", line 267, in _build File "mypy/build.py", line 2937, in dispatch
File "mypy/build.py" , line 3328, in process-graph
File "mypy/build.py",
File '
"mypy/build.py"
line 3409, in process_fresh-modules , line 2107, in fix_cross_refs
File "mypy/fixup.py" , line 52, in fixup-module
File
"mypy/fixup.py" , line 128, in visit_symbol_table
File "mypy/lookup.py", line 49, in lookup_fully_qualified
AssertionError: Cannot find component 'operators' for 'sqlalchemy.sql.operators'

To Reproduce

This is at work, and it's a rather large repo, so I can't provide easy repro steps. I would be happy to provide additional information that you need.

Your Environment

  • Mypy version used: v1.15.0
  • Mypy command-line flags:
  • Mypy configuration options from mypy.ini (and other config files):
[mypy]
mypy_path = server/python_stubs,server

files = server/,test/

explicit_package_bases = True
enable_incomplete_feature=InlineTypedDict

strict = True
warn_return_any = False
disallow_untyped_calls = False
no_implicit_reexport = False
warn_unreachable = True
plugins = pydantic.mypy

Additionally, we added ignore_missing_imports to most of our libraries.

  • Python version used:
  • python 3.11.11
  • Operating system and version:
  • macOS ventura

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Hướng nghiên cứu

Bắt đầu với đường dẫn traceback qua mypy/build.py, mypy/fixup.py và mypy/lookup.py, tập trung vào việc xử lý các module mới sau khi .mypy_cache được sử dụng lại. Nếu có thể, hãy tái hiện lỗi qua các lần chạy tiếp theo, sau đó xác minh rằng các lần chạy mypy lặp lại không còn gây ra AssertionError đã báo cáo.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
python, sqlalchemy
Lĩnh vực
tooling
Loại issue
Lỗi
Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Cần làm rõ
Mức phù hợp với người mới
25/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.