Skip to main content
Pre-release

This release is a pre-release and may not be stable for production use.

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.

Metadata

Release files for python-needle 0.1.dev38

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for python-needle 0.1.dev38
File Size Uploaded
python-needle-0.1.dev38.tar.gz 807.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for python-needle 0.1.dev38
File Interpreter ABI Platform
python_needle-0.1.dev38-py3-none-any.whl Python 3 none any Details

Total release size: 818.4 kB

Release files / python-needle-0.1.dev38.tar.gz

Download URL python-needle-0.1.dev38.tar.gz
Size 807.8 kB
Tags Source
SHA-256 checksum
How to use checksums
56c9549f8a66ff33d94fe3e2e9c2d84d554e9b0c305bba3a38104553b7403747
BLAKE2b-256 checksum
How to use checksums
8463361217faf701a88ddf120e19525337a65770be317d08883c340bdd55222d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.2

Release files / python_needle-0.1.dev38-py3-none-any.whl

Download URL python_needle-0.1.dev38-py3-none-any.whl
Size 10.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
26293b93c6afa0a9fbba1fe0ac826fd0372eb2ef978a72505204e6b105e26a40
BLAKE2b-256 checksum
How to use checksums
270bad3aea10dec4eb60eb4f3640cb73c61dd9eacadd3d1c7252ffd8d084a2fa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.10.2
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page