Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend pydantic dataclass decorator to add sane defaults for serialization #70

Open
9 tasks
lorenzo-w opened this issue Feb 2, 2024 · 0 comments
Open
9 tasks

Comments

@lorenzo-w
Copy link
Contributor

lorenzo-w commented Feb 2, 2024

  • Parse from dict
  • Parse from single first constructor argument (if not dict) or tuple of required arguments
  • Serialize to single arg or tuple of required args, if all keywords are default
  • Serialize to dict otherwise
  • Add generic wrapper type for allowing instances or aforementioned representations inside other composite types in Python
  • Make it always frozen / immutable
  • Use descriptor protocol with different types for getter / setter to accept common mutable types as args during construction (dict, set, list, ...) but save and express them only as matching immutable types (frozendict, frozenset, tuple)
  • Have the objects be hashable as long as they don't contain references to non-serializable, local-only resources (data items are serialized to primitives / dicts and globally-accessible resources are serialized to URLs)
  • Give the option to generate local hashes, which support referencing of local-only resources but are also only unique & valid locally
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant