Skip to content

Slim core dependencies; promote openai to base install - #208

Merged
spillai merged 1 commit into
mainfrom
cursor/slim-core-deps-0819
Aug 19, 2026
Merged

Slim core dependencies; promote openai to base install#208
spillai merged 1 commit into
mainfrom
cursor/slim-core-deps-0819

Conversation

@spillai

@spillai spillai commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Summary

Reduces the footprint of pip install vlmrun by moving heavy optional packages out of core and into extras, while making vlmrun gw chat work out of the box.

Changes

Core dependencies (smaller install)

Removed from requirements/requirements.txt:

  • pandas
  • opencv-python
  • IPython
  • tabulate (unused)
  • tqdm (unused)

Added to core:

  • openai>=1.0.0 (so CLI gateway chat works without extras)

Optional extras

  • video: numpy, opencv-python
  • doc: pypdfium2
  • all: video + doc + pandas + ipython
  • Removed redundant openai and cli extras (now included in base install)

Lazy imports + helpful errors

  • New vlmrun/common/dependencies.py with require_*() helpers that raise DependencyError with pip install vlmrun[<extra>] guidance
  • Lazy-loaded in types.py (MarkdownTable.to_dataframe), video.py, viz.py, and pdf.py

Other

  • Gateway health check now uses requests (core dep) instead of httpx
  • MarkdownTable.render() falls back to DataFrame.to_string() when tabulate is unavailable
  • Updated README / CLI docs / AGENTS.md

Testing

  • python3 -m pytest tests — 458 passed, 22 skipped

Slack Thread

Open in Web Open in Cursor 

Move heavy optional packages (pandas, opencv-python, IPython) out of core
into extras, with DependencyError helpers pointing at pip install vlmrun[all]
or vlmrun[video]. Promote openai to core so vlmrun gw chat works out of the
box with pip install vlmrun or uvx vlmrun. Remove redundant openai and cli
extras.

Co-authored-by: Sudeep Pillai <sudeep.pillai@gmail.com>
@spillai
spillai marked this pull request as ready for review August 19, 2026 03:48

@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 3 potential issues.

View 1 additional finding in Devin Review.

Open in Devin Review

Comment thread vlmrun/client/gateway.py

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.

🔴 Gateway availability check crashes instead of reporting status

The gateway liveness check reads a success flag that does not exist on the new HTTP library's response object (resp.is_success at vlmrun/client/gateway.py:231), so any reachable gateway that answers the health request makes the check blow up instead of returning true/false.
Impact: Users running gateway commands see an unexpected crash rather than a healthy/unhealthy result.

httpx→requests migration missed the response API difference

health() was switched from httpx.get to requests.get (vlmrun/client/gateway.py:210-216). httpx.Response exposes is_success, but requests.Response does not (it exposes ok), so line 231 raises AttributeError for every non-404 response. The exception is outside the try blocks (which only cover the request and the models fallback), so it propagates to callers such as the vlmrun gw CLI health checks. The tests still pass only because the fakes in tests/test_gateway.py:307-321 define an is_success attribute.

(Refers to line 231)

Open in Devin Review

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

Comment thread vlmrun/client/agent.py

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.

🟡 Documentation still claims chat completions raise a missing-dependency error

The completions helpers still document a missing-dependency error (Raises: DependencyError at vlmrun/client/agent.py:305 and vlmrun/client/agent.py:350) even though the OpenAI SDK is now imported unconditionally at module level, so the docs no longer match behavior.
Impact: Readers are told about an error condition that can never occur, which is misleading.

Docstrings not updated with the import change

agent.py now does from openai import AsyncOpenAI, OpenAI at the top (vlmrun/client/agent.py:22) and the try/except that raised DependencyError was removed from both completions and async_completions. AGENTS.md requires docstrings/docs be updated when the implementation deviates; the Raises: sections should be dropped (or replaced with an ImportError note).

(Refers to lines 304-306)

Open in Devin Review

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

Comment thread vlmrun/client/types.py
Comment on lines +833 to +839
if self.content:
return self.content
df = self.to_dataframe(header="name")
try:
return df.to_markdown()
except ImportError:
return df.to_string(index=False)

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.

🟡 Reading document results can fail on the slim install when a table has no pre-rendered text

Table text is now produced by building a data frame with a library that is no longer installed by default (require_pandas() at vlmrun/client/types.py:808), so parsing a document result whose table lacks pre-rendered content raises a missing-dependency error.
Impact: Base-install users can hit a hard failure just from receiving a document extraction response.

Rendering happens eagerly during model validation

MarkdownPage.render_markdown is a model_validator(mode="after") (vlmrun/client/types.py:856-860) that calls render(), which calls each MarkdownTable.render() (vlmrun/client/types.py:866-874). MarkdownTable.render() returns self.content when present, but otherwise falls through to to_dataframe(header="name"), which now calls require_pandas() before the surrounding try, so a DependencyError escapes and aborts response validation. Previously pandas was a core requirement, so this path could not fail. Consider degrading gracefully (e.g. emit a plain-text/markdown table without pandas, or return the raw content/empty string) instead of raising during parsing.

Open in Devin Review

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

@spillai
spillai merged commit d41ab9b into main Aug 19, 2026
5 checks passed
cursor Bot pushed a commit that referenced this pull request Aug 19, 2026
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>
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.

3 participants