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

Support Pydantic V2 and patch release #4835

Merged
merged 4 commits into from
Jul 7, 2023
Merged

Support Pydantic V2 and patch release #4835

merged 4 commits into from
Jul 7, 2023

Conversation

freddyaboulton
Copy link
Collaborator

@freddyaboulton freddyaboulton commented Jul 7, 2023

Description

fastapi 0.100.0 got released an hour ago and it supports pydantic v2 which introduces some changes that invalidate our models. This causes requests to fail with 422 error code. You can see that here: https://huggingface.co/spaces/gradio/calculator_main

I updated the models to match pydantic v2 using the migration guide and its backwards compatible change with pydantic v1.

I installed pydantic v1 on this branch locally and the demo still works:
pydanctic_v1_run

🎯 PRs Should Target Issues

Before your create a PR, please check to see if there is an existing issue for this change. If not, please create an issue before you create this PR, unless the fix is very small.

Not adhering to this guideline will result in the PR being closed.

Tests & Changelog

  1. PRs will only be merged if tests pass on CI. To run the tests locally, please set up your Gradio environment locally and run the tests: bash scripts/run_all_tests.sh

  2. You may need to run the linters: bash scripts/format_backend.sh and bash scripts/format_frontend.sh

  3. Unless the pull request is labeled with the "no-changelog-update" label by a maintainer of the repo, all pull requests must update the changelog located in CHANGELOG.md:

Please add a brief summary of the change to the Upcoming Release section of the CHANGELOG.md file and include
a link to the PR (formatted in markdown) and a link to your github profile (if you like). For example, "* Added a cool new feature by [@myusername](link-to-your-github-profile) in [PR 11111](https://github.com/gradio-app/gradio/pull/11111)".

@vercel
Copy link

vercel bot commented Jul 7, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
gradio ✅ Ready (Inspect) Visit Preview Jul 7, 2023 8:06pm

@gradio-pr-bot
Copy link
Collaborator

All the demos for this PR have been deployed at https://huggingface.co/spaces/gradio-pr-deploys/pr-4835-all-demos

@gradio-pr-bot
Copy link
Collaborator

gradio-pr-bot commented Jul 7, 2023

Chromatic build successful 🎉

Copy link
Member

@abidlabs abidlabs left a comment

Choose a reason for hiding this comment

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

LGTM nice fix @freddyaboulton!

Tested with old (0.96) and latest (0.100) versions of fastapi and can confirm demos work properly in both.

@freddyaboulton
Copy link
Collaborator Author

Thanks for the review @abidlabs !

@abidlabs
Copy link
Member

abidlabs commented Jul 7, 2023

Just FYI @freddyaboulton some of the flaky tests might be timing out

@freddyaboulton
Copy link
Collaborator Author

Yea they're gonna time out until we install this version in them or pin pydantic.

I can do that in #4834. In #4834 I'm moving test spaces to gradio-tests org from our personal accounts so that we can all make changes more easily in the future.

@abidlabs
Copy link
Member

abidlabs commented Jul 7, 2023

Ah yeah it's because https://huggingface.co/spaces/freddyaboulton/calculator is broken.

We should fix that manually and the version upgrade should take of everything else

@freddyaboulton freddyaboulton changed the title Pydantic V2 hotfix and patch release Support Pydantic V2 and patch release Jul 7, 2023
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.

3 participants