Registry / serialization / plucky

plucky

JSON →
library0.4.3pypypi✓ verified 83d ago

Plucking (deep) keys/paths safely from python collections has never been easier. Version 0.4.3. Low activity, last release Jul 2021.

pip install plucky
INSTALL
IMPORT
SIG · PLUCKY
P
plucky
serializationpythonv0.4.3
Install
1.5s avg
Import
Disk
16MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.4.3 · 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.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 17.8MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 1.5s · import 0.000s · 18MB
16MB installed
● package 16MB
Code
Verified usage

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

pluck
from plucky import pluck
set_keys
from plucky import set_keys

Basic usage of pluck and set_keys

from plucky import pluck, set_keys data = {'a': {'b': [{'c': 1}, {'c': 2}]}} # pluck deep key result = pluck(data, 'a.b.0.c') print(result) # 1 # set deep key set_keys(data, 'a.b.0.c', 42) print(pluck(data, 'a.b.0.c')) # 42
Debug
Known issues
gotchapluck raises KeyError by default if path does not exist; use default= or safe=True to avoid exceptions.
fix
Use pluck(data, 'missing.key', default=None) or pluck(data, 'missing.key', safe=True).
affects: >=0.4.0
gotchaPath syntax uses dot-separated keys and integer indices for lists (e.g., 'a.0.b'), not bracket notation.
fix
Use 'items.0.name' instead of 'items[0].name'.
affects: all
deprecatedThe function 'plucks' (plural) is deprecated in favor of 'pluck' with safe=True or default.
fix
Replace plucks(data, path) with pluck(data, path, default=...).
affects: >=0.3.0
Errors
Common errors & fixes
AttributeError: module 'plucky' has no attribute 'pluck'
Importing incorrectly (e.g., import plucky then plucky.pluck) but module exposes functions only via direct import.
fix
Use 'from plucky import pluck' instead of 'import plucky' and plucky.pluck.
KeyError: 'missing'
Using pluck without a default or safe mode when path doesn't exist.
fix
Add default parameter: pluck(data, 'missing.key', default=None).
ValueError: invalid literal for int() with base 10: 'key'
Path segment is not a valid integer index when accessing a list element.
fix
Ensure path segments for list indices are integers, e.g., 'items.0.name'.
Upgrade
Version history
0.4.3latest on PyPI · released Sep 5, 2018
Audit
Dependencies

No dependency data recorded yet.

Agent activity
6 hits · last 30 days
node
6
Resources
plucky — pip install plucky · libregistry