-
Notifications
You must be signed in to change notification settings - Fork 3.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor Codebase to Use Pydantic v2 and Enhance Type Hints, Documentation #24
Merged
joaomdmoura
merged 8 commits into
crewAIInc:main
from
greysonlalonde:gl/refactor/remove-v1
Dec 30, 2023
Merged
Refactor Codebase to Use Pydantic v2 and Enhance Type Hints, Documentation #24
joaomdmoura
merged 8 commits into
crewAIInc:main
from
greysonlalonde:gl/refactor/remove-v1
Dec 30, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Refactored away from __init__ to be a little more aligned with pydantic
… pydantic v2; update validators, typings In addition to title changes; I updated config to allow for json or dict inputs. Changed exceptions to pydantic-based
Pytest is bugging out when trying to find packages through relative imports
This is great! Love it, might be a complex rebase for #25, but well worth it., merging it |
@joaomdmoura happy to help if needed! Cheers |
Thanks, I'm almost done with it 💪🏼 |
bhancockio
pushed a commit
that referenced
this pull request
Jan 2, 2025
…ation (#24) Update to Pydantic v2: Transitioned all references from pydantic.v1 to pydantic (v2), ensuring compatibility with the latest Pydantic features and improvements. Affected components include agent tools, prompts, crew, and task modules. Refactoring & Alignment with Pydantic Standards: Refactored the agent module away from traditional __init__ to align more closely with Pydantic best practices. Updated the crew module to Pydantic v2 and enhanced configurations, allowing JSON and dictionary inputs. Additionally, some (not all) exceptions have been migrated to leverage Pydantic's error-handling capabilities. Enhancements to Validators and Typings: Improved validators and type annotations across multiple modules, enhancing code readability and maintainability. Streamlined the validation process in line with Pydantic v2's methodologies. Import and Configuration Adjustments: Updated to test-related absolute imports due to issues with Pytest finding packages through relative imports.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR primarily represents a transition from Pydantic v1 to v2. The upgrade involves the switch of Pydantic v1 imports to the newer version of Pydantic and extensive refactoring and enhancements to validators, type hints, and documentation. Below is a summary of the fundamental changes included in this PR:
Major Changes
Update to Pydantic v2:
pydantic.v1
topydantic
(v2), ensuring compatibility with the latest Pydantic features and improvements.Refactoring & Alignment with Pydantic Standards:
agent
module away from traditional__init__
to align more closely with Pydantic best practices.crew
module to Pydantic v2 and enhanced configurations, allowing JSON and dictionary inputs. Additionally, some (not all) exceptions have been migrated to leverage Pydantic's error-handling capabilities.Enhancements to Validators and Typings:
Import and Configuration Adjustments:
Minor and Housekeeping Changes
.idea/
) to.gitignore
to prevent clutter.__init__.py
to root folder.Impact
This upgrade enhances robustness, scalability, and maintainability. By adopting Pydantic v2, the codebase is now better positioned to leverage new features and improved performance. The refinements in type hinting and documentation further contribute to a more developer-friendly environment.