Skip to content

Phase 4: continue gradual mypy typing (next slice of #46) #49

Description

@subindevs

Follow-up to #46, continuing after #48 (Phases 1-3: setup, implicit-Optional
fixes, StoreProtocol, and the gently.app.tools.* context-typing cleanup).

Current state (after #48)

With [[tool.mypy.overrides]] stripped, mypy . reports 369 errors across
79 of 300 source files
(down from 3002 errors / 225 files at the start of
#46). Breakdown by error code:

Code Count
union-attr 117
assignment 69
var-annotated 42
attr-defined 40
arg-type 31
return-value 24
index 11
operator 10
misc 9
dict-item 8
other (no-redef, name-defined, valid-type, type-var, override, list-item) 8

By subsystem (top-level package, error count / file count):

Package Errors Files
scripts 68 7
gently/hardware 58 9
gently/app 51 6
gently/dataset 47 3
gently/harness 39 16
(remaining: diagnostics, gently top-level, gently/eval, tests, launch_gently.py, gently/ml, gently/organisms, examples) 39 19
gently/core 21 5
gently/mesh 15 3
benchmarks/perception 15 3
gently/ui 12 6
gently/analysis 4 2

(Total: 369 / 79, verified — replaces an earlier version of this table whose
rows summed to ~439 and significantly overstated gently/harness,
gently/app, gently/ui, gently/analysis, and gently/mesh.)

Candidate next targets

Per #46's "follow-up issues per subsystem" approach, a few concentrated
clusters look like good single-PR phases (each needs its own root-cause pass
like #48's Phase 3 did for the context dict pattern):

  • gently/dataset/* (3 modules, 47 errors) — aggregator.py (31),
    explorer_server.py (11), embryo_dataset.py (5). The densest cluster:
    47 errors in just 3 files.
  • gently/hardware/dispim/* (8 modules, 56 errors) — the device-control
    layer: device_layer.py (14), client.py (14), sam_detection.py (10),
    device_factory.py (10), plus 4 smaller devices//plans/ modules
    (3 + 2 + 2 + 1).
  • gently/app/agent.py + gently/app/orchestration/timelapse.py
    (28 + 10 = 38 errors) — the core agent/timelapse loop; may share a root
    cause the way gently.app.tools.* did.
  • gently/mesh/* (3 modules, 15 errors) — peer_client.py (13) +
    discovery.py (1) + capability_provider.py (1).

Carried over from #48

  • gently/harness/detection/queue.py — 2 of its errors match the Phase 3
    context.get(...) pattern, but it also has 3 unrelated errors
    (var-annotated, an "object" attribute access, and an unsupported
    indexed assignment) that need separate investigation.

Tasks

  • Pick one cluster above (or another concentration) as the Phase 4 scope
  • Root-cause analysis + short plan (à la Gradually introduce mypy type checking (Phases 1-3) #48's Phase 3)
  • Implement, re-measure, remove cleared modules from
    [[tool.mypy.overrides]]
  • File the next follow-up issue and repeat until the override list is
    empty

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions