Conversation
…parsing Replace pydantic.v1.datetime_parse imports with Pydantic V2 TypeAdapter-based parse_date/parse_datetime implementations. Wrap remaining pydantic.v1 imports with warning suppression to avoid Python 3.14 compatibility warnings. Fixes: square/square-python-sdk#188, cohere-ai/cohere-python#706 Co-Authored-By: judah@buildwithfern.com <jsklan.development@gmail.com>
Contributor
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Co-Authored-By: judah@buildwithfern.com <jsklan.development@gmail.com>
Co-Authored-By: judah@buildwithfern.com <jsklan.development@gmail.com>
…patibility Co-Authored-By: judah@buildwithfern.com <jsklan.development@gmail.com>
tjb9dc
approved these changes
Feb 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Refs square/square-python-sdk#188, cohere-ai/cohere-python#706
SDKs generated by the Python generator emit warnings and may break on Python 3.14 because
pydantic.v1.datetime_parseis incompatible with Python 3.14's new type annotation semantics (PEP 649/749). This PR removes the problematic imports and uses Pydantic V2-native alternatives instead.Link to Devin run: https://app.devin.ai/sessions/037a40e643704fd1bd779214fa20c335
Requested by: @jsklan
Changes Made
Across all 4
pydantic_utilities.pytemplate variants (shared/,with_pydantic_aliases/,with_pydantic_v1_on_v2/,with_pydantic_v1_on_v2/with_aliases/):from pydantic.v1.datetime_parse import parse_date/parse_datetimewithpydantic.TypeAdapter-basedparse_date()/parse_datetime()functions that useTypeAdapter.validate_python()for date/datetime coercionpydantic.v1.*imports (ModelField,ENCODERS_BY_TYPE,get_args,get_origin,is_literal_type,is_union) inwarnings.catch_warnings()to suppress the Python 3.14 UserWarning# type: ignore[attr-defined]annotations to TypeAdapter lines for mypy compatibility when type-checking against pydantic v1 stubsversions.ymlfor python-sdk (4.55.2), pydantic (1.11.3), and fastapi (2.1.1) generatorsThe
elsebranch (native pydantic v1 — only used whenIS_PYDANTIC_V2is False) is intentionally left unchanged, as pydantic v1 itself does not support Python 3.14.Human Review Checklist
TypeAdapter.validate_python()is functionally equivalent to the oldparse_date/parse_datetimefor all input types (strings, datetime objects, etc.)with_pydantic_v1_on_v2variants, imports changed frompydantic.Xtopydantic.v1.X(e.g.,pydantic.fields.ModelField→pydantic.v1.fields.ModelField). Confirm this is correct for the "v1 on v2" mode where pydantic v2 is installed but v1 compat layer is used.with_pydantic_v1_on_v2contextTesting
@fern-api/ir-utils)