semantic-router icon indicating copy to clipboard operation
semantic-router copied to clipboard

Migration to Pydantic V2

Open maxyousif15 opened this issue 1 year ago • 2 comments

The Route object still uses pydantic V1. Are there plans to migrate to V2?

Out of curiosity, is there a reason why Route was based on pydantic V1 and not pydantic V2?

maxyousif15 avatar Feb 14 '24 16:02 maxyousif15

Inscoping this as part of our backlog

bruvduroiu avatar Mar 19 '24 00:03 bruvduroiu

@bruvduroiu there are so many projects that use pydantic v1 and upgrading to pydantic v2 is not an option for them due to the amount of change it requires. Currently, I am resorting to maintaining my own fork of this library and supporting v1 as in the following snippet. Do you think there is a way to keep supporting both the versions in the library itself for some time at least to make this project actually useful?

try:
    from pydantic.v1 import BaseModel  # type: ignore
except ImportError:
    from pydantic import BaseModel  # type: ignore  

Pydantic just released 1.10.15 like 7 hours ago, so I think we must support it. I can make a PR from my fork if this is on the roadmap.

pratiksinghchauhan avatar Apr 03 '24 19:04 pratiksinghchauhan