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

refactor(general): drop pydantic v1 #4305

Merged
merged 4 commits into from
May 10, 2024

Conversation

leandrodamascena
Copy link
Contributor

Issue number: #4191

Summary

Changes

This pull request removes support for Pydantic v1 in Powertools for AWS Lambda (Python) v3. Pydantic v2 will be the only supported version going forward.

Our codebase and test suite currently have many conditional checks to ensure compatibility with both Pydantic v1 and v2. This makes the codebase more complex and harder to maintain. By removing support for Pydantic v1, we can simplify the codebase and focus on providing the best experience for Pydantic v2 users.

Customers using Powertools for AWS Lambda (Python) v2 will not need to update their codebase, as those versions will continue to support Pydantic v1. However, customers upgrading to v3 will need to ensure that their codebase uses Pydantic v2. This may require updating their dependencies and making any necessary changes to their code to be compatible with the Pydantic v2 API.

User experience

Please share what the user experience looks like before and after this change

Checklist

If your change doesn't seem to apply, please leave them unchecked.

Is this a breaking change?

RFC issue number:

Checklist:

  • Migration process documented
  • Implement warnings (if it can live side by side)

Acknowledgment

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.

@leandrodamascena leandrodamascena requested a review from a team as a code owner May 9, 2024 14:19
@pull-request-size pull-request-size bot added the size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. label May 9, 2024
@leandrodamascena leandrodamascena changed the title chore(ci): bump pydantic library to 2.0+ and boto3 to 1.34.32 (#4235) refactor(parser): Remove any specific code for Pydantic v1 May 9, 2024
@github-actions github-actions bot added internal Maintenance changes enhancement labels May 9, 2024
Copy link

codecov bot commented May 9, 2024

Codecov Report

Attention: Patch coverage is 99.01961% with 1 lines in your changes are missing coverage. Please review.

❗ No coverage uploaded for pull request base (v3@c2d088e). Click here to learn what that means.

Files Patch % Lines
..._lambda_powertools/event_handler/openapi/params.py 80.00% 1 Missing ⚠️
Additional details and impacted files
@@          Coverage Diff          @@
##             v3    #4305   +/-   ##
=====================================
  Coverage      ?   96.76%           
=====================================
  Files         ?      216           
  Lines         ?    10344           
  Branches      ?     1902           
=====================================
  Hits          ?    10009           
  Misses        ?      245           
  Partials      ?       90           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@pull-request-size pull-request-size bot added size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. and removed size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. labels May 9, 2024
@github-actions github-actions bot removed the internal Maintenance changes label May 9, 2024
Copy link
Contributor

github-actions bot commented May 9, 2024

⚠️Large PR detected⚠️

Please consider breaking into smaller PRs to avoid significant review delays. Ignore if this PR has naturally grown to this size after reviews.

@leandrodamascena
Copy link
Contributor Author

Hey @heitorlessa, this PR is ready to review! We may need to discuss about this: https://github.com/aws-powertools/powertools-lambda-python/pull/4305/files#diff-50c86b7ed8ac2cf95bd48334961bf0530cdc77b5a56f852c5c61b89d735fd711R99.

I can't see any Pydantic deprecation warning in the tests, but please double check this.

@leandrodamascena leandrodamascena linked an issue May 9, 2024 that may be closed by this pull request
2 tasks
Copy link
Contributor

@heitorlessa heitorlessa left a comment

Choose a reason for hiding this comment

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

superb work (I know how exhaustive this is) -- left one question about Bedrock Agents OpenAPI version workaround, and one ask to reduce memory usage for model_config = {"extra": "allow"} (define once).

@heitorlessa
Copy link
Contributor

Random question, do you know the reason why we have this?

It's the only place where we'd need this extra dependency.

Copy link

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

Copy link
Contributor

@heitorlessa heitorlessa left a comment

Choose a reason for hiding this comment

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

LGTM!!!!

@heitorlessa heitorlessa changed the title refactor(parser): Remove any specific code for Pydantic v1 refactor(parser): drop pydantic v1 May 10, 2024
@heitorlessa heitorlessa changed the title refactor(parser): drop pydantic v1 refactor(general): drop pydantic v1 May 10, 2024
@heitorlessa heitorlessa merged commit e21b916 into aws-powertools:v3 May 10, 2024
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement event_handlers size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Maintenance: Remove any specific code for Pydantic v1
2 participants