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

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: dtree-metalcycling-0.3.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.3.0.tar.gz
Algorithm Hash digest
SHA256 c2edbaf25670100198451d83e363d8d894ec53c0716cfa4bd0ca2c84b978d017
MD5 74eda882af8f61e004c740f2bd1ec834
BLAKE2b-256 ca3a5c89113904cd67e2cb78d2f131b56f5d5be0ffcb867385946d154a164598

See more details on using hashes here.

Provenance

File details

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

File metadata

File hashes

Hashes for dtree_metalcycling-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6adaa5dd050997d2dd42d0830c9ecd33d9303e9fbc87bcb7c0fb6f6d871dfd51
MD5 75dce8f8ddbfb7c0d83619a6d9b59b8a
BLAKE2b-256 cab17c306b55bf4987690712b45de0ebf89ac1238cf7d8bbb47243e2cf9a3889

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