nayaverdier / dyntastic

A DynamoDB library on top of Pydantic and boto3.
MIT License
55 stars 12 forks source link

Pydantic v2 #10

Closed jplock closed 9 months ago

jplock commented 11 months ago

Support Pydantic v2

nayaverdier commented 11 months ago

This is currently blocked by https://github.com/pydantic/pydantic/issues/7586 in order to support KEYS_ONLY / INCLUDE indexes. Depending on where that ticket goes, I might just leave that feature unimplemented for now when using Pydantic v2 to at least support the majority of the feature set with Pydantic v2.

jsjeannotte commented 10 months ago

Hi @nayaverdier ! I was wondering if you've made progress on this? We are down to a handful of dependencies still pinned on v1 (including Dyntastic), and a lot of libraries are already pinned to Pydantic >1 (one of our systems uses a VENV with a combination of ~1300 Python dependencies/versions, so we're dealing with conflict resolution on a daily bases ... fun times ...)

Depending on where that ticket goes, I might just leave that feature unimplemented for now when using Pydantic v2 to at least support the majority of the feature set with Pydantic v2

That would be great! One approach would be to release a dyntastic2 pinned to Pydantic 2 without the blockers, and over time, getting it to parity. This would allow folks still stuck on Pydantic v1 to use dyntastic, and for others to use dyntastic2 with Pydantic v2. We tried convincing the Pydantic maintainers to release V2 as a new package to improve the transition but we were not successful (https://github.com/pydantic/pydantic/issues/6523), so now we deal with this pain every week. My colleague wrote a great post on this here: https://jolynch.github.io/posts/semver_considered_harmful/

By the way, thanks again for the great library, our team at Netflix is leveraging it to build some of our Data Platform control planes. When I find the time, I have some improvements to suggest (we've built automated audit fields with auto-conflict detection to handle concurrent save() calls, but could be nice to move those feature upstream). Will send an incomplete PR to share what it looks like when I get some free cycles.

nayaverdier commented 10 months ago

@jsjeannotte Thanks for the push, I just released 0.13.0a1 which has pydantic v2 support. There were a lot of tricky things to work around, so if you're able to play around with it and make sure it actually works for your use case, that'd be super helpful. If nobody complains, I'll release it in a week or two.

Looking forward to seeing the PR!

jsjeannotte commented 10 months ago

@nayaverdier Thanks, will try it today and report back.

nayaverdier commented 9 months ago

0.13.0 is now released, closing this ticket.