Skip to main content

'dtree': Linux 'tree' but for dictionaries

Project description

dtree: Linux tree but for dictionaries

Dictionaries are fun and useful!. But just like a folder structure, they can be multitiered storing all kinds of things in nested hierarchies. tree is a Linux utility that prints the multilevel structure of directories as a beautiful tree. dtree does the same but for dictionaries.

Example

Consider the following dictionary

dictionary = { "A": { "B": { "C": 0, "D": "some-string" }, "E": None }, "F": { "G": 0.0, "H": set([]) } }

Using dtree you can print the tree structure in different ways:

Demo

Installation

This utility can be installed directly from PyPI as:

pip install dict-metalcycling

For local installations intended for development, from the top of this repository run:

pip install -e .

Known limitations

This version currenly prints the str representation of the dictionary keys for the nodes of the tree. When keys are custom class objects, printing them could be very verbose so that would cause issues with the printed tree. I'll fix this in future PRs.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

dtree-metalcycling-0.2.0.tar.gz (148.2 kB view details)

Uploaded Source

Built Distribution

dtree_metalcycling-0.2.0-py3-none-any.whl (11.7 kB view details)

Uploaded Python 3

File details

Details for the file dtree-metalcycling-0.2.0.tar.gz.

File metadata

  • Download URL: dtree-metalcycling-0.2.0.tar.gz
  • Upload date:
  • Size: 148.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.9.18

File hashes

Hashes for dtree-metalcycling-0.2.0.tar.gz
Algorithm Hash digest
SHA256 a86e89cd6cdb62b4c40216a0560038b75a25cf4d6a9a078d34b7eda03a2a102e
MD5 c4e92c612a0e50b85a04d4edfd368e62
BLAKE2b-256 3b5c64f6a24241b52e6e45106f5f60c9e493c04633ede053ea3b0dec89a71743

See more details on using hashes here.

Provenance

File details

Details for the file dtree_metalcycling-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for dtree_metalcycling-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 1f8bc297accf98c0cf4ae4cb6f6284788d6d0da9e9c07cef783ab577f05b757d
MD5 0a5eabfa468026006d8f8648105ec6ec
BLAKE2b-256 c9d5bbca885a0e0e62e9c3b9ad526109c3a00703c35efe4454e0fa98b56d753e

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page