{"id":6342,"library":"dictpath","title":"DictPath","description":"DictPath provides an object-oriented way to navigate and manipulate nested dictionaries using path-like expressions. It allows for robust and type-safe access to dictionary values, supporting various path syntaxes and advanced traversal features. The current stable version is 0.5.0, with a release cadence that has recently seen significant updates focused on API enhancements and performance.","status":"active","version":"0.5.0","language":"en","source_language":"en","source_url":"https://github.com/p1c2u/dictpath","tags":["dictionary","path","accessor","nested-data","data-structure","navigation","type-safe"],"install":[{"cmd":"pip install dictpath","lang":"bash","label":"Install stable version"}],"dependencies":[],"imports":[{"symbol":"AccessorPath","correct":"from dictpath import AccessorPath"}],"quickstart":{"code":"from dictpath import AccessorPath\n\ndata = {\n    'user': {\n        'profile': {\n            'name': 'Alice',\n            'age': 30,\n            'contact': [\n                {'type': 'email', 'value': 'alice@example.com'},\n                {'type': 'phone', 'value': '123-456-7890'}\n            ]\n        }\n    }\n}\n\n# Create a path accessor\npath = AccessorPath('user.profile.name')\n\n# Read a value\nname = path.read_value(data)\nprint(f\"User name: {name}\")\n\n# Access a nested list item\nemail_path = AccessorPath('user.profile.contact.0.value')\nemail = email_path.read_value(data)\nprint(f\"User email: {email}\")\n\n# Using subscriptable accessors (0.5.0+)\nphone_path = AccessorPath('user')['profile']['contact'][1]['value']\nphone = phone_path.read_value(data)\nprint(f\"User phone: {phone}\")\n\n# Getting a default value if path doesn't exist\nmissing_path = AccessorPath('user.profile.address')\naddress = missing_path.read_value(data, default='No address provided')\nprint(f\"User address: {address}\")","lang":"python","description":"This quickstart demonstrates creating an AccessorPath object and using it to read values from a nested dictionary. It covers basic dot notation, accessing list elements, and using the new subscriptable accessor syntax introduced in 0.5.0. It also shows how to provide a default value for missing paths."},"warnings":[{"fix":"Upgrade your Python environment to 3.8 or newer. If not possible, downgrade dictpath to a version compatible with your Python interpreter (e.g., `pip install 'dictpath<0.5.0'` for Python 3.5-3.7 compatibility with older releases).","message":"Version 0.5.0 and later now require Python 3.8+. Previous versions (0.1.x) supported Python 2.7 and a broader range of Python 3 versions. Applications on older Python versions must update their environment or stick to `dictpath<0.5.0`.","severity":"breaking","affected_versions":">=0.5.0"},{"fix":"Update imports and code references from `BaseAccessor` to `NodeAccessor`. Consult the 0.5.0 documentation for the new `NodeAccessor` API.","message":"The `BaseAccessor` class was replaced by `NodeAccessor` in the 0.5.0 release series (specifically from 0.5.0a3). Direct usage or subclassing of `BaseAccessor` will lead to `NameError` or `ImportError`.","severity":"breaking","affected_versions":">=0.5.0a3"},{"fix":"Review and update type annotations for `AccessorPath` instances. While basic usage might remain functional, type checkers will flag incompatibilities. Refer to the 0.5.0 documentation for updated typing guidance.","message":"The `AccessorPath` class became generic in the 0.5.0 release series (specifically from 0.5.0a3). This change primarily affects type hints and advanced usage involving generics, potentially breaking existing type annotations or specific instantiation patterns.","severity":"breaking","affected_versions":">=0.5.0a3"},{"fix":"Ensure your path strings adhere strictly to documented formats. Test existing paths thoroughly after upgrading to 0.5.0 to catch any new parsing exceptions. Consult the `dictpath` documentation for specific parsing rules.","message":"Version 0.5.0 introduced \"Expanded parsing and typing guarantees,\" which might mean stricter validation of path strings. Paths that were previously tolerated but ambiguous or malformed might now raise errors.","severity":"gotcha","affected_versions":">=0.5.0"}],"env_vars":null,"last_verified":"2026-04-15T00:00:00.000Z","next_check":"2026-07-14T00:00:00.000Z"}