Support top-level VLMRun import#192
Conversation
There was a problem hiding this comment.
Code Review
This pull request exposes the main VLMRun client and package version at the top level of the vlmrun package, updating the documentation and adding tests to verify this behavior. The review feedback suggests removing the legacy pkgutil.extend_path namespace package support from vlmrun/__init__.py to avoid potential import conflicts and unexpected behavior.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
| from pkgutil import extend_path | ||
|
|
||
| __path__ = extend_path(__path__, __name__) | ||
|
|
||
| from vlmrun.client import VLMRun | ||
| from vlmrun.version import __version__ | ||
|
|
||
| __all__ = ["VLMRun", "__version__"] |
There was a problem hiding this comment.
Using pkgutil.extend_path to support namespace packages while also defining a top-level __init__.py is a legacy and fragile pattern in modern Python (PEP 420).
If vlmrun is a self-contained package (which it appears to be, containing client, common, constants, etc.), you do not need namespace package support. Using extend_path can cause unexpected behavior, such as path pollution or import conflicts if a user has a local directory named vlmrun in their sys.path.
If vlmrun is indeed not intended to be shared as a namespace package across separate, independently installed distributions, it is highly recommended to remove these lines.
| from pkgutil import extend_path | |
| __path__ = extend_path(__path__, __name__) | |
| from vlmrun.client import VLMRun | |
| from vlmrun.version import __version__ | |
| __all__ = ["VLMRun", "__version__"] | |
| from vlmrun.client import VLMRun | |
| from vlmrun.version import __version__ | |
| __all__ = ["VLMRun", "__version__"] |
|
Addressed the Gemini review suggestion in 8f82807. What changed:
Local validation:
The pushed change itself is limited to removing the namespace-package compatibility block that the review called out. |
Summary
vlmrunpackage interface exportingVLMRunand__version__vlmrun-hubviapkgutil.extend_pathfrom vlmrun import VLMRun__all__Validation
.venv/bin/python -m pytest -q tests/test_client.py-> 10 passed, 2 skipped.venv/bin/black --check vlmrun/__init__.py tests/test_client.py.venv/bin/pre-commit run ruff --files vlmrun/__init__.py tests/test_client.pyfrom vlmrun import VLMRun;from vlmrun.hub.utils import jsonschema_to_modelFixes #130