Skip to main content

Generate a recursive tree diagram given a starting directory or a list of URIs.

Project description

treegenerator

Generate a recursive tree diagram given a starting directory or a list of URIs.
Install with:

pip install treegenerator

Contains two classes: TreeGenerator and UrlTreeGenerator.
TreeGenerator takes a local file path and recursively generates a tree representation of all subdirectories.
UrlTreeGenerator takes a list of urls and generates a tree representation of them.

Usage:

from treegenerator import TreeGenerator
from pathlib import Path
generator = TreeGenerator(Path.cwd())
print(generator)

produces

treeGenerator
|  |-dist
|  |  |-treegenerator-0.0.1-py3-none-any.whl
|  |  |_treegenerator-0.0.1.tar.gz
|  |
|  |-LICENSE.txt
|  |-README.md
|  |-pyproject.toml
|  |-src
|  |  |-treeGenerator
|  |  |  |-__init__.py
|  |  |  |_treeGenerator.py

The dictionary representing the tree can be accessed through the 'tree' member.

import json
print(json.dumps(generator.tree, indent=1))

produces

{
 "treeGenerator": {
  "dist": {
   "treegenerator-0.0.1-py3-none-any.whl": {},
   "treegenerator-0.0.1.tar.gz": {}
  },
  "LICENSE.txt": {},
  "README.md": {},
  "pyproject.toml": {},
  "src": {
   "treeGenerator": {
    "__init__.py": {},
    "treeGenerator.py": {}
   }
  }
 }
}

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

treegenerator-1.0.1.tar.gz (37.6 kB view hashes)

Uploaded Source

Built Distribution

treegenerator-1.0.1-py3-none-any.whl (4.0 kB view hashes)

Uploaded Python 3

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