Skip to main content

'dtree': Linux 'tree' but for Python dictionaries

Project description

dtree: Linux tree but for Python 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 dtree-metalcycling

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

pip install -e .

Known limitations

This version currently 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.4.2.tar.gz (141.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

dtree_metalcycling-0.4.2-py2.py3-none-any.whl (7.8 kB view details)

Uploaded Python 2Python 3

File details

Details for the file dtree_metalcycling-0.4.2.tar.gz.

File metadata

  • Download URL: dtree_metalcycling-0.4.2.tar.gz
  • Upload date:
  • Size: 141.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.11

File hashes

Hashes for dtree_metalcycling-0.4.2.tar.gz
Algorithm Hash digest
SHA256 e7c0a4da5d66b8a86cb5fb1ab6da264bf0348c207fee7b2236b72aaae0922141
MD5 b1c30e4f1decac93bf5ee6f09e90ca30
BLAKE2b-256 b1fa13a87b381525b4167e8995f0f778e222ab08687e36ec71b5d29e72487055

See more details on using hashes here.

File details

Details for the file dtree_metalcycling-0.4.2-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for dtree_metalcycling-0.4.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 7082ef206869543735c7ef51b633eec30671ac1b9fe9817ab22f7c4e26526804
MD5 fbdae883511bd97b9c09277357cfc700
BLAKE2b-256 95522cf0f9941207d267e451fe06538dc97a3f57d5e76f134edafd9655de479d

See more details on using hashes here.

Supported by

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