Skip to main content

A powerful CLI tool to visualize project directory structure with smart exclusions and multiple output formats

Project description

Structure Viewer

CI Python Version License: MIT

A powerful CLI tool to visualize project directory structure with smart exclusions, multiple output formats, and colorized output.

Structure Viewer Demo

โœจ Features

  • ๐ŸŒณ Beautiful Tree Output - ASCII art tree representation with colorized output
  • ๐Ÿšซ Smart Exclusions - Automatically excludes common development artifacts (.git, node_modules, __pycache__, etc.)
  • ๐Ÿ“Š Multiple Formats - Output as tree, JSON, or YAML
  • ๐ŸŽจ Colorized Output - File type-aware syntax highlighting in terminal
  • ๐Ÿ”ง Highly Configurable - Custom exclusions, depth limiting, extension filtering
  • ๐Ÿ–ฅ๏ธ Cross-Platform - Works on Windows, macOS, and Linux

๐Ÿ“ฆ Installation

Using pip

pip install structure-viewer

Using pipx (recommended for CLI tools)

pipx install structure-viewer

From source

git clone https://github.com/crrrowz/structure-viewer.git
cd structure-viewer
pip install -e .

๐Ÿš€ Usage

Basic Usage

# Show structure of current directory
structure

# Show structure of a specific directory
structure ./my-project

# Show structure with limited depth
structure -d 2

Output Formats

# Default tree format
structure

# JSON output
structure -f json

# YAML output (requires PyYAML)
structure -f yaml

Filtering

# Only show Python files
structure -I py

# Exclude log and tmp files
structure -E log -E tmp

# Add custom exclusion patterns
structure -e "*.bak" -e "*.tmp"

# Show hidden files
structure -a

Other Options

# Show only directories
structure -q

# Show file/directory statistics
structure -s

# Disable colors
structure --no-color

๐Ÿ“‹ Example Output

my-project/
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ cli.py
โ”‚   โ”œโ”€โ”€ core.py
โ”‚   โ””โ”€โ”€ utils.py
โ”œโ”€โ”€ tests/
โ”‚   โ”œโ”€โ”€ conftest.py
โ”‚   โ”œโ”€โ”€ test_cli.py
โ”‚   โ””โ”€โ”€ test_core.py
โ”œโ”€โ”€ LICENSE
โ”œโ”€โ”€ README.md
โ””โ”€โ”€ pyproject.toml

2 directories, 10 files

โš™๏ธ CLI Reference

usage: structure [OPTIONS] [DIRECTORY]

Visualize project directory structure.

positional arguments:
  directory              Directory to scan (default: current directory)

options:
  -h, --help             Show this help message
  -V, --version          Show version number
  -d, --depth N          Maximum depth to display (default: unlimited)
  -e, --exclude PATTERN  Additional patterns to exclude (can be repeated)
  -I, --include-ext EXT  Only show files with these extensions
  -E, --exclude-ext EXT  Exclude files with these extensions
  -f, --format FORMAT    Output format: tree, json, yaml (default: tree)
  -a, --all              Show hidden files
  --no-color             Disable colorized output
  -q, --quiet            Only show directories
  -s, --stats            Show statistics

๐Ÿ”’ Default Exclusions

Structure Viewer automatically excludes common development artifacts:

Category Patterns
Version Control .git, .hg, .svn
Python __pycache__, .pytest_cache, .mypy_cache, *.egg-info
Node.js node_modules, .npm, .yarn
Build dist, build, out, target
IDEs .idea, .vscode, .vs
OS .DS_Store, Thumbs.db

๐Ÿ Python API

You can also use structure-viewer as a library:

from structure_viewer import walk_directory, format_tree

# Get the directory tree
tree = walk_directory("./my-project", max_depth=3)

# Format as ASCII tree
output = format_tree(tree, colorize=False)
print(output)

# Or as JSON
from structure_viewer import format_json
json_output = format_json(tree)

๐Ÿค Contributing

Contributions are welcome! Please see CONTRIBUTING.md for guidelines.

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

Inspired by the classic tree command and modern directory visualization tools.

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

structure_viewer-1.0.0.tar.gz (18.5 kB view details)

Uploaded Source

Built Distribution

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

structure_viewer-1.0.0-py3-none-any.whl (14.4 kB view details)

Uploaded Python 3

File details

Details for the file structure_viewer-1.0.0.tar.gz.

File metadata

  • Download URL: structure_viewer-1.0.0.tar.gz
  • Upload date:
  • Size: 18.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for structure_viewer-1.0.0.tar.gz
Algorithm Hash digest
SHA256 3a50bd77344a4792ac6f1929b9b44a5264357360382e4830e2e9550c0bca2cdb
MD5 6d971ec8a30e634d69bfd7354c13cdc1
BLAKE2b-256 54297a3676ccf2f112913cc1aa493b123a219345d24b647ab8791b189c5c6d10

See more details on using hashes here.

Provenance

The following attestation bundles were made for structure_viewer-1.0.0.tar.gz:

Publisher: publish.yml on crrrowz/structure-viewer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file structure_viewer-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for structure_viewer-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9d76f29ffc2d3597f506d25ff43d34b19baa6f1dc8b39174f7450896b3ba3397
MD5 8bccae0a79551efe0053a926d6491857
BLAKE2b-256 b2d01488d8d4172b2f7d6f57884d95d947bd801254f647cda1533b4fbdc10158

See more details on using hashes here.

Provenance

The following attestation bundles were made for structure_viewer-1.0.0-py3-none-any.whl:

Publisher: publish.yml on crrrowz/structure-viewer

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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