Pathable is a Python library that provides object-oriented paths for traversing hierarchical data structures like dictionaries and lists, as well as file systems. It offers an intuitive, chainable API for deep lookups, incremental path building, and safe probing of data. The library is actively maintained with frequent releases, with version 0.5.0 being the latest stable release.
pip install pathableVerified import paths — ran on the pinned version, not inferred.
This example demonstrates how to use `LookupPath` to navigate and access values within nested dictionary structures using a pathlib-like syntax. It shows basic navigation, value reading, existence checks, and safe access with a default fallback.
Update all imports and references from `BaseAccessor` to `NodeAccessor`. Review your code for areas where custom accessors might need adaptation to the new `NodeAccessor` interface.
Review type hints for `AccessorPath` instances. If you have custom subclasses or functions expecting specific types, you may need to add or adjust generic type parameters (e.g., `AccessorPath[SomeType]`).
If your project still requires `pyrsistent`, you must explicitly add `pip install pyrsistent` to your project's dependencies.
Update your code to use the current method for constructing `LookupPath` instances from lookup data. This may involve using the class constructor directly (e.g., `LookupPath(data)`) or a different factory method introduced in the new API.
Install the library using pip: `pip install pathable`
Use safe access methods like `.get('<key>', default=None)` to provide a default value if the key is missing, or check for existence with `.exists()` before strict access. For example, change `p // 'a' // 'c'` to `(p / 'a' / 'c').get(default=None)`.Migrate to the newer, supported API. For example, instead of `p.get('key')`, use `(p / 'key').read_value()` or direct subscriptable access `p['key']` (if the path is already resolved to the appropriate level), or `p.read_value()` after building the path. For iteration, use standard Python iteration directly on the path object, e.g., `for child in p:`.No dependency data recorded yet.