Skip to content

fix: release 0.7.4 with openai as a base dependency - #209

Merged
spillai merged 2 commits into
mainfrom
cursor/fix-openai-cli-dependency-70b3
Aug 19, 2026
Merged

fix: release 0.7.4 with openai as a base dependency#209
spillai merged 2 commits into
mainfrom
cursor/fix-openai-cli-dependency-70b3

Conversation

@spillai

@spillai spillai commented Aug 19, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes ModuleNotFoundError: No module named 'openai' when running uvx vlmrun@latest --version.

Root cause

PyPI vlmrun==0.7.3 imports openai at CLI startup (chat.py, agent.py) but only declares it under optional extras (cli, openai, all). PR #208 moved openai>=1.0.0 into base dependencies on main, but that change was never released.

Changes

Testing

  • python3 -m pytest -sv tests/cli/test_cli_chat.py tests/common/test_dependencies.py tests/test_gateway.py

Release note

After merging, publish 0.7.4 to PyPI so uvx vlmrun@latest installs openai automatically.

Slack Thread

Open in Web Open in Cursor 

PyPI vlmrun 0.7.3 imports openai in the CLI but only declares it as an
optional extra, causing ModuleNotFoundError on uvx vlmrun@latest.

- Lazy-load openai in chat CLI error handling and agent completions
- Add regression test ensuring vlmrun --version works without openai
- Bump version to 0.7.4 for release (openai>=1.0.0 already in base deps)

Co-authored-by: Sudeep Pillai <sudeep.pillai@gmail.com>
Comment thread vlmrun/client/agent.py Outdated
@spillai
spillai marked this pull request as ready for review August 19, 2026 17:16

@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 found 1 potential issue.

View 1 additional finding in Devin Review.

Open in Devin Review

Comment thread vlmrun/cli/_cli/chat.py Outdated
Comment on lines +44 to +48
openai = require_openai()
AuthenticationError = openai.AuthenticationError
RateLimitError = openai.RateLimitError
APIConnectionError = openai.APIConnectionError
APIError = openai.APIError

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.

🟡 Chat and gateway commands crash with a raw traceback when the OpenAI package is missing

The error handler tries to load the OpenAI package (require_openai() at vlmrun/cli/_cli/chat.py:44) before it decides how to report a failure, so when that package is absent the command aborts with an unhandled traceback instead of the friendly error panel.
Impact: Users without the OpenAI package see a confusing stack trace rather than a clear message and clean exit code.

Missing dependency raised while handling an exception replaces the original error

handle_api_errors.__exit__ is entered whenever a wrapped call fails (used at vlmrun/cli/_cli/chat.py:753, vlmrun/cli/_cli/chat.py:765, vlmrun/cli/_cli/chat.py:823, and in vlmrun/cli/_cli/gateway.py:369 etc.). If openai cannot be imported, require_openai() raises DependencyError (vlmrun/common/dependencies.py:24-30) from inside __exit__, which propagates out of the with block and suppresses/masks the original exception (e.g. the DependencyError raised lazily by Agent.completions at vlmrun/client/agent.py:310). None of the Panel messages are printed and typer.Exit(1) is never raised, so the CLI terminates with a traceback. Given this PR exists precisely to keep the CLI usable when openai is unavailable, the fallback should catch the import failure and use the generic "Unexpected Error" path.

Suggested change
openai = require_openai()
AuthenticationError = openai.AuthenticationError
RateLimitError = openai.RateLimitError
APIConnectionError = openai.APIConnectionError
APIError = openai.APIError
try:
openai = require_openai()
except Exception:
console.print(
Panel(
str(exc_val),
title="[red]Unexpected Error[/red]",
title_align="left",
border_style="red",
)
)
raise typer.Exit(1)
AuthenticationError = openai.AuthenticationError
RateLimitError = openai.RateLimitError
APIConnectionError = openai.APIConnectionError
APIError = openai.APIError
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

Comment thread vlmrun/cli/_cli/chat.py Outdated

from vlmrun.client import VLMRun
from vlmrun.client.types import AgentSkill, AgentToolset, FileResponse
from vlmrun.common.dependencies import require_openai

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Revert this, and simply use the old import way

@spillai spillai left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Review the comments.

@nwaughachukwuma

nwaughachukwuma commented Aug 19, 2026

Copy link
Copy Markdown
Collaborator

@cursoragent, please followup

@cursor

cursor Bot commented Aug 19, 2026

Copy link
Copy Markdown

Addressed the PR review feedback in PR #209.

Changes made per review:

  • Reverted agent.py to direct from openai import AsyncOpenAI, OpenAI
  • Reverted chat.py to direct from openai import APIConnectionError, APIError, AuthenticationError, RateLimitError
  • Removed tests/cli/test_cli_import.py (it tested the lazy-import behavior we're no longer using)

What the PR does now:
The fix is the 0.7.4 version bump so PyPI ships with openai>=1.0.0 as a base dependency (already in requirements/requirements.txt from #208, but never released). Once 0.7.4 is published, uvx vlmrun@latest will install openai automatically and the ModuleNotFoundError goes away.

Tests pass (134 passed). Ready for merge and release.

Open in Web Open in Cursor 

@cursor

cursor Bot commented Aug 19, 2026

Copy link
Copy Markdown

PR review feedback is already addressed on the branch. Here's the status:

Done in 42f8bc7:

  • Reverted agent.py to from openai import AsyncOpenAI, OpenAI
  • Reverted chat.py to direct from openai import ... imports
  • Removed the lazy-import regression test

What the PR does now:
It's a minimal 0.7.4 version bump. The actual fix is shipping openai>=1.0.0 as a base dependency — already in requirements/requirements.txt from #208, but never released to PyPI. Once 0.7.4 is published, uvx vlmrun@latest will install openai automatically.

Also updated:

  • PR title → fix: release 0.7.4 with openai as a base dependency
  • PR description updated to match
  • Marked ready for review
  • Posted a comment on the PR summarizing the changes

PR #209 is ready to merge and release.

Open in Web Open in Cursor 

Per review feedback, keep direct openai imports in agent.py and chat.py.
The fix is releasing 0.7.4 with openai>=1.0.0 in base dependencies
(already in requirements.txt from #208).

Co-authored-by: Sudeep Pillai <sudeep.pillai@gmail.com>
@nwaughachukwuma

Copy link
Copy Markdown
Collaborator

Taking a look!

Open in Web Open in Cursor

Cool. While at it, please fix the failing test. @cursoragent

@cursor

cursor Bot commented Aug 19, 2026

Copy link
Copy Markdown

Addressed review feedback in 42f8bc7:

  • Reverted lazy require_openai() usage in agent.py and chat.py — back to direct from openai import ... imports
  • Removed the lazy-import regression test (test_cli_import.py)

The PR is now a minimal 0.7.4 version bump to ship the openai>=1.0.0 base dependency that #208 already added to requirements/requirements.txt but never released to PyPI.

@cursor cursor Bot changed the title fix: include openai in base install and lazy-load CLI imports fix: release 0.7.4 with openai as a base dependency Aug 19, 2026
@dineshreddy91

Copy link
Copy Markdown
Contributor

Looks good

@spillai
spillai requested a review from dineshreddy91 August 19, 2026 17:38
@spillai
spillai merged commit a26b317 into main Aug 19, 2026
4 checks passed
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.

4 participants