[HIGH PRIORITY] mypy is not run anywhere in CI or dev tooling
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 48/100
Hướng nghiên cứu
Bắt đầu bằng cách đọc pyproject.toml, .github/workflows/*.yml và machinevisiontoolbox/base/init.py; chạy lệnh mypy được ghi trong tài liệu để xác nhận đường cơ sở gồm 524 lỗi. So sánh các export của các submodule và những job CI hiện có, sau đó làm cho cấu hình kiểm tra kiểu trở nên rõ ràng mà không cố gắng giải quyết mọi lỗi được báo cáo. Công việc được xem là hoàn tất khi mypy được đưa vào các công cụ phát triển và một job CI báo cáo kết quả của nó, với các re-export của base được xử lý trong phạm vi đã xác định.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Found 2026-07-29 while fixing the _ImageBase Protocol gaps in
ImageBlobs.py/ImageRegionFeatures.py/ImagePointFeatures.py
(see git history — three mixins were missing the
class XMixin(_ImageBase if TYPE_CHECKING else object) pattern every
other mixin uses). That fix prompted the question: if a new method is
added to a mixin and it's accessed via self. from a different
mixin, and it's not yet declared in _image_typing.py's _ImageBase
Protocol, what actually catches that? Answer: nothing, currently.
mypy is not in pyproject.toml's dev extra and does not run in any
.github/workflows/*.yml — confirmed by grep, zero hits. So a Protocol
gap like this doesn't fail a build or even show a warning; it just
silently produces incomplete/wrong type information for anyone using an
editor with type-checking (Pylance, mypy in an IDE), with no automated
signal anywhere. This is the quietest version of a pattern that's
already bitten this project twice today in more visible forms (the
image_class.rst autosummary list silently going stale for the whole
Image sidebar, and ci.yml's conda create-args list silently
missing pgraph-python/drifting on opencv) — a hand-maintained
shadow list with no automated check that it stays in sync with reality.
Ran mypy src/machinevisiontoolbox --ignore-missing-imports fresh,
2026-07-29 (superseding the stale, less-categorized April audit in
NOTES): 524 errors in 31 files (checked 49 source files). By
category:
| Code | Count |
|---|---|
attr-defined |
84 |
assignment |
82 |
union-attr |
76 |
index |
75 |
arg-type |
53 |
misc |
26 |
name-defined |
24 |
var-annotated |
18 |
valid-type |
15 |
operator |
15 |
call-overload |
14 |
return-value |
13 |
has-type |
11 |
return |
6 |
no-redef |
5 |
override |
4 |
method-assign |
2 |
call-arg |
1 |
Correcting an initial hypothesis: expected most attr-defined
errors to trace to incomplete _ImageBase coverage (only ~96 of
Image's ~290 public members are declared — by design, since the
Protocol only needs to cover attributes actually cross-referenced
between mixins, not the full public API). Checked the real breakdown
instead of assuming: none of the current attr-defined errors are
actually _ImageBase gaps. The two real dominant causes are unrelated:
- 23 of 84:
machinevisiontoolbox/base/__init__.pyre-exports every
submodule via wildcardfrom X import *(9 submodules) with no
explicit__all__/direct re-export list; mypy can't reliably resolve
names through that chain, so every file that does
from machinevisiontoolbox.base import (draw_circle, plot_labelbox, findpeaks2d, ...)gets a false "module has no attribute" even though
these work fine at runtime. - 8 of 84:
cv2.<X>_createdynamic dispatch (getattr(cv2, ...)/
getattr(cv2.xfeatures2d, ...)patterns inImagePointFeatures.py's
feature-detector dict) — mypy can't type-check dynamic attribute
access, expected and low-value to fix. - The remaining ~53 are scattered;
VisualServo.pyalone accounts for
44 of the 84attr-definederrors (a mix of real typos like
"plotpose"; maybe "plot_pose"?and missingmachinevisiontoolbox.base
attributes via the same wildcard-import issue) and is worth its own
look independent of the mixin-Protocol question that prompted this
audit.
The _ImageBase-completeness risk described above is still real, just
currently latent rather than demonstrated by a live error — worth
re-running this same mypy audit after any future mixin refactor to
catch it if it does start manifesting.
Fix
Two independent pieces, roughly in priority order:
- Fix
machinevisiontoolbox/base/__init__.py's wildcard re-exports
(add explicit__all__composed from each submodule's own__all__,
or switch to explicitfrom X import (name1, name2, ...)— either
should immediately clear ~23+ of theattr-definedcount and is a
mechanical, low-risk change). - Wire
mypyinto CI (even just as a non-blocking/advisory job at
first, given 524 existing errors) so future drift is visible instead
of silent. Addmypytopyproject.toml'sdevextra either way.
Do not attempt to fix all 524 errors in one pass — triage by category
(the[call-arg]/[override]/[return]categories are more likely to
be real bugs;assignment/arg-type/indexare more likely the
ArrayLike-union-too-broad pattern the AprilNOTESaudit already
identified).
- Ngôn ngữ chính
- Python
- Star
- 220
- Fork
- 30
- Merge trung bình
- 12 ngày 23 giờ
- Pull request đã merge (30 ngày)
- 5
Chuẩn bị môi trường
Chúng tôi chưa kiểm tra các tệp thiết lập môi trường của dự án này. Hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của petercorke/machinevision-toolbox-python
-
tech-debt
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
-
tech-debt
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
-
tech-debt
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 52/100
-
tech-debt
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 72/100
-
tech-debt
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 76/100
Tất cả issue của petercorke/machinevision-toolbox-python
Issue tương tự
-
[Bug] @deck.gl/arcgis dist import resolves to unpublished @deck.gl/core source path (9.3.11, 9.4.0)Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
workflow: a tick's dispatch counts as 'only this step', and no review self-grants a round unattendedĐang mởworkflow
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
kristofdegrave/homeassistant-smart-charging#1505 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
New Submission: TropWATERĐang mởmetadata submission
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
-
Wrongly named dashboard variableĐang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
canonical/content-cache-operator#163 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[submission]Đang mởsubmission
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 65/100
leanprover/lean-eval-submissions#1852 ·
Maintainer thường phản hồi trong vòng 1 ngày