disk-canvas
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.
Metadata
Release files for disk-canvas 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| disk_canvas-0.1.1.tar.gz | 20.3 kB | Without provenance | Details for disk_canvas-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| disk_canvas-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for disk_canvas-0.1.1-py3-none-any.whl |
Total release size: 33.7 kB
Release files / disk_canvas-0.1.1.tar.gz
| Download URL | disk_canvas-0.1.1.tar.gz |
|---|---|
| Size | 20.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c396d6d9e941372139d6c092c8745ab513b739fafb3ba56defb84c864c0fc7a6
|
|
BLAKE2b-256 checksum How to use checksums |
69aa0632f4418a654e626c1376ee2978cda612cba923e446a3fcc48f700f15b1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.8.18
|
Release files / disk_canvas-0.1.1-py3-none-any.whl
| Download URL | disk_canvas-0.1.1-py3-none-any.whl |
|---|---|
| Size | 13.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
99e04ae931e25ab6d75b88aa3ab78b38dbc4a7d2283b4df5e3eabfbb45d800a7
|
|
BLAKE2b-256 checksum How to use checksums |
8be79df679a5d94d6d2c572d7e042c38e3fa351b427e4615de10586f6ce029ab
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.8.18
|
Security for disk-canvas 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.