python / python/mypy

dmypy "Daemon crashed!" with KeyError: 'sqlalchemy.orm'

未关闭
#9,366 17 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

crash priority-0-high topic-daemon
主要语言
Python
星标
20.6k
派生
3.3k
PR 合并指标
PR 指标待抓取

描述

Below is a repeatable dmypy invokation sequence showing a crash due to KeyError. Is there a way to get better debug output to help resolve this?

$ dmypy run -- --config-file /home/russ/pcode/edms/server/../env/mypy.ini --strict /home/russ/pcode/edms/server/deleteme.py 
Daemon started
deleteme.py:3:3: error: Unsupported operand types for + ("int" and "str")  [operator]
Found 1 error in 1 file (checked 21 source files)
$
$ dmypy run -- --config-file /home/russ/pcode/edms/server/../env/mypy.ini --strict /home/russ/pcode/edms/server/deleteme.py 
deleteme.py:3:3: error: Unsupported operand types for + ("int" and "str")  [operator]
Found 1 error in 1 file (checked 1 source file)
$
$ dmypy run -- --config-file /home/russ/pcode/edms/server/../env/mypy.ini --strict /home/russ/pcode/edms/server/deleteme.py 
deleteme.py:3:3: error: Unsupported operand types for + ("int" and "str")  [operator]
Found 1 error in 1 file (checked 1 source file)
$
$ dmypy run -- --config-file /home/russ/pcode/edms/server/../env/mypy.ini --strict /home/russ/pcode/edms/shared/deployment_check/deployment_check.py 
Success: no issues found in 1 source file
$
$ dmypy run -- --config-file /home/russ/pcode/edms/server/../env/mypy.ini --strict /home/russ/pcode/edms/server/server/EventLogger.py 
Daemon crashed!
Traceback (most recent call last):
  File "mypy/dmypy_server.py", line 223, in serve
  File "mypy/dmypy_server.py", line 266, in run_command
  File "mypy/dmypy_server.py", line 325, in cmd_run
  File "mypy/dmypy_server.py", line 387, in check
  File "mypy/dmypy_server.py", line 561, in fine_grained_increment_follow_imports
  File "mypy/dmypy_server.py", line 686, in direct_imports
KeyError: 'sqlalchemy.orm'

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

首先,使用所示的配置和源代码路径,通过 dmypy 重现 issue 中的命令序列。检查 mypy/dmypy_server.py 中 fine_grained_increment_follow_imports、direct_imports 以及针对 sqlalchemy.orm 报告的 KeyError 附近的代码。完成的标准是 daemon 不再崩溃,并且能为此案例提供有用的诊断输出。

由索引模型根据 Issue 内容生成。

评估

技术栈
python, sqlalchemy
领域
devtools
Issue 类型
缺陷
难度
3/5
预计耗时
1-2 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
35/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。