Skip to content

Star imports from mlserver.codecs not working #1153

Description

@jklaise

For example:

from mlserver.codecs import *

Throws an error:

Traceback (most recent call last):
  File "/home/janis/.conda/envs/py310/lib/python3.10/site-packages/IPython/core/interactiveshell.py", line 3460, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-2-b8cc62508f29>", line 1, in <module>
    from mlserver.codecs import *
AttributeError: module 'mlserver.codecs' has no attribute 'StringRequestCodec'

This is likely because __all__ is out-of-date with the actual imports. I haven't tested other sub-packages, but it might be worth looking at these.

P.S. I'm not a big fan of __all__ and star imports in particular, the main issue is that the existence of __all__ gives rise to two public APIs which may diverge (as it has in this case).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions