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.1.0.tar.gz (148.0 kB view details)

Uploaded Source

Built Distribution

dtree_metalcycling-0.1.0-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: dtree-metalcycling-0.1.0.tar.gz
  • Upload date:
  • Size: 148.0 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.1.0.tar.gz
Algorithm Hash digest
SHA256 dbc4e08985f20cdb415d7cba9fdee10c47e1140c2a67f3cc1ceb822e041add0c
MD5 3caaae5132fe43af51a994c37fe65f36
BLAKE2b-256 e81f1acb9b89cdbcbb4d5f50290107ffa7aa6025994e7be4ec94494f88d5bcb4

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for dtree_metalcycling-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3300df11c69c5ea4972075f01ace520ec076db9ec7ab187e764c53bec272443b
MD5 cb8161f30cb41b90e4a87e4ca6bf9b3b
BLAKE2b-256 0b6ee19c1fe62648b51c1d82437036931d5e71be4573198f03d43d53b9aa3d14

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