Skip to content

Type-hint coverage: ~89% overall, remaining gaps in ImageCore, Sources, blocks, bin #60

Open

Description

@petercorke

Tracks type-hint coverage of src/machinevisiontoolbox. Last refreshed 2026-10-17.

An AST audit counts annotated parameters (excluding self/cls) and return types over every function and method under src/machinevisiontoolbox, including subpackages (bin/, blocks/).

2026-10-17
Parameter annotations 86.1% (1620 / 1881)
Return annotations 92.7% (1082 / 1167)
Average 89.4%

Correction to the original report. The 2026-08-10 figures (54.3% params, 74.9% average) were wrong: the audit script counted self/cls, which are never annotated. Recomputed without them on 2026-10-03 the figure was already about 86.8% params / 95.6% returns. So the overall picture is that coverage was always mostly good, and the real gaps are a few specific modules, not a broad shortfall. Per-module parameter coverage now:

Module Param %
ImageCore.py 57.0%
Sources.py 72.2%
BagOfWords.py 75.0% (more in #145)
ImageBlobs.py 80.4%
ImageRegionFeatures.py 100%
cvfuncs.py no longer present at that path

Remaining work

Annotated means present, not correct: see #40 for running mypy in CI so annotations are actually checked.

Largest gaps by unannotated parameters:

  • ImageCore.py: 61 of 142 parameters
  • Sources.py: 50 of 180
  • blocks/camera.py: 32 of 32 (no annotations at all)
  • bin/ scripts (mvtbtool, tagtool, bagtool, imtool, _iminteractive): almost entirely unannotated
  • Camera.py (14), ImagePointFeatures.py (12), ImageConstants.py (10), ImageBlobs.py (10), ImageIO.py (7)
  • Return annotations: a handful of functions across ImageConstants.py, ImageProcessing.py, ImageMultiview.py, Sources.py

Modules now at or near 100%: ImageSpatial, ImageMorph, ImageTensor, ImageRegionFeatures, VisualServo, BundleAdjust, PointCloud, Kernel, ImageFiducials.

Guidelines for contributions

  • Use modern syntax: X | Y, X | None, list[X]; not Union, Optional, List.
  • Arrays: use ArrayLike from machinevisiontoolbox.mvtb_types for arguments. (There is no NDArray alias there yet.)
  • Type hints replace :type:/:rtype: in docstrings; keep those only where array shape adds information.
  • Annotation-only changes please: no behaviour changes in the same PR.
  • The project's type checker is intended to be mypy (see Adopt mypy (as in RTB): 534 errors to ratchet down, not yet run in CI #40), not Pyright.

No architectural changes are needed, just incremental annotation additions per module.

Activity

  1. added
    tech-debtKnown technical debt / deferred cleanup, not a live bug
    on Aug 10, 2026
  2. changed the title [-]Type-hint coverage audit: ~75% overall, parameter annotations lagging in several modules[/-] [+]Type-hint coverage: ~89% overall, remaining gaps in ImageCore, Sources, blocks, bin[/+] on Oct 17, 2026
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

    tech-debtKnown technical debt / deferred cleanup, not a live bug

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions