{"id":27386,"library":"serpy","title":"serpy","description":"serpy is a fast, simple object serialization library for Python, inspired by Django REST Framework (DRF) serializers but with a focus on speed. Current version is 0.3.1, released in 2018, with no recent updates. It supports Python 2.7 to 3.6 and has a low release cadence.","status":"maintenance","version":"0.3.1","language":"python","source_language":"en","source_url":"https://github.com/clarkduvall/serpy","tags":["serialization","json","django-rest-framework","fast"],"install":[{"cmd":"pip install serpy","lang":"bash","label":"Install via pip"}],"dependencies":[],"imports":[{"note":"Importing `serpy` directly doesn't give you `Serializer`; you need to import the class explicitly.","wrong":"import serpy","symbol":"Serializer","correct":"from serpy import Serializer"},{"note":"Fields are not in a submodule; they are directly in `serpy`.","wrong":"from serpy.fields import IntField","symbol":"IntField","correct":"from serpy import IntField"}],"quickstart":{"code":"import serpy\n\nclass PersonSerializer(serpy.Serializer):\n    name = serpy.StrField()\n    age = serpy.IntField()\n\nperson = {'name': 'Alice', 'age': 30}\nserializer = PersonSerializer(instance=person)\nresult = serializer.data\nprint(result)  # {'name': 'Alice', 'age': 30}","lang":"python","description":"Define a serializer class and serialize a dictionary or object instance."},"warnings":[{"fix":"Review serializers that rely on `None` values being present; set `required=True` if you want `None` values included.","message":"Upgrading from 0.1.x to 0.2.0: If `required=False`, `None` values are now dropped from the output. Also, support for Python 2.6 is dropped.","severity":"breaking","affected_versions":"0.1.x -> 0.2.0"},{"fix":"Adjust serializers relying on the old behavior: now `None` values are kept regardless of `required`, except when key is missing.","message":"In version 0.3.0, behavior for `required=True` and `required=False` changed to match DRF. Previously, `required=False` might have dropped `None` values; now `None` values are included. Missing keys cause `KeyError` for `required=True`.","severity":"breaking","affected_versions":"0.2.x -> 0.3.0"},{"fix":"Ensure your `MethodField` method does not rely on catching these exceptions implicitly; handle them inside the method.","message":"MethodField catches `AttributeError` and `KeyError` only if the method returns a value; if the method raises those errors for missing attributes, they are not caught and propagate.","severity":"gotcha","affected_versions":">=0.3.1"},{"fix":"Consider using `marshmallow` or `pydantic` for ongoing support and modern Python.","message":"The library is no longer actively maintained; last release was 2018. No support for modern Python (3.7+), including f-strings, type hints, or asyncio.","severity":"deprecated","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use `from serpy import Serializer` or `import serpy; serpy.Serializer`.","cause":"Importing only `import serpy` without the class.","error":"AttributeError: module 'serpy' has no attribute 'Serializer'"},{"fix":"Use `instance=...` instead of `obj=...`.","cause":"Using keyword argument `obj` instead of `instance` (changed in 0.1.0).","error":"TypeError: __init__() got an unexpected keyword argument 'instance'"},{"fix":"Use `required=False` on the field, or ensure the key exists.","cause":"Serializing a dictionary missing a key with `required=True` (default).","error":"KeyError: 'name'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}