Skip to content

fix(models): repair __all__ so from model_api.models import * works - #653

Open
Anai-Guo wants to merge 1 commit into
open-edge-platform:masterfrom
Anai-Guo:fix-models-all-exports
Open

fix(models): repair __all__ so from model_api.models import * works#653
Anai-Guo wants to merge 1 commit into
open-edge-platform:masterfrom
Anai-Guo:fix-models-all-exports

Conversation

@Anai-Guo

Copy link
Copy Markdown

Issue

model_api.models.__all__ lists four names the module does not define, so a star-import fails outright:

>>> from model_api.models import *
AttributeError: module 'model_api.models' has no attribute 'Label'

(reproduced on master at e6252ec with openvino installed)

The four names, and why they differ

name status fix
Label real, just not re-exported. models/result/__init__.py lists it in its own __all__, and it is used across the package (classification.py, action_classification.py) add it to the from .result import (...) block
YOLOv3ONNX mis-cased copy of YoloV3ONNX — the name yolo.py actually defines (L602) and which __all__ already lists at L109 drop from __all__
YOLOv4 mis-cased copy of YoloV4 (yolo.py L371), already listed at L110 drop from __all__
SalientObjectDetectionModel appears nowhere else in the repository — no module, test or doc references it; leftover from a class that no longer exists drop from __all__

So Label is a missing export, and the other three are stale entries. Note the two mis-cased YOLO names were pure duplication: the correctly-cased YoloV3ONNX/YoloV4 are already exported, so dropping the typos removes nothing from the public surface.

Verification

Against the working tree, with openvino installed:

before after
from model_api.models import * AttributeError: … has no attribute 'Label' succeeds, binds 47 names
[n for n in models.__all__ if not hasattr(models, n)] ['Label', 'SalientObjectDetectionModel', 'YOLOv3ONNX', 'YOLOv4'] []
duplicate __all__ entries []
YoloV3ONNX / YoloV4 still exported yes yes

Lint: ruff v0.6.2 (the revision pinned in .pre-commit-config.yaml), run from model_api/ so it picks up model_api/pyproject.toml, reports the same 3 pre-existing errors before and after; ruff format --check reports the file already formatted.

+1 / −3, single file.

🤖 Generated with Claude Code

model_api.models.__all__ lists four names the module does not define,
so a star-import fails outright:

    >>> from model_api.models import *
    AttributeError: module 'model_api.models' has no attribute 'Label'

The four fall into two groups.

Label is real - result/__init__.py exports it and it is used across the
package (classification.py, action_classification.py) - it was just
never re-exported here. Added it to the `from .result import (...)`
block.

The other three are stale:

  * YOLOv3ONNX / YOLOv4 are mis-cased copies of YoloV3ONNX / YoloV4,
    the names yolo.py actually defines and which __all__ already lists
    a few lines further down.
  * SalientObjectDetectionModel appears nowhere else in the repository -
    not in any module, test or doc - so it is a leftover from a class
    that no longer exists.

Removed all three from __all__.

Verified against the tree: before the change `from model_api.models
import *` raises AttributeError; after it binds 47 names, every
__all__ entry resolves via hasattr, and __all__ has no duplicates.
ruff (v0.6.2, the pinned pre-commit revision, run from the package
root so it picks up model_api/pyproject.toml) reports the same three
pre-existing errors before and after, and `ruff format --check` is
clean.

+1/-3, single file.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@Anai-Guo
Anai-Guo requested a review from a team as a code owner September 12, 2026 13:52
@github-actions github-actions Bot added the python python related changes label Sep 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

python python related changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant