{"id":23867,"library":"hydraters","title":"Hydraters","description":"Hydrate Python dictionaries with Rust – provides fast, typed hydration and dehydration of Python dicts using Rust-backed classes. Current version 0.1.3, actively maintained.","status":"active","version":"0.1.3","language":"python","source_language":"en","source_url":"https://github.com/developmentseed/hydraters","tags":["hydration","rust","serialization","dataclasses"],"install":[{"cmd":"pip install hydraters","lang":"bash","label":"Install from PyPI"}],"dependencies":[],"imports":[{"note":"Old path before v0.1.3","wrong":"from hydraters.hydrate import Hydrate","symbol":"Hydrate","correct":"from hydraters import Hydrate"},{"note":"Old path before v0.1.3","wrong":"from hydraters.dehydrate import Dehydrate","symbol":"Dehydrate","correct":"from hydraters import Dehydrate"}],"quickstart":{"code":"from hydraters import Hydrate\n\n# Define a simple class to hydrate\nclass Person:\n    def __init__(self, name: str, age: int):\n        self.name = name\n        self.age = age\n\n# Create a Hydrate instance\nhydrator = Hydrate(Person)\n\n# Hydrate a dict into an instance\ndata = {\"name\": \"Alice\", \"age\": 30}\nperson = hydrator.hydrate(data)\nprint(person.name, person.age)  # Alice 30","lang":"python","description":"Basic usage: create a Hydrate instance with a class, then call .hydrate() on a dict."},"warnings":[{"fix":"Ensure your class has type annotations on __init__ parameters or is a dataclass.","message":"Hydrate only works with dataclasses or classes that have __init__ annotated with types. Plain dicts or non-annotated classes will fail.","severity":"gotcha","affected_versions":"all"},{"fix":"Provide all fields in the dict, or use a custom default handling.","message":"The library does not support default values or optional fields in the hydrated class. All fields must be provided.","severity":"gotcha","affected_versions":"all"},{"fix":"Use 'from hydraters import Hydrate' instead.","message":"The old import path 'from hydraters.hydrate import Hydrate' is deprecated and may be removed in a future release.","severity":"deprecated","affected_versions":">=0.1.3"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Ensure you use 'from hydraters import Hydrate' and pass a class to the constructor: Hydrate(MyClass)","cause":"Hydrate instance was not created correctly, possibly due to wrong import or missing class.","error":"AttributeError: 'NoneType' object has no attribute 'hydrate'"},{"fix":"Include all required fields in the dict, matching the class annotations.","cause":"The dict does not contain a required field for the class's __init__.","error":"TypeError: __init__() missing 1 required positional argument: 'name'"},{"fix":"Upgrade to latest version: pip install --upgrade hydraters. Then use 'from hydraters import Hydrate'.","cause":"Using an old version or wrong import path. Before v0.1.3 the symbol was under nested module.","error":"ImportError: cannot import name 'Hydrate' from 'hydraters'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}