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
File details
Details for the file python-needle-0.1.dev38.tar.gz
.
File metadata
- Download URL: python-needle-0.1.dev38.tar.gz
- Upload date:
- Size: 807.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 56c9549f8a66ff33d94fe3e2e9c2d84d554e9b0c305bba3a38104553b7403747 |
|
MD5 | 61603a9638376cc710690d1424affffc |
|
BLAKE2b-256 | 8463361217faf701a88ddf120e19525337a65770be317d08883c340bdd55222d |
File details
Details for the file python_needle-0.1.dev38-py3-none-any.whl
.
File metadata
- Download URL: python_needle-0.1.dev38-py3-none-any.whl
- Upload date:
- Size: 10.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 26293b93c6afa0a9fbba1fe0ac826fd0372eb2ef978a72505204e6b105e26a40 |
|
MD5 | 4d5785f5cd5022cc8914e06032e50f96 |
|
BLAKE2b-256 | 270bad3aea10dec4eb60eb4f3640cb73c61dd9eacadd3d1c7252ffd8d084a2fa |