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

Migrate to Pydantic v2 #942

Merged
merged 24 commits into from
Jul 29, 2024
Merged

Migrate to Pydantic v2 #942

merged 24 commits into from
Jul 29, 2024

Conversation

grahamalama
Copy link
Contributor

@grahamalama grahamalama commented Jul 23, 2024

I'd suggest reviewing this PR by commit. Tried to keep things as atomic as possible. At a high level, this PR:

  • updates usages of renamed methods and attributes
  • updates usages of deprecated methods and attributes
  • Installs and configures pydantic-settings, which is now a separate package
  • Configures new validators (at the field and model level)

These commits warrant careful review:

dependabot bot and others added 22 commits July 15, 2024 14:23
Bumps [pydantic](https://github.com/pydantic/pydantic) from 1.10.17 to 2.8.2.
- [Release notes](https://github.com/pydantic/pydantic/releases)
- [Changelog](https://github.com/pydantic/pydantic/blob/main/HISTORY.md)
- [Commits](pydantic/pydantic@v1.10.17...v2.8.2)

---
updated-dependencies:
- dependency-name: pydantic
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
The underlying Rust library that handles timestamps apparently uses `Z`
to denote UTC time, rather that a 00:00 offset. Though the Z is "more
correct (I think), Python's isoformat method uses +00:00. Since that's
what most of our timestamps serialized to, we use a custom serializer to
ensure datetimes are serialized consistently.

I do think we shold eventally use the Z offset, but that would be a
breaking change of the API, so deserves to be part of a major release.
Pydantic URLs no longer "act like" strings by themselves. Since we
expect URLs to be strings throughout the codebase, we varlidate them
using Pydantic, but specify them as strings in models.
@grahamalama grahamalama requested a review from a team as a code owner July 23, 2024 14:05
@grahamalama grahamalama added the dependencies Pull requests that update a dependency file label Jul 23, 2024
Copy link
Contributor

@alexcottner alexcottner left a comment

Choose a reason for hiding this comment

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

Good work, this was a big effort for a dependency upgrade.
Don't see anything concerning that stands out.

@grahamalama grahamalama requested a review from a team July 24, 2024 14:54
@grahamalama grahamalama removed the request for review from a team July 24, 2024 15:24
Copy link
Contributor

@leplatrem leplatrem left a comment

Choose a reason for hiding this comment

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

👌

@grahamalama grahamalama force-pushed the migrate-to-pydantic-v2 branch from d114ebf to bfae6aa Compare July 29, 2024 12:32
@grahamalama grahamalama merged commit 0504ad5 into main Jul 29, 2024
5 checks passed
@grahamalama grahamalama deleted the migrate-to-pydantic-v2 branch July 29, 2024 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dependencies Pull requests that update a dependency file
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants