Conversation
Add py.typed marker files to all packages so that mypy recognizes inline type annotations when vision-agents is installed as a dependency. Since vision_agents is an implicit namespace package, markers are placed in each regular subpackage: core, testing, and all 31 plugins.
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughCI and pre-commit mypy invocations were routed through Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Developer
participant PreCommit as Pre-commit Hook
participant CI as CI Workflow
participant DevPy as dev.py
participant FS as Filesystem
participant Mypy as mypy
Developer->>PreCommit: commit -> trigger mypy hook (`uv run dev.py mypy`)
Developer->>CI: push -> CI runs (`uv run dev.py mypy-plugins`)
PreCommit->>DevPy: invoke `dev.py mypy`
CI->>DevPy: invoke `dev.py mypy-plugins`
DevPy->>FS: scan plugin roots -> build MYPYPATH via `_plugin_mypypath()`
DevPy->>Mypy: run mypy (env: MYPYPATH) with exclude `plugins/[^/]+/(tests|examples?)/`
Mypy-->>DevPy: return type results / exit code
DevPy-->>PreCommit: forward exit code / report
DevPy-->>CI: forward exit code / report
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Add plugin root directories to MYPYPATH so mypy resolves namespace packages correctly. Also exclude example/examples directories that conflict across plugins.
There was a problem hiding this comment.
🧹 Nitpick comments (1)
dev.py (1)
91-94: Consider usingos.pathsepfor cross-platform portability.The hardcoded colon separator works for Unix-like systems but would fail on Windows. If Windows development is ever needed,
os.pathsepprovides the correct separator per platform.♻️ Suggested improvement
def _plugin_mypypath() -> str: """Build MYPYPATH with all plugin root directories.""" - return ":".join(str(p) for p in sorted(Path(PLUGINS_DIR).iterdir()) if p.is_dir()) + return os.pathsep.join(str(p) for p in sorted(Path(PLUGINS_DIR).iterdir()) if p.is_dir())🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@dev.py` around lines 91 - 94, Replace the hardcoded ":" join in _plugin_mypypath with the platform-aware separator: import os and use os.pathsep when joining plugin directories from Path(PLUGINS_DIR). Keep the current behavior of filtering directories (p.is_dir()) and sorting, but build the string with os.pathsep so the function is portable across Windows and Unix-like systems.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@dev.py`:
- Around line 91-94: Replace the hardcoded ":" join in _plugin_mypypath with the
platform-aware separator: import os and use os.pathsep when joining plugin
directories from Path(PLUGINS_DIR). Keep the current behavior of filtering
directories (p.is_dir()) and sorting, but build the string with os.pathsep so
the function is portable across Windows and Unix-like systems.
ℹ️ Review info
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (36)
.github/workflows/run_tests.yml.pre-commit-config.yamlagents-core/vision_agents/core/py.typedagents-core/vision_agents/testing/py.typeddev.pyplugins/anthropic/vision_agents/plugins/anthropic/py.typedplugins/aws/vision_agents/plugins/aws/py.typedplugins/cartesia/vision_agents/plugins/cartesia/py.typedplugins/decart/vision_agents/plugins/decart/py.typedplugins/deepgram/vision_agents/plugins/deepgram/py.typedplugins/elevenlabs/vision_agents/plugins/elevenlabs/py.typedplugins/fast_whisper/vision_agents/plugins/fast_whisper/py.typedplugins/fish/vision_agents/plugins/fish/py.typedplugins/gemini/vision_agents/plugins/gemini/py.typedplugins/getstream/vision_agents/plugins/getstream/py.typedplugins/heygen/vision_agents/plugins/heygen/py.typedplugins/huggingface/vision_agents/plugins/huggingface/py.typedplugins/inworld/vision_agents/plugins/inworld/py.typedplugins/kokoro/vision_agents/plugins/kokoro/py.typedplugins/lemonslice/vision_agents/plugins/lemonslice/py.typedplugins/mistral/vision_agents/plugins/mistral/py.typedplugins/moondream/vision_agents/plugins/moondream/py.typedplugins/nvidia/vision_agents/plugins/nvidia/py.typedplugins/openai/vision_agents/plugins/openai/py.typedplugins/openrouter/vision_agents/plugins/openrouter/py.typedplugins/pocket/vision_agents/plugins/pocket/py.typedplugins/qwen/vision_agents/plugins/qwen/py.typedplugins/roboflow/vision_agents/plugins/roboflow/py.typedplugins/sample_plugin/vision_agents/plugins/example/py.typedplugins/smart_turn/vision_agents/plugins/smart_turn/py.typedplugins/turbopuffer/vision_agents/plugins/turbopuffer/py.typedplugins/twilio/vision_agents/plugins/twilio/py.typedplugins/ultralytics/vision_agents/plugins/ultralytics/py.typedplugins/vogent/vision_agents/plugins/vogent/py.typedplugins/wizper/vision_agents/plugins/wizper/py.typedplugins/xai/vision_agents/plugins/xai/py.typed
These py.typed files were placed at plugins/*/py.typed (the plugin project root), not inside the actual Python packages. PEP 561 requires the marker to be inside the importable package directory. The correct markers at plugins/*/vision_agents/plugins/*/py.typed were already added in 48efaae.
CI and pre-commit now delegate to `dev.py mypy` and `dev.py mypy-plugins` instead of duplicating MYPYPATH setup and --exclude patterns inline.
Also fix step numbering (was two "4", now 1-2-3-4-5).
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@dev.py`:
- Around line 91-94: The _plugin_mypypath function currently joins plugin dirs
with a hardcoded ":" which breaks on Windows; update _plugin_mypypath to use
os.pathsep when joining Path(PLUGINS_DIR).iterdir() entries (keep the sorting
and is_dir filter) so MYPYPATH is built platform‑independently; import os if
needed and ensure the returned string uses os.pathsep instead of ":".
ℹ️ Review info
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Disabled knowledge base sources:
- Linear integration is disabled
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (1)
dev.py
The broad pattern `/(tests|examples?)/` was excluding plugins/sample_plugin/vision_agents/plugins/example/ which is actual plugin code. Narrowed to `plugins/[^/]+/(tests|examples?)/` so only top-level test and example directories within each plugin are skipped.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Free Tier Details
Your team is on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle for each member of your team.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Problem
When importing
vision-agentsfrom an external project, IDEs and mypy show a warning:This happens because none of our packages include the
py.typedmarker file required by PEP 561.Changes
1. Added
py.typedmarkersAdded empty
py.typedmarker files tovision_agents.core,vision_agents.testing, and all 31 plugin subpackages. Sincevision_agentsis an implicit namespace package, markers are placed in each regular subpackage (not at the namespace root).Also removed misplaced
py.typedfiles that were sitting at plugin project roots (plugins/*/py.typed) — PEP 561 requires them inside the importable package directory.2. Fixed mypy "duplicate module" errors
Adding
py.typedcaused mypy to fail with:This happens because
py.typedmakes mypy recognizevision_agents.plugins.awsas a typed namespace package. When scanning theplugins/directory, mypy now finds the same file under two module names — one from the filesystem walk (aws.vision_agents.plugins.aws) and one from namespace package resolution (vision_agents.plugins.aws).Fix: set
MYPYPATHto include each plugin root directory (plugins/aws/,plugins/anthropic/, etc.) so mypy resolves paths relative to them, producing a single consistent module name.3. Narrowed
--excludepatternChanged from
'plugins/.*/tests/.*'to'plugins/[^/]+/(tests|examples?)/'to also excludeexample/examplesdirectories at the plugin root level (e.g.plugins/aws/example/), which conflict across plugins during type checking. The pattern is scoped to top-level plugin directories only, so it does not accidentally skip packages likeplugins/sample_plugin/vision_agents/plugins/example/which is actual plugin code.4. Centralized mypy configuration
CI and pre-commit now delegate to
dev.py mypy/dev.py mypy-pluginsinstead of duplicating MYPYPATH setup and exclude patterns inline. The mypy configuration is defined in one place.Testing
py.typed markers are included in built wheels
External project no longer shows "missing py.typed" warning
Created a standalone project that depends on
vision-agentsand ran mypy:No "Skipping analyzing ... missing library stubs or py.typed marker" warnings.
mypy passes for core and plugins
Unit tests pass (574 passed, pre-existing failures unrelated to this PR)