Skip to content

Add a script to validate that all plugins are included to core's extras #266

Merged
dangusev merged 4 commits intomainfrom
fix/core-include-plugins-extras
Dec 17, 2025
Merged

Add a script to validate that all plugins are included to core's extras #266
dangusev merged 4 commits intomainfrom
fix/core-include-plugins-extras

Conversation

@dangusev
Copy link
Contributor

@dangusev dangusev commented Dec 17, 2025

  1. Added a script scripts/validate_core_extras.py to validate that:
  • all plugins are listed in optional dependencies in agents-code/pyproject.toml
  • all plugins are included in the all-plugins optionals section in agents-code/pyproject.toml
  1. Added missing plugins to optionals

Summary by CodeRabbit

  • New Features

    • Added support for 9 new integrations: vogent, huggingface, moondream, aws, openrouter, qwen, fish, fast-whisper, and decart.
  • Chores

    • Added GitHub Actions workflow job for dependency validation.
    • Updated development dependencies.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link

coderabbitai bot commented Dec 17, 2025

Walkthrough

This pull request introduces plugin dependency validation infrastructure. A new CLI command validates that all discovered plugins are properly registered in agents-core/pyproject.toml's optional dependencies. Multiple new plugin dependencies are added, the validation is integrated into the CI workflow and existing check command, and supporting dependencies are declared.

Changes

Cohort / File(s) Summary
GitHub Actions Workflow
.github/workflows/run_tests.yml
Added new job validate-core-pyproject that runs plugin dependency validation (uv run dev.py validate-extras) during CI; includes checkout, dependency installation, and validation steps.
Core Plugin Configuration
agents-core/pyproject.toml
Added 9 new optional-dependency entries: vogent, huggingface, moondream, aws, openrouter, qwen, fish, fast-whisper, decart. Updated all-plugins list to include these new entries plus existing plugins with restructured ordering.
Root Project Config
pyproject.toml
Added development dependency toml>=0.10.2 for TOML file parsing support.
Dev Tooling & Validation
dev.py
Introduced plugin validation system: new CoreDependencies NamedTuple, helper functions (_cwd_is_root(), _get_plugin_package_name(), _get_core_optional_dependencies()), and new CLI command validate-extras to verify all plugins are declared in core optional dependencies. Integrated validation into existing check command.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Areas requiring close attention:
    • dev.py validation logic: verify plugin discovery via setuptools.find_namespace_packages() works correctly across environment variations
    • TOML parsing and error handling in helper functions
    • Integration point in check command to ensure validation runs before MyPy checks and properly surfaces errors
    • Consistency of plugin naming conventions between discovery and pyproject.toml entries

Suggested labels

plugins

Suggested reviewers

  • tschellenbach
  • Nash0x7E2

Poem

Bells of validation ring through the file tree,
each plugin catalogued, precise as bone,
the manifest demands its due—
no orphan dependencies, no scattered ghosts,
only the registered, only the known.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 45.45% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding a validation script to ensure plugins are included in core's optional dependencies.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix/core-include-plugins-extras

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (3)
pyproject.toml (1)

100-100: Consider tomllib for Python 3.11+.

Since the project supports Python 3.10+, the toml package is required for 3.10 compatibility. For future consideration, Python 3.11+ includes tomllib in the standard library. The current approach is acceptable.

scripts/validate_core_extras.py (2)

15-20: Missing docstring format and return type.

The docstring is present but the function lacks a return type annotation. Consider adding -> None for completeness.

-def main():
+def main() -> None:

78-80: Missing return type annotation.

The function returns a boolean but lacks a type hint.

-def _cwd_is_root():
+def _cwd_is_root() -> bool:
     cwd = Path.cwd()
     return (cwd / CORE_PACKAGE_NAME).exists() and (cwd / PLUGINS_DIR).exists()
📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 8743460 and af711ad.

⛔ Files ignored due to path filters (1)
  • uv.lock is excluded by !**/*.lock
📒 Files selected for processing (4)
  • .github/workflows/run_tests.yml (2 hunks)
  • agents-core/pyproject.toml (2 hunks)
  • pyproject.toml (1 hunks)
  • scripts/validate_core_extras.py (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.py

📄 CodeRabbit inference engine (.cursor/rules/python.mdc)

**/*.py: Never adjust sys.path in Python code
Never write except Exception as e - use specific exception handling
Avoid using getattr, hasattr, delattr and setattr; prefer normal attribute access in Python
Docstrings should follow the Google style guide for docstrings

Files:

  • scripts/validate_core_extras.py
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
  • GitHub Check: unit / Ruff
  • GitHub Check: unit / Validate extra dependencies in "agents-core/pyproject.toml"
  • GitHub Check: unit / Mypy
  • GitHub Check: unit / Test "not integration"
  • GitHub Check: unit / Mypy
  • GitHub Check: unit / Ruff
  • GitHub Check: unit / Test "not integration"
🔇 Additional comments (5)
agents-core/pyproject.toml (2)

55-63: LGTM!

The new optional dependencies are properly defined and all corresponding entries exist in the all-plugins list below.


