turms icon indicating copy to clipboard operation
turms copied to clipboard

Support pydantic v2

Open jhnnsrs opened this issue 1 year ago • 0 comments

Now that pydantic v2 is out for a while, and stabilized, we should consider supporting the newer patterns.

There is two axes to this.

Code Generation

Code generation could change in two ways

Plugin Based This should be more straightforward and would just necessitate to generate new plugins that would generate v2 code.

Api Based We could imaging a global API paramete:

pydantic_version: 1 # or two

That would allow this to be set globally. This would however require an intermediary code generator class, that would then delegate to the right api.

While a massive refactor ought to happen soon, i do tend to the plugin based approach, as it would allow us to maintain the code as is.

Internal

Turms uses pydantic internally to load and validate the configuration. Not sure how to best to the transition here yet. Anybody a great idea, whats best practices for a dev tool?

Feedback very welcome :)

jhnnsrs avatar Jan 31 '24 08:01 jhnnsrs