fractal-analytics-platform / fractal-tasks-core

Main tasks for the Fractal analytics platform
https://fractal-analytics-platform.github.io/fractal-tasks-core/
BSD 3-Clause "New" or "Revised" License
14 stars 6 forks source link

Switch to Pydantic v2 #592

Closed tcompa closed 1 month ago

tcompa commented 11 months ago

This is an issue to track pydantic-related updates in fractal-tasks-core dependencies, and to discuss strategies for a future v1->v2 migration. Note that this can happen at multiple levels, e.g. we could migrate the dev tools first and the models later. TBD.

First update:

tcompa commented 3 months ago

This issue was explored in #737. Porting the code base to Pydantic V2 was mostly successful (and it mainly consists in updating validators), but we were not satisfied with the new use of anyOf for Optional arguments/attributes.

This is a common issue, and possible workarounds exist (e.g. https://github.com/fractal-analytics-platform/fractal-tasks-core/pull/737#issuecomment-2098323095, or the recent activity in https://github.com/pydantic/pydantic/issues/7161).

We could give it a second try, by adopting one of those workarounds and checking how the outcome looks both in fractal-tasks-core and in other existing packages (ref #757), while keeping an eye on possibly more standard solutions in Pydantic.

tcompa commented 1 month ago

Closed with https://github.com/fractal-analytics-platform/fractal-tasks-core/pull/793