inference icon indicating copy to clipboard operation
inference copied to clipboard

inference.Model is in __all__ but does not resolve after the lazy-init rewrite

Open davidnichols-ops opened this issue 3 months ago • 1 comments

Repro (current main)

inference/__init__.py lists Model in __all__ and keeps the TYPE_CHECKING import, but _LAZY_ATTRIBUTES only registers Stream, InferencePipeline, get_model, and get_roboflow_model.

import inference
inference.Model               # AttributeError
from inference import Model   # ImportError

Siblings (Stream, get_model, …) resolve. Type checkers pass. Runtime fails.

Introduced by the lazy-init rewrite in #2833. Confirmed by reading origin/main: __all__ includes Model; _LAZY_ATTRIBUTES does not.

Why it matters

Anyone following the advertised package exports (from inference import Model) cannot import. Not a crash in get_model(), but a broken public contract.

Fix

#2844 — one line in _LAZY_ATTRIBUTES + test_model_lazy_export.

davidnichols-ops avatar Aug 24 '26 07:08 davidnichols-ops

Fixed by #2844

davidnichols-ops avatar Sep 03 '26 20:09 davidnichols-ops