Skip to content

Support top-level VLMRun import#192

Open
RitwijParmar wants to merge 2 commits into
vlm-run:mainfrom
RitwijParmar:codex/top-level-vlmrun-import
Open

Support top-level VLMRun import#192
RitwijParmar wants to merge 2 commits into
vlm-run:mainfrom
RitwijParmar:codex/top-level-vlmrun-import

Conversation

@RitwijParmar

@RitwijParmar RitwijParmar commented Jun 6, 2026

Copy link
Copy Markdown

Summary

  • Add a top-level vlmrun package interface exporting VLMRun and __version__
  • Preserve namespace-package compatibility with vlmrun-hub via pkgutil.extend_path
  • Update README examples to use from vlmrun import VLMRun
  • Add a regression test for the top-level import and __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.py
  • Manual import check: from vlmrun import VLMRun; from vlmrun.hub.utils import jsonschema_to_model

Fixes #130

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread vlmrun/__init__.py Outdated
Comment on lines +5 to +12
from pkgutil import extend_path

__path__ = extend_path(__path__, __name__)

from vlmrun.client import VLMRun
from vlmrun.version import __version__

__all__ = ["VLMRun", "__version__"]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Suggested change
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__"]

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 2 additional findings.

Open in Devin Review

@RitwijParmar

Copy link
Copy Markdown
Author

Addressed the Gemini review suggestion in 8f82807.

What changed:

  • Removed the legacy pkgutil.extend_path namespace-package setup from vlmrun/init.py.
  • Kept the public top-level exports unchanged: VLMRun and version.

Local validation:

  • git diff --check passed.
  • I attempted pytest tests/test_client.py -q in a fresh Python 3.11 venv with .[test] installed. Test collection is currently blocked before tests run because the published vlmrun-hub dependency does not provide vlmrun.hub in this environment:
    ModuleNotFoundError: No module named 'vlmrun.hub'

The pushed change itself is limited to removing the namespace-package compatibility block that the review called out.

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.

Support top-level import for VLMRun class

1 participant