Skip to content
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

Relax pydantic, pydantic-settings, and uvicorn requirements #180

Merged
merged 2 commits into from
Jan 30, 2025

Conversation

jeremydanielfox
Copy link
Contributor

@jeremydanielfox jeremydanielfox commented Jan 30, 2025

Motivation and Context

This PR relaxes version constraints for several dependencies to improve compatibility, without changing functionality.

  • pydantic: Changed from >=2.10.1,<3.0.0 to >=2.7.2,<3.0.0
  • pydantic-settings: Changed from >=2.6.1 to >=2.5.2
  • uvicorn: Changed from >=0.30 to >=0.23.1

In addition to changing the version requirements, the main change in this PR is to fix a test that previously had been failing at pydantic 2.7.2, which had prompted @dsp-ant to upgrade the pydantic version. The relevant difference pre and post 2.7.2 pydantic was just in the JSON schema representation format. This fix was to make the test handle both pre-2.7.2 and post-2.7.2 pydantic JSON schema formats. Both schemas mean the same thing.

How Has This Been Tested?

I tested this by running the test suite with both pydantic 2.7.2, and 2.10.1, to confirm the tests passed for both. For uvicorn and pydantic-settings, I examined the change log and the usage of these libraries in the code to make sure there were no breaking changes.

Breaking Changes

There are no breaking changes here.

Types of changes

Relaxes dependency requirements, fixes a test that failed at an earlier dependency.

Checklist

  • [x ] I have read the MCP Documentation
  • [x ] My code follows the repository's style guidelines
  • [x ] New and existing tests pass locally
  • I have added appropriate error handling
  • [x ] I have added or updated documentation as needed

Additional context

@jeremydanielfox jeremydanielfox force-pushed the jeremy/relax-pydantic branch 2 times, most recently from 2a61357 to a1cd895 Compare January 30, 2025 03:48
@jeremydanielfox jeremydanielfox changed the title relax pydantic requirements Relax pydantic, pydantic-settings, and uvicorn requirements Jan 30, 2025
@jeremydanielfox jeremydanielfox marked this pull request as ready for review January 30, 2025 04:01
Copy link
Contributor

@jerome3o-anthropic jerome3o-anthropic left a comment

Choose a reason for hiding this comment

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

This seems okay to me - for reference I also dug into the change logs for uvicorn and didn't see any issues.

@jerome3o-anthropic jerome3o-anthropic self-requested a review January 30, 2025 04:39
Copy link
Contributor

@jerome3o-anthropic jerome3o-anthropic left a comment

Choose a reason for hiding this comment

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

Sorry - I just realized that there is an inconsistency in my understanding here, is the comment correct? / what version of pydantic were you using when you needed the test change to make it pass?

# Normalize the my_model_a_with_default field to handle both pydantic formats
if 'allOf' in actual_schema['properties']['my_model_a_with_default']:
normalized_schema['properties']['my_model_a_with_default'] = {
'$ref': '#/$defs/SomeInputModelA',
Copy link
Contributor

Choose a reason for hiding this comment

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

Seems odd to me that you've relaxed down to 2.7.2, but in order to get this test passing you cast it to the "Pre-pydantic 2.7.2" version.

I suspect either your comment is wrong, or I'm misunderstanding something

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, the comment was wrong. I researched exactly when this change was made and updated the comment to reflect it.

The change happened in Pydantic 2.9.0. Here are the release notes for that change. You can see the PR here that made the change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To confirm that this works, I ran the test with pydantic 2.7.2 (the new version we are relaxing to) and 2.10.1 (the previously required lower bound) and confirmed the test passes with both.

@jerome3o-anthropic jerome3o-anthropic merged commit 444edf6 into main Jan 30, 2025
5 checks passed
@jerome3o-anthropic jerome3o-anthropic deleted the jeremy/relax-pydantic branch January 30, 2025 18:08
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.

2 participants