A package helping to navigate nested structures easily
Project description
Needle
Navigating nested structures easily.
Description
The idea behind this package is to provide a simple interface allowing to "flatten" nested structures into a plain table where each key is represented as a fully qualified name that leads to a certain field in the structure. It is especially useful when dealing with complex configuration objects that are merged into one from several files or container, and include very long keys that aren't easily visualized via pretty printing.
Functionality
The package's goal is to provide a simple interface for navigating configurations right in the terminal while debugging an executed script. It provides two basic high-level functions:
from needle import search, view
obj = { ... } # some nested object
# parsing keys (with optional depth limitation)
s = search(obj, max_depth=3)
print(s.top.flat_keys) # all keys available on the topmost level
s.subsearch("dataset") # navigating to the "dataset" subsection
print(s.top.flat_keys) # now, the "dataset" subsection is on the top of the stack
view(obj) # starts an interactive mode as showed below
Showcase
Why?
The author of this package encountered a problem of navigating a deeply nested objects often enough to bother writing a dedicated package that (in his opinion) should simplify that endeavor.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for python_needle-0.1.dev37-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b5970a2a84271b8d8674e1e881487fd35b87eddb711d254fc8a5007738192c85 |
|
MD5 | 6f5aa76f2c14d683ef8790474e50e8b6 |
|
BLAKE2b-256 | 1c5d52823a5ea461cc0c14432f2b70427aec92d672c47e55cef6fa5a439d987c |