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

Add support for pydantic 2.x #13

Merged
merged 9 commits into from
May 22, 2024
Merged

Add support for pydantic 2.x #13

merged 9 commits into from
May 22, 2024

Conversation

stegm
Copy link
Owner

@stegm stegm commented Feb 4, 2024

Make pykoplenti compatible for pydantic 1.x and pydantic 2.x.

See also #12

  • Add tox for testing the code with pydantic 1.x and pydantic 2.x
  • Write a small wrapper around the deprecated parse_obj_as function in pydantic 1.x
  • Apply suggestions from sourcery
  • Add python 3.11 tests to tox.

@stegm stegm added sourcery-review enhancement New feature or request and removed sourcery-review labels Feb 4, 2024
@stegm stegm linked an issue Feb 4, 2024 that may be closed by this pull request
Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

PR Type: Enhancement

PR Summary: The pull request aims to add compatibility for both pydantic 1.x and 2.x versions to the pykoplenti library. It includes updates to the CI workflow, documentation, and codebase to support and test against both versions of pydantic.

Decision: Comment

📝 Type: 'Enhancement' - not supported yet.
  • Sourcery currently only approves 'Typo fix' PRs.
✅ Issue addressed: this change correctly addresses the issue or implements the desired feature.
No details provided.
📝 Complexity: the changes are too large or complex for Sourcery to approve.
  • Unsupported files: the diff contains files that Sourcery does not currently support during reviews.

General suggestions:

  • Ensure that the changes are thoroughly tested across all supported versions of pydantic to prevent any regressions.
  • Consider adding more detailed comments or documentation around the version-specific code changes to aid future maintainers in understanding the compatibility layers.
  • Review the use of conditional imports and type adapters to ensure that they are the most maintainable approach for supporting multiple versions of a dependency.

Thanks for using Sourcery. We offer it for free for open source projects and would be very grateful if you could help us grow. If you like it, would you consider sharing Sourcery on your favourite social media? ✨

Share Sourcery

Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

@stegm stegm marked this pull request as ready for review February 4, 2024 19:27
Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

PR Type: Enhancement

PR Summary: The pull request introduces compatibility for both pydantic 1.x and 2.x within the pykoplenti library. It includes the addition of a wrapper function to handle the deprecated 'parse_obj_as' function from pydantic 1.x, updates to the CI pipeline to include testing with tox, and documentation updates to guide developers on how to run tests with the new setup.

Decision: Comment

📝 Type: 'Enhancement' - not supported yet.
  • Sourcery currently only approves 'Typo fix' PRs.
✅ Issue addressed: this change correctly addresses the issue or implements the desired feature.
No details provided.
📝 Complexity: the changes are too large or complex for Sourcery to approve.
  • Unsupported files: the diff contains files that Sourcery does not currently support during reviews.

General suggestions:

  • Ensure that the new wrapper function for handling 'parse_obj_as' is thoroughly tested across both pydantic versions to prevent any regressions.
  • Consider adding more detailed comments or documentation around the wrapper function to explain its purpose and usage for future maintainers.
  • Review the changes to ensure that they follow the existing coding style and patterns within the project for consistency.

Thanks for using Sourcery. We offer it for free for open source projects and would be very grateful if you could help us grow. If you like it, would you consider sharing Sourcery on your favourite social media? ✨

Share Sourcery

Help me be more useful! Please click 👍 or 👎 on each comment to tell me if it was helpful.

@stegm stegm merged commit dba0235 into master May 22, 2024
3 checks passed
@stegm stegm deleted the pydantic_2x branch May 22, 2024 15:50
@bvanelli
Copy link

Hey @stegm , I was monitoring home-assistant/core#99218 (comment), and noticed that this PR did not make to any release yet. I was wondering if you could do a release so that I can eventually request the upgrade on HA, to move the issue a little bit forward.

@stegm
Copy link
Owner Author

stegm commented Nov 13, 2024

@bvanelli

Thank you for remembering. I have just created a release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pydantic > 2
2 participants