I'm sure that most python developers who have worked with pickle for more than 3 lines of code can confirm that pickle does not in fact just work
Re:Don't Pickle Your Data
by bobbylarrybobby on Thursday August 11, 2022 @09:25PM
(#32433834)
The real question is why doesn't Python have something like a class decorator`@json.interchangeable` that you can apply to a class -- maybe dataclasses only? -- to have json (de)serialization be only three lines of code (or less).
There is dataclasses-json which does this
I implemented a shoddy version of this once (before accepting that pickles are worth it) only took like 100 LOC for serialization and deserialization.
The problem is that "the average home-made Python script" frequently ends up turning into a critical production system.
ie, a bunch of drawbacks that don't really matter at all for the average home-made Python script, plus the "minor" advantage of being able to pickle literally anything and have it "just work".
None of the other options out there let you build a foolproof "save button" in 3 lines of code.