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

fix: Support Pydantic v2 via shims. #12

Merged
merged 3 commits into from
Nov 13, 2024

Conversation

bvanelli
Copy link
Contributor

@bvanelli bvanelli commented Nov 10, 2024

Weheat is a dependency from HA, so this PR tries to make it compatible with multiple versions of Pydantic to help with the upgrade described in home-assistant/core#99218.

I'm aware that the files are auto-generated, but the OpenAPI generator seems to support either pydantic v1 or v2, not the backwards compatible version. I'd suggest first generating a release with the backwards compatible version, the doing an upgrade to the version two at some point in the future.

There are no tests on the repo, so I did basic import testing with a dockerfile:

FROM python:3.12

WORKDIR /app
COPY . /app
RUN pip install .
RUN python -c "from weheat import *"

Copy link
Collaborator

@jesperraemaekers jesperraemaekers left a comment

Choose a reason for hiding this comment

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

I checked this with pydantic 1.x and 2.x and it worked for both.

@jesperraemaekers
Copy link
Collaborator

jesperraemaekers commented Nov 13, 2024

I will merge this and release it soon. I'm looking into making some basic test cases to avoid regression on this topic.
Thanks @bvanelli !

@jesperraemaekers jesperraemaekers merged commit 4fa5f0b into wefabricate:main Nov 13, 2024
@bvanelli bvanelli deleted the pydantic-shims-upgrade branch November 13, 2024 19:19
@bvanelli
Copy link
Contributor Author

Thanks for the fast response @jesperraemaekers , I thought about adding basic test cases but I thought it would be too much out of scope, since the files are auto generated.

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