{"id":4219,"library":"python-benedict","title":"Python Benedict","description":"python-benedict is a `dict` subclass that enhances the standard Python dictionary with powerful features like keylist, keypath, and keyattr support. It provides normalized I/O operations for various data formats (including base64, csv, ini, json, pickle, plist, query-string, toml, xls, xml, yaml) and numerous utility methods. It is currently active, with its latest version being 0.35.0, and maintains a regular release cadence.","status":"active","version":"0.35.0","language":"en","source_language":"en","source_url":"https://github.com/fabiocaccamo/python-benedict","tags":["dictionary","data structure","keypath","io","serialization","nested-data"],"install":[{"cmd":"pip install python-benedict","lang":"bash","label":"Core package"},{"cmd":"pip install \"python-benedict[all]\"","lang":"bash","label":"All features and I/O formats"}],"dependencies":[{"reason":"Enables `from_html` method and related HTML I/O operations.","package":"html","optional":true},{"reason":"Enables TOML I/O operations (`from_toml`, `to_toml`).","package":"toml","optional":true},{"reason":"Enables XLS I/O operations (`from_xls`).","package":"xls","optional":true},{"reason":"Enables XML I/O operations (`from_xml`, `to_xml`).","package":"xml","optional":true},{"reason":"Enables YAML I/O operations (`from_yaml`, `to_yaml`).","package":"yaml","optional":true},{"reason":"Provides additional parsing utilities.","package":"parse","optional":true},{"reason":"Enables S3 backend support for I/O operations.","package":"s3","optional":true}],"imports":[{"symbol":"benedict","correct":"from benedict import benedict"}],"quickstart":{"code":"from benedict import benedict\n\n# Create a benedict instance from a dictionary\ndata = {\n    \"user\": {\n        \"profile\": {\n            \"name\": \"Alice\",\n            \"email\": \"alice@example.com\"\n        },\n        \"id\": 123\n    },\n    \"settings\": {\n        \"theme\": \"dark\"\n    }\n}\nd = benedict(data)\n\n# Access values using keypath (dot notation)\nprint(f\"User Name: {d['user.profile.name']}\")\n\n# Set values using keypath\nd['user.profile.age'] = 30\nprint(f\"User Age: {d.get('user.profile.age')}\")\n\n# Access using keylist (list of keys)\nprint(f\"User ID: {d[['user', 'id']]}\")\n\n# Output to JSON string\njson_output = d.to_json(indent=2)\nprint(\"\\nJSON Output:\")\nprint(json_output)","lang":"python","description":"This example demonstrates creating a `benedict` instance, accessing and setting values using both keypath (dot notation) and keylist (list of keys), and serializing the dictionary to a JSON string."},"warnings":[{"fix":"Upgrade Python to 3.10 or newer, or pin `python-benedict<0.34.0`.","message":"Version 0.34.0 dropped official support for Python 3.8 and 3.9. Users on these versions should remain on an earlier `python-benedict` release or upgrade their Python interpreter.","severity":"breaking","affected_versions":">=0.34.0"},{"fix":"Ensure that arguments passed for keylist access are strictly `list` types.","message":"In version 0.34.0, the `keylist` feature was fixed to work only with actual lists, addressing previous backward-compatibility issues with standard `dict` behavior. If you previously relied on non-list iterables for keylist operations, your code may break.","severity":"breaking","affected_versions":">=0.34.0"},{"fix":"Either choose a custom keypath separator by passing `keypath_separator='_'` (or another suitable character) to the `benedict` constructor, or disable keypath functionality with `keypath=False` if not needed. Alternatively, sanitize keys in the original dictionary.","message":"When casting an existing `dict` to a `benedict` instance, if the original dictionary's keys contain the default keypath separator ('.'), a `ValueError` may be raised.","severity":"gotcha","affected_versions":"<all>"},{"fix":"Adjust code to expect `benedict` instances from `items()` and `values()`, or explicitly cast results to `dict` if standard `dict` behavior is strictly required.","message":"As of version 0.32.1, the `items()` and `values()` methods return `benedict` instances (or `list` of `benedict` instances for values) rather than standard `dict_items` or `dict_values` objects. This might affect type checks or expected iteration behavior.","severity":"gotcha","affected_versions":">=0.32.1"}],"env_vars":null,"last_verified":"2026-04-11T00:00:00.000Z","next_check":"2026-07-10T00:00:00.000Z"}