Registry / data / pathable

pathable

JSON →
library0.5.0pypypi✓ verified 52d ago

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.

dataserialization
pip install pathable
Install & Compatibility
Where this runs
tested against v0.6.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.925 runs
installs and imports cleanly · install 0.0s · import 0.054s · 17.9MB
glibc
py 3.103.925 runs
installs and imports cleanly · install 1.6s · import 0.056s · 18MB
16MB installed
● package 16MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

LookupPath
from pathable import LookupPath
FilesystemPath
from pathable import FilesystemPath
NodeAccessor
from pathable import NodeAccessor
from pathable import BaseAccessor
BaseAccessor was replaced by NodeAccessor in version 0.5.0a3.

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.

from pathable import LookupPath data = { "parts": { "part1": {"name": "Part One"}, "part2": {"name": "Part Two"} } } root = LookupPath.from_lookup(data) # Navigate using slash operator name_path = root / "parts" / "part2" / "name" name = name_path.read_value() print(f"Value found: {name}") assert name == "Part Two" # Check existence assert (root / "parts" / "part1").exists() assert not (root / "non_existent").exists() # Safe access with .get() part3_name = (root / "parts").get("part3", default=None) print(f"Value with .get(): {part3_name}") assert part3_name is None
Debug
Known issues
breaking`BaseAccessor` was replaced by `NodeAccessor`. Code directly using `BaseAccessor` will fail.
fix
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.
affects: >=0.5.0a3
breaking`AccessorPath` became generic. This change impacts type hints and potentially runtime behavior where type arguments for `AccessorPath` were not previously expected or provided.
fix
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]`).
affects: >=0.5.0a3
gotchaThe `pyrsistent` dependency was removed in version 0.5.0b3. While an internal optimization for `pathable`, if your project implicitly relied on `pyrsistent` being installed as a transitive dependency of `pathable`, it will no longer be available automatically.
fix
If your project still requires `pyrsistent`, you must explicitly add `pip install pyrsistent` to your project's dependencies.
affects: >=0.5.0b3
breakingThe static method `LookupPath.from_lookup` has been removed or renamed.
fix
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.
affects: >=0.5.0
Errors
Common errors & fixes
ModuleNotFoundError: No module named 'pathable'
The 'pathable' library is not installed in your Python environment or is not accessible on the Python path.
fix
Install the library using pip: `pip install pathable`
KeyError: '<missing_key>'
You are attempting to access a path segment that does not exist in the underlying data structure using strict access (e.g., the `//` operator or `.read_value()` on a non-existent path).
fix
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)`.
AttributeError: 'LookupPath' object has no attribute '<deprecated_method>'
You are trying to use a method that has been deprecated or removed in `pathable` version 0.5.0 (e.g., `iter`, `iteritems`, `content`, `get`, `getkey`).
fix
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:`.
Upgrade
Version history
0.6.0latest on PyPI
Audit
Dependencies

No dependency data recorded yet.

Agent activity
11 hits · last 30 days
seranking-bot
4
node
2
ahrefsbot
2
bingbot
1
Resources