65-91: LGTM!

The expanded all-plugins list includes all individual plugin dependencies, which the new validation script will enforce going forward.

scripts/validate_core_extras.py (3)

70-70: LGTM!

Using ... (ellipsis) for empty exception class bodies is idiomatic Python.


73-75: LGTM!

Clean use of NamedTuple for structured return type.


89-104: LGTM!

Good defensive handling for missing optional dependencies with clear error messaging.

@github-actions github-actions bot added the cli label Dec 17, 2025
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
dev.py (1)

215-215: Fix step numbering in output.

The step numbering is incorrect. This should be "=== 5. Unit Tests ===" since it follows four previous steps.

Apply this diff:

-    click.echo("\n=== 4. Unit Tests ===")
+    click.echo("\n=== 5. Unit Tests ===")
🧹 Nitpick comments (3)
dev.py (3)

117-120: Add error handling for file operations and TOML parsing.

The function could fail with unclear errors if the pyproject.toml file is missing, malformed, or lacks the expected keys. Consider wrapping in try-except blocks to provide better error messages.

 def _get_plugin_package_name(plugin: str) -> str:
-    with open(Path(PLUGINS_DIR) / Path(plugin) / "pyproject.toml", "r") as f:
-        pyproject = toml.load(f)
-    return pyproject["project"]["name"]
+    plugin_path = Path(PLUGINS_DIR) / Path(plugin) / "pyproject.toml"
+    try:
+        with open(plugin_path, "r") as f:
+            pyproject = toml.load(f)
+        return pyproject["project"]["name"]
+    except FileNotFoundError:
+        raise click.ClickException(f"Plugin {plugin} is missing pyproject.toml at {plugin_path}")
+    except (toml.TomlDecodeError, KeyError) as e:
+        raise click.ClickException(f"Invalid pyproject.toml for plugin {plugin}: {e}")

123-136: Consider adding error handling for robustness.

While the function uses .get() with defaults, it could still fail if the core pyproject.toml file is missing or malformed. Adding error handling would provide clearer diagnostics.

 def _get_core_optional_dependencies() -> CoreDependencies:
-    with open(Path(CORE_PACKAGE_NAME) / "pyproject.toml", "r") as f:
-        pyproject = toml.load(f)
+    core_pyproject_path = Path(CORE_PACKAGE_NAME) / "pyproject.toml"
+    try:
+        with open(core_pyproject_path, "r") as f:
+            pyproject = toml.load(f)
+    except FileNotFoundError:
+        raise click.ClickException(f"Core pyproject.toml not found at {core_pyproject_path}")
+    except toml.TomlDecodeError as e:
+        raise click.ClickException(f"Invalid core pyproject.toml: {e}")
 
     optionals: dict[str, list[str]] = pyproject.get("project", {}).get(
         "optional-dependencies", {}
     )

11-16: Replace toml with tomllib for Python 3.12 compatibility.

The project targets Python 3.12, and the toml import is used only for read-only operations (toml.load() in two functions). Since tomllib is available in the standard library for Python 3.11+, switch to it to eliminate the external dependency. Replace import toml with import tomllib and update the two toml.load(f) calls to use tomllib.loads(f.read()).

📜 Review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between af711ad and 984758e.

📒 Files selected for processing (2)
  • .github/workflows/run_tests.yml (2 hunks)
  • dev.py (3 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.py

📄 CodeRabbit inference engine (.cursor/rules/python.mdc)

**/*.py: Never adjust sys.path in Python code
Never write except Exception as e - use specific exception handling
Avoid using getattr, hasattr, delattr and setattr; prefer normal attribute access in Python
Docstrings should follow the Google style guide for docstrings

Files:

  • dev.py
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: unit / Test "not integration"
  • GitHub Check: unit / Test "not integration"
🔇 Additional comments (6)
dev.py (5)

18-21: LGTM!

The constants are well-defined and improve code maintainability.


107-109: LGTM!

The NamedTuple provides clear structure for managing core dependencies with appropriate type hints.


112-114: LGTM!

Root directory validation is straightforward and effective.


200-202: LGTM!

The integration of validation into the check workflow is well-structured. Calling validate_extra_dependencies.callback() directly is the correct approach for invoking Click commands programmatically.


150-152: Setuptools namespace package discovery is correct.

The use of setuptools.find_namespace_packages() is appropriate for discovering PEP 420 namespace packages in the plugins directory. The logic to extract root package names via split(".")[0] correctly isolates individual plugins from the nested namespace structure.

.github/workflows/run_tests.yml (1)

32-41: LGTM!

The validation job is well-structured and follows the existing patterns in the workflow. The command uv run dev.py validate-extras correctly invokes the new CLI command defined in dev.py.

Note: The past review comment mentioning scripts/validate_core_extras.py appears to be from a different approach and is not applicable to this implementation.

@dangusev dangusev merged commit b5649a8 into main Dec 17, 2025
10 checks passed
@dangusev dangusev deleted the fix/core-include-plugins-extras branch December 17, 2025 15:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants