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

change: replace custom types with Pydantic 2 #335

Open
wants to merge 5 commits into
base: elias/typing
Choose a base branch
from

Conversation

thearchitector
Copy link
Contributor

@thearchitector thearchitector commented Oct 4, 2024

Summary

Replacing all the custom type parsing stuff with Pydantic 2.

Based on my existing static typing branch, so that will have to get merged first.

Pydantic parses a few things slightly differently than we were, namely datetimes, so I've patched that validation to ensure backwards compat:

$ docker compose run --rm tester
  py38: OK (13.09=setup[8.93]+cmd[3.34,0.82] seconds)
  py39: OK (12.42=setup[7.22]+cmd[4.04,1.15] seconds)
  py310: OK (12.78=setup[8.52]+cmd[3.37,0.89] seconds)
  py311: OK (11.81=setup[7.50]+cmd[3.23,1.07] seconds)
  py312: OK (11.88=setup[7.30]+cmd[3.57,1.01] seconds)
  congratulations :) (13.15 seconds)

Also fixed some deprecations.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

@thearchitector thearchitector requested a review from a team as a code owner October 4, 2024 04:15
@thearchitector thearchitector changed the title change: replace custom typing with Pydantic 2 change: replace custom types with Pydantic 2 Oct 4, 2024
@madisonmay
Copy link
Contributor

@CodiumAI-Agent /review

@CodiumAI-Agent
Copy link

CodiumAI-Agent commented Oct 13, 2024

PR Reviewer Guide 🔍

(Review updated until commit cd974c0)

Here are some key observations to aid the review process:

⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
🧪 No relevant tests
🔒 No security concerns identified
⚡ Recommended focus areas for review

Backward Compatibility
The new header parsing function _parse_header might not handle edge cases as the old cgi.parse_header did. Ensure compatibility and robustness.

Type Validation
The new BaseType class uses Pydantic for validation. Ensure that all necessary validations are correctly ported and that custom validations like _validate_legacy_datetime are correctly implemented.

Field Initialization
The new implementation of the Job class with Pydantic might change how fields are initialized and validated. Ensure that the new field definitions and optional settings do not alter the expected behavior.

@madisonmay
Copy link
Contributor

madisonmay commented Oct 13, 2024

Y'all can ignore this was just curious to test this thing out and needed a PR on a public repo

@CodiumAI-Agent
Copy link

Persistent review updated to latest commit cd974c0

@thearchitector
Copy link
Contributor Author

Y'all can ignore this was just curious to test this thing out and needed a PR on a public repo

i accept guinea pig status

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants