Skip to content

fix: add InferenceResult, ModelOutput, ModelRepository, FileUploadResult to __all__#199

Open
amathxbt wants to merge 1 commit intoOpenGradient:mainfrom
amathxbt:fix/init-all-missing-type-exports
Open

fix: add InferenceResult, ModelOutput, ModelRepository, FileUploadResult to __all__#199
amathxbt wants to merge 1 commit intoOpenGradient:mainfrom
amathxbt:fix/init-all-missing-type-exports

Conversation

@amathxbt
Copy link
Contributor

Bug

Four types are imported at the top level of src/opengradient/__init__.py but are missing from __all__:

  • InferenceResult
  • ModelOutput
  • ModelRepository
  • FileUploadResult
# They ARE imported (visible via direct import)
from .types import (
    ...
    FileUploadResult,
    InferenceResult,
    ModelOutput,
    ModelRepository,
    ...
)

# But NOT in __all__ (invisible via wildcard import)
__all__ = [
    "LLM", "Alpha", ...
    # InferenceResult, ModelOutput, ModelRepository, FileUploadResult MISSING
]

Impact

Problem Description
from opengradient import * Silently omits these 4 types — wildcard imports break
IDE auto-completion Types not suggested as publicly exported
Type stubs / docs Missing from generated __all__-based docs
hasattr(og, "InferenceResult") Returns True (they ARE importable) — inconsistent with __all__

Note: Direct imports still work (from opengradient import InferenceResult) — this is a __all__ correctness fix.

Fix

Add the four missing types to __all__:

__all__ = [
    "LLM", "Alpha", "ModelHub", "Twins",
    "TEE_LLM", "InferenceMode",
    "InferenceResult",    # added
    "ModelOutput",        # added
    "ModelRepository",    # added
    "FileUploadResult",   # added
    ...
]

…ult to __all__

These four types are imported at the top of __init__.py and are part of
the public API surface, but were missing from __all__.

This means 'from opengradient import *' silently omits them, breaking
any user code that relies on wildcard imports. It also misleads static
analysis tools and IDE auto-completion into thinking these types are
not publicly exported.
@amathxbt
Copy link
Contributor Author

@adambalogh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant