Skip to main content

A command-line tool to visualize disk usage as a treemap-inspired ASCII mosaic

Project description

disk-canvas

PyPI version Python Versions License: MIT Code style: black

A command-line tool to visualize disk usage as a treemap-inspired ASCII mosaic. It scans a directory and produces a mosaic of uniformly sized, color-coded blocks based on file size and category. The visualization is designed to work on Linux and macOS.

Features

  • ASCII Mosaic Visualization: A terminal-friendly mosaic that offers a quick visual summary of disk usage.
  • Color-Coded Output: Uses a modern Plotly-inspired color palette.
  • Multiple Modes: Detailed mode with a legend mapping file extensions, or a simplified mode grouping files by category.
  • Cross-Platform: Works on Linux and macOS.
  • Smart File Categorization: Automatically categorizes files into:
    • Code (Python, Java, JavaScript, etc.)
    • Notebooks (Jupyter, R Markdown)
    • Data (CSV, JSON, SQL, etc.)
    • Compressed (ZIP, TAR, etc.)
    • Cache/Build files
    • Media (Images, Video, Audio)
    • Documents (PDF, Office, Text)
    • Configuration files
  • Flexible Display Options: Choose between a sorted mosaic view or a treemap-style visualization.

Installation

From PyPI

pip install disk-canvas

From Source

Clone the repository, then run:

cd disk-canvas
pip install .

Usage

Basic usage:

python -m disk_canvas /path/to/directory

Full options:

python -m disk_canvas /path/to/directory [-t TOP] [-f] [-d DEPTH] [-D] [-U]

Options:

  • -t, --top: Number of largest items per depth (default: 10)
  • -f, --files: Show only files (exclude directories)
  • -d, --depth: Maximum directory depth (default: 1)
  • -D, --detail: Display a detailed legend with file extensions
  • -U, --unsort: Use unsorted (treemap) canvas layout (default is sorted mosaic)

Example Output

Disk Usage Visualization for: /Users/bz/Developer/disk-canvas
Total size: 405.8K

Top 10 largest items (max depth: 1):
      Size Type   Depth  Category     Path
----------------------------------------------------------
    405.8K [DIR]  0      DIR          .
    156.6K [DIR]  1      DIR          .git
     79.6K [DIR]  1      DIR          tests
     54.7K [DIR]  1      DIR          disk_canvas
     52.0K [FILE] 1      OTHER        .coverage
     27.9K [DIR]  1      DIR          dist
     13.8K [FILE] 1      DATA         coverage.xml
      5.6K [DIR]  1      DIR          disk_canvas.egg-info
      4.8K [FILE] 1      DOCUMENT     README.md
      2.8K [DIR]  1      DIR          .pytest_cache

████████████████▒▒▒▒◆◆◆◆◆······················○○........................
███████████████▒▒▒▒▒◆◆◆◆◆······················○○........................
███████████████▒▒▒▒▒◆◆◆◆◆·····················○○○........................
███████████████▒▒▒▒▒◆◆◆◆◆·····················○○○........................
███████████████▒▒▒▒▒◆◆◆◆······················○○☰........................
███████████████▒▒▒▒▒◆◆◆◆······················○○.........................

Detailed Extension Legend:

CODE files: (55.3K)
  █ .py      (10 files, 55.3K)

DATA files: (17.6K)
  ▒ .xml     (1 files, 13.8K)
  ▒ .toml    (1 files, 1.8K)
  ▒ .yml     (2 files, 1.5K)
  ▒ .yaml    (1 files, 617.0B)

COMPRESSED files: (16.9K)
  ◆ .gz      (1 files, 16.9K)

CACHE files: (78.9K)
  · .pyc     (10 files, 78.9K)

DOCUMENT files: (8.3K)
  ○ .md      (4 files, 7.6K)
  ○ .txt     (5 files, 690.0B)

CONFIG files: (734.0B)
  ☰ .gitignore (2 files, 551.0B)
  ☰ .flake8  (1 files, 183.0B)

OTHER files: (88.7K)
  . .coverage (1 files, 52.0K)
  . .sample  (13 files, 23.0K)
  . .whl     (1 files, 11.0K)
  . .pack    (1 files, 1.5K)
  . .idx     (1 files, 1.1K)
  . .tag     (1 files, 191.0B)

Color and Symbol Legend

The visualization uses different symbols for different file types:

  • - Code files
  • - Notebooks
  • - Data files
  • - Compressed files
  • · - Cache files
  • - Image files
  • - Video files
  • - Audio files
  • - Documents
  • - Config files
  • . - Other files

In simplified mode, similar categories share the same symbol for a cleaner view.

Requirements

  • Python 3.8 or higher
  • Linux or macOS (Windows support is limited due to terminal color support)

Contributing

We welcome contributions! Please see our Contributing Guidelines for details.

Development

For development setup and guidelines, please refer to the Contributing Guidelines.

Running Tests

pip install -e ".[dev]"
pytest

Code Style

The project uses:

Changelog

See CHANGELOG.md for a list of changes.

License

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

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

disk_canvas-0.1.1.tar.gz (20.3 kB view details)

Uploaded Source

Built Distribution

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

disk_canvas-0.1.1-py3-none-any.whl (13.5 kB view details)

Uploaded Python 3

File details

Details for the file disk_canvas-0.1.1.tar.gz.

File metadata

  • Download URL: disk_canvas-0.1.1.tar.gz
  • Upload date:
  • Size: 20.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.18

File hashes

Hashes for disk_canvas-0.1.1.tar.gz
Algorithm Hash digest
SHA256 c396d6d9e941372139d6c092c8745ab513b739fafb3ba56defb84c864c0fc7a6
MD5 2270538d451f8cd7ae76212816ee48c5
BLAKE2b-256 69aa0632f4418a654e626c1376ee2978cda612cba923e446a3fcc48f700f15b1

See more details on using hashes here.

File details

Details for the file disk_canvas-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: disk_canvas-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 13.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.8.18

File hashes

Hashes for disk_canvas-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 99e04ae931e25ab6d75b88aa3ab78b38dbc4a7d2283b4df5e3eabfbb45d800a7
MD5 3d9434a461c6e12305332e35bea1fdd2
BLAKE2b-256 8be79df679a5d94d6d2c572d7e042c38e3fa351b427e4615de10586f6ce029ab

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