Remove unused agent files and clean up test directory by deleting obs…#524
Remove unused agent files and clean up test directory by deleting obs…#524MervinPraison merged 6 commits intomainfrom
Conversation
…olete test scripts and configuration files.
✅ Deploy Preview for praisonai canceled.
|
There was a problem hiding this comment.
Hello @MervinPraison, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!
Summary of Changes
Hello, this is gemini-code-assist providing a summary of this pull request. The primary goal of this PR, as indicated by the title and description, is to clean up the project by removing unused agent-related files and deleting obsolete test scripts and configuration files from the test directory. This involves removing specific test files and making minor adjustments to pyproject.toml files.
Highlights
- Test File Removal: Several obsolete test files, specifically related to CrewAI integration and real tests, have been completely removed from the test directory. This helps streamline the test suite and remove outdated code.
- Build Configuration Updates: Minor changes were made to two
pyproject.tomlfiles. One adds a[tool.setuptools]section to explicitly define packages, and the other adjusts the casing of a package name within the[tool.setuptools]configuration.
Changelog
- (Deleted CrewAI Integration Tests file)
- Removed the entire file containing CrewAI integration tests (
# CrewAI Integration Tests).
- Removed the entire file containing CrewAI integration tests (
- (Deleted CrewAI Real Tests file)
- Removed the entire file containing CrewAI real tests (
# CrewAI Real Tests).
- Removed the entire file containing CrewAI real tests (
- src/praisonai-agents/pyproject.toml
- Added
[tool.setuptools]section withpackages = ["praisonaiagents"]. - Ensured a newline exists at the end of the file.
- Added
- src/praisonai/pyproject.toml
- Changed the package name casing from
"PraisonAI"to"praisonai"in the[tool.setuptools]section.
- Changed the package name casing from
Using Gemini Code Assist
The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.
Invoking Gemini
You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.
| Feature | Command | Description |
|---|---|---|
| Code Review | /gemini review |
Performs a code review for the current pull request in its current state. |
| Pull Request Summary | /gemini summary |
Provides a summary of the current pull request in its current state. |
| Comment | @gemini-code-assist | Responds in comments when explicitly tagged, both in issue comments and review comments. |
| Help | /gemini help |
Displays a list of available commands. |
Customization
To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.
Limitations & Feedback
Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.
You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.
Old tests now are gone,
Cleanup makes the code base light,
Simpler, cleaner path.
Footnotes
-
Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩
There was a problem hiding this comment.
Code Review
This pull request effectively cleans up obsolete test files and improves packaging configurations in pyproject.toml files. The changes contribute positively to the project's maintainability and adherence to conventions. The renaming of the package in src/praisonai/pyproject.toml to lowercase is a good correction. The addition of setuptools configuration in src/praisonai-agents/pyproject.toml is also appropriate. I have one minor suggestion for improvement.
Summary of Findings
- Missing Newline at End of File: The file
src/praisonai-agents/pyproject.tomlhas a newly added line (packages = ["praisonaiagents"]) as its last line, but it's missing a terminating newline character. It's recommended to end all text files with a newline.
Merge Readiness
The pull request is in good shape and primarily involves beneficial cleanup and configuration improvements. There is one low severity issue identified concerning a missing newline at the end of src/praisonai-agents/pyproject.toml. I recommend addressing this minor point to ensure adherence to common best practices before merging. As an AI reviewer, I am not authorized to approve pull requests; please ensure further review and approval by authorized team members.
|
""" WalkthroughThis update restructures the testing and packaging setup for the project. It modifies multiple GitHub Actions workflows to run tests from within the Changes
Sequence Diagram(s)sequenceDiagram
participant GitHub Actions
participant src/praisonai
participant Test Runner
GitHub Actions->>src/praisonai: cd src/praisonai
src/praisonai->>Test Runner: Run pytest / test_runner.py
Test Runner-->>src/praisonai: Test results
src/praisonai-->>GitHub Actions: Report status
Possibly related PRs
Poem
✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Actionable comments posted: 2
🔭 Outside diff range comments (1)
.github/workflows/unittest.yml (1)
143-168:⚠️ Potential issueFix hardcoded path duplication for autogen-agents.yaml
Aftercd src/praisonai, openingsrc/praisonai/tests/autogen-agents.yamlattempts to load fromsrc/praisonai/src/praisonai/tests/.... It should simply reference thetestsfolder.Proposed diff:
- cd src/praisonai - python -c " - ... - import yaml - with open('src/praisonai/tests/autogen-agents.yaml', 'r') as f: + cd src/praisonai + python -c " + ... + import yaml + with open('tests/autogen-agents.yaml', 'r') as f:🧰 Tools
🪛 YAMLlint (1.37.1)
[error] 148-148: trailing spaces
(trailing-spaces)
[error] 152-152: trailing spaces
(trailing-spaces)
[error] 155-155: trailing spaces
(trailing-spaces)
[error] 158-158: trailing spaces
(trailing-spaces)
[error] 165-165: trailing spaces
(trailing-spaces)
🧹 Nitpick comments (6)
src/praisonai/tests/unit/agent/test_mini_agents_sequential.py (1)
9-9: Remove unused import.The
pytestimport is not used in this test file and should be removed to clean up the imports.-import pytest🧰 Tools
🪛 Ruff (0.11.9)
9-9:
pytestimported but unusedRemove unused import:
pytest(F401)
.github/workflows/test-core.yml (2)
48-48: Remove trailing spaces
The line defining- name: Run Integration Testshas extra trailing spaces, which will trigger YAML lint errors. Please remove the trailing spaces.- - name: Run Integration Tests + - name: Run Integration Tests🧰 Tools
🪛 YAMLlint (1.37.1)
[error] 48-48: trailing spaces
(trailing-spaces)
58-58: Remove trailing spaces
The line defining- name: Run CrewAI Framework Testshas extra trailing spaces, which will trigger YAML lint errors. Please remove the trailing spaces.- - name: Run CrewAI Framework Tests + - name: Run CrewAI Framework Tests🧰 Tools
🪛 YAMLlint (1.37.1)
[error] 58-58: trailing spaces
(trailing-spaces)
.github/workflows/unittest.yml (3)
214-223: Unify directory references in debug step
Youcd src/praisonaithen globtests/*.yaml, but the log printssrc/praisonai/tests/. This mismatch could confuse diagnostics. Update the print statement to reflect the actual lookup path.Sample adjustment:
- print('📁 Available YAML files in src/praisonai/tests/:') + print('📁 Available YAML files in tests/:') import glob - yaml_files = glob.glob('tests/*.yaml') + yaml_files = glob.glob('tests/*.yaml') for f in yaml_files: print(f' {f}')🧰 Tools
🪛 YAMLlint (1.37.1)
[error] 220-220: trailing spaces
(trailing-spaces)
356-359: Maintain consistency in invocation style
Here you run:python -m praisonai src/praisonai/tests/autogen-agents.yamlConsider mirroring other steps by:
cd src/praisonai && python -m praisonai tests/autogen-agents.yamlThis keeps file paths relative to the working directory.
362-388: Consolidate directory context in comprehensive debug
Multiple debug steps invokecd src/praisonaiand then list or reference files undertests/vssrc/praisonai/tests/. Consider grouping these into a single block or parameterizing the test directory path to reduce duplication and potential mismatches.🧰 Tools
🪛 YAMLlint (1.37.1)
[error] 370-370: trailing spaces
(trailing-spaces)
[error] 374-374: trailing spaces
(trailing-spaces)
[error] 377-377: trailing spaces
(trailing-spaces)
[error] 382-382: trailing spaces
(trailing-spaces)
[error] 388-388: trailing spaces
(trailing-spaces)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (6)
src/praisonai-agents/tests/image.jpgis excluded by!**/*.jpgsrc/praisonai-agents/tests/kag-research-paper.pdfis excluded by!**/*.pdfsrc/praisonai-agents/tests/large.pdfis excluded by!**/*.pdfsrc/praisonai-agents/tests/sample.docxis excluded by!**/*.docxsrc/praisonai-agents/tests/tasks.csvis excluded by!**/*.csvsrc/praisonai-agents/tests/tesla-stock-price.csvis excluded by!**/*.csv
📒 Files selected for processing (14)
.github/workflows/python-package.yml(1 hunks).github/workflows/test-comprehensive.yml(1 hunks).github/workflows/test-core.yml(1 hunks).github/workflows/test-extended.yml(1 hunks).github/workflows/test-frameworks.yml(1 hunks).github/workflows/test-real.yml(1 hunks).github/workflows/unittest.yml(9 hunks)src/praisonai-agents/pyproject.toml(1 hunks)src/praisonai/pyproject.toml(1 hunks)src/praisonai/tests/unit/agent/test_mini_agents_sequential.py(1 hunks)tests/e2e/crewai/__init__.py(0 hunks)tests/e2e/crewai/test_crewai_real.py(0 hunks)tests/integration/crewai/__init__.py(0 hunks)tests/integration/crewai/test_crewai_basic.py(0 hunks)
💤 Files with no reviewable changes (4)
- tests/e2e/crewai/init.py
- tests/integration/crewai/init.py
- tests/e2e/crewai/test_crewai_real.py
- tests/integration/crewai/test_crewai_basic.py
🧰 Additional context used
🪛 YAMLlint (1.37.1)
.github/workflows/unittest.yml
[error] 99-99: trailing spaces
(trailing-spaces)
[error] 220-220: trailing spaces
(trailing-spaces)
.github/workflows/test-core.yml
[error] 48-48: trailing spaces
(trailing-spaces)
[error] 58-58: trailing spaces
(trailing-spaces)
🪛 Ruff (0.11.9)
src/praisonai/tests/unit/agent/test_mini_agents_sequential.py
9-9: pytest imported but unused
Remove unused import: pytest
(F401)
🪛 GitHub Actions: Core Tests
src/praisonai/tests/unit/agent/test_mini_agents_sequential.py
[error] 1-1: Test failure: AttributeError - module 'praisonaiagents' has no attribute 'llms' during test_mini_agents_sequential_data_passing.
🪛 GitHub Actions: Quick Validation Tests
src/praisonai/tests/unit/agent/test_mini_agents_sequential.py
[error] 1-1: Test failure: AttributeError: module 'praisonaiagents' has no attribute 'llms' in test_mini_agents_sequential_data_passing.
🪛 GitHub Actions: Python package
src/praisonai/tests/unit/agent/test_mini_agents_sequential.py
[error] 1-1: Test failure: AttributeError: module 'praisonaiagents' has no attribute 'llms' in test_mini_agents_sequential_data_passing.
🔇 Additional comments (13)
src/praisonai/pyproject.toml (1)
103-103:Details
✅ Verification successful
Good adherence to Python package naming conventions.
The change from "PraisonAI" to "praisonai" follows PEP 8 naming conventions for Python packages (lowercase with underscores). This creates appropriate separation between the project display name ("PraisonAI") and the actual package directory name ("praisonai").
Please verify that the actual directory structure matches this configuration:
🏁 Script executed:
#!/bin/bash # Description: Verify the package directory structure matches the setuptools configuration # Check if the praisonai package directory exists in the expected location fd -t d "praisonai" src/ --max-depth 2 # Verify the package contains __init__.py to confirm it's a valid Python package fd "__init__.py" src/praisonai/ --max-depth 1Length of output: 202
I want to confirm how the package discovery is configured in pyproject.toml and that the true package directory contains an
__init__.py. Let’s pull in those settings and inspect deeper:
🏁 Script executed:
#!/bin/bash # Show where setuptools is configured and what packages/package-dir are set grep -n '\[tool.setuptools' src/praisonai/pyproject.toml grep -n 'packages' src/praisonai/pyproject.toml grep -n 'package-dir' src/praisonai/pyproject.toml # Verify that an __init__.py actually exists in the nested praisonai directory fd "__init__.py" src/praisonai/ --max-depth 3Length of output: 609
Let’s inspect the full
[tool.setuptools]block to confirm if anypackage-diris set (so thatpraisonaiundersrc/praisonai/is discovered correctly):
🏁 Script executed:
#!/bin/bash # Show the [tool.setuptools] section with context grep -n "\[tool.setuptools\]" -A 20 src/praisonai/pyproject.tomlLength of output: 834
Package directory structure verified
The
packages = ["praisonai"]setting in[tool.setuptools]correctly maps to thesrc/praisonai/praisonai/directory, which contains an__init__.py. No further changes are needed.src/praisonai/tests/unit/agent/test_mini_agents_sequential.py (1)
15-27: Well-structured mock implementation.The mock completion function is well-designed with proper response simulation based on input content. The logic correctly handles different message types and returns appropriate responses for the test scenarios.
src/praisonai-agents/pyproject.toml (1)
58-59: Good addition of explicit package configuration.Adding the
[tool.setuptools]section with explicit package declaration is a good practice. This ensures setuptools correctly identifies and includes thepraisonaiagentspackage during the build process, consistent with the pattern established in the mainpraisonaipackage..github/workflows/python-package.yml (1)
40-42: Appropriate workflow adjustment for package restructuring.The change to run tests from the
src/praisonaidirectory aligns well with the package restructuring effort. Usingcd src/praisonai && python -m pytestensures tests execute in the correct context relative to the updated package structure..github/workflows/test-extended.yml (1)
103-103: Align performance benchmarks import path
The updatedsys.path.insertcorrectly points tosrc/praisonai, matching other workflows and ensuring imports resolve from the main package directory..github/workflows/test-real.yml (2)
81-82: Standardize working directory before AutoGen tests
The addition ofcd src/praisonai &&ensures that pytest runs in the correct context for AutoGen end-to-end tests. No changes to test logic.
88-89: Verify removal of CrewAI E2E tests
The workflow still includes the CrewAI real-test step, but the PR summary mentioned cleaning up CrewAI test files. Please confirm thattests/e2e/crewai/and its tests exist after cleanup, or remove this step if obsolete.Likely an incorrect or invalid review comment.
.github/workflows/test-frameworks.yml (1)
63-63: Ensure correct execution context for framework tests
Prependingcd src/praisonai &&correctly aligns the working directory with other CI workflows, preventing import errors during framework integration tests..github/workflows/test-comprehensive.yml (1)
70-92: Run comprehensive tests fromsrc/praisonai
Each test invocation now correctly changes the working directory before runningtests/test_runner.py, standardizing the CI context across all test types..github/workflows/test-core.yml (1)
46-67: Addcd src/praisonaifor all core test steps
The run commands for unit, integration, AutoGen, CrewAI, and legacy tests now uniformly change intosrc/praisonai, aligning with the project layout and avoiding potential import issues.🧰 Tools
🪛 YAMLlint (1.37.1)
[error] 48-48: trailing spaces
(trailing-spaces)
[error] 58-58: trailing spaces
(trailing-spaces)
.github/workflows/unittest.yml (3)
301-304: Consistent working directory for package imports
The addedcd src/praisonaiensures the localpraisonaipackage is on the module path when running the API key flow tests. This aligns with other steps and avoids surprises in import resolution.
470-474: Update fast test invocation to new structure
Running the fast tests fromsrc/praisonaiensures the test runner and module imports resolve correctly. This change looks good and aligns with the updated project layout.
476-478: Run legacy tests in the updated context
Invoking pytest fromsrc/praisonaiwith explicit paths guarantees that legacy example tests still run under the new directory structure. This adjustment is correct.
There was a problem hiding this comment.
Actionable comments posted: 0
🧹 Nitpick comments (1)
.github/workflows/test-extended.yml (1)
55-67: Useworking-directoryto DRY up repeated absolute pathsAll five
timeout_run python ${{ github.workspace }}/src/praisonai-agents/...invocations can be simplified by setting aworking-directoryon the step. This eliminates the need for the long path prefix on each line and makes the YAML more maintainable. For example:- name: Test Key Example Scripts working-directory: ${{ github.workspace }}/src/praisonai-agents continue-on-error: true run: | echo "🧪 Testing key example scripts..." timeout_run python basic-agents.py timeout_run python async_example.py timeout_run python knowledge-agents.py timeout_run python mcp-basic.py timeout_run python ui.py echo "✅ Example script testing completed"🧰 Tools
🪛 YAMLlint (1.37.1)
[error] 56-56: trailing spaces
(trailing-spaces)
[error] 57-57: trailing spaces
(trailing-spaces)
[error] 59-59: trailing spaces
(trailing-spaces)
[error] 62-62: trailing spaces
(trailing-spaces)
[error] 65-65: trailing spaces
(trailing-spaces)
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
.github/workflows/test-extended.yml(2 hunks)
🧰 Additional context used
🪛 YAMLlint (1.37.1)
.github/workflows/test-extended.yml
[error] 56-56: trailing spaces
(trailing-spaces)
[error] 57-57: trailing spaces
(trailing-spaces)
[error] 59-59: trailing spaces
(trailing-spaces)
[error] 62-62: trailing spaces
(trailing-spaces)
[error] 65-65: trailing spaces
(trailing-spaces)
🔇 Additional comments (1)
.github/workflows/test-extended.yml (1)
103-103: Verify the module path adjustment for performance testsThe inline benchmark now does:
sys.path.insert(0, 'src/praisonai')instead of the previous
'src/praisonai-agents'. Please confirm that:
- The
praisonaiagentsmodule now lives undersrc/praisonai(and not undersrc/praisonai-agents).- This aligns with your recent cleanup/packaging changes.
If the module was moved or renamed, this is correct; otherwise, update the path or import accordingly.
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
src/praisonai/tests/unit/agent/test_mini_agents_sequential.py (2)
9-9: Remove unused import.The
pytestimport is not used anywhere in the code and should be removed to avoid clutter.-import pytest🧰 Tools
🪛 Ruff (0.11.9)
9-9:
pytestimported but unusedRemove unused import:
pytest(F401)
15-87: Consider simplifying the mock function.While the mock function is comprehensive and functional, it's quite complex with multiple nested classes. The implementation correctly handles both streaming and non-streaming responses, but could be simplified for better maintainability.
Consider using a simpler approach with dataclasses or namedtuples:
+from dataclasses import dataclass +from typing import List, Optional +@dataclass +class MockMessage: + content: str + def get(self, key, default=None): + return getattr(self, key, default) if hasattr(self, key) else default +@dataclass +class MockChoice: + message: MockMessage +@dataclass +class MockResponse: + choices: List[MockChoice]This would reduce the complexity while maintaining the same functionality.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/praisonai/tests/unit/agent/test_mini_agents_sequential.py(1 hunks)
🧰 Additional context used
🪛 Ruff (0.11.9)
src/praisonai/tests/unit/agent/test_mini_agents_sequential.py
9-9: pytest imported but unused
Remove unused import: pytest
(F401)
⏰ Context from checks skipped due to timeout of 90000ms (4)
- GitHub Check: quick-test
- GitHub Check: test-core (3.11)
- GitHub Check: test-core (3.11)
- GitHub Check: quick-test
🔇 Additional comments (2)
src/praisonai/tests/unit/agent/test_mini_agents_sequential.py (2)
89-131: Test implementation looks solid.The test function properly mocks the litellm.completion call, creates appropriate agents, and validates the sequential data passing behavior. The assertions are comprehensive and the expected behavior is clearly defined.
133-134: Standard main execution block.The main block allows for standalone test execution, which is useful for debugging and development.
| import sys | ||
| import os | ||
| import pytest | ||
| sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'src')) |
There was a problem hiding this comment.
Fix incorrect path manipulation.
The current path insertion attempts to add a 'src' subdirectory relative to the test file location, but this would point to a non-existent directory (src/praisonai/tests/unit/agent/src/). Since this test file is already within the src/praisonai/ structure, this path manipulation is unnecessary and incorrect.
-sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'src'))The import on line 12 should work correctly without this path manipulation since the test is being run from the proper directory context according to the updated GitHub Actions workflows.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'src')) |
🤖 Prompt for AI Agents
In src/praisonai/tests/unit/agent/test_mini_agents_sequential.py at line 10,
remove the line that inserts 'src' into sys.path because it incorrectly
constructs a path that does not exist relative to the test file. Since the test
runs within the correct directory context, this path manipulation is unnecessary
and should be deleted to avoid import errors.
Remove unused agent files and clean up test directory by deleting obs…
…olete test scripts and configuration files.
Summary by CodeRabbit
Chores
Tests