Skip to main content

disk-tree

Disk-space tree-maps and statistics

https://github.com/runsascoded/disk-tree/assets/465045/6d5051a0-fc67-42b0-ae12-f4db6b19a78d

Index

Install

pip install disk-tree
disk-tree --help
# Usage: disk-tree [OPTIONS] [URL]
#
# Options:
#   -c, --color TEXT        Plotly treemap color configs: "name", "size",
#                           "size=<color-scale>" (cf.
#                           https://plotly.com/python/builtin-
#                           colorscales/#builtin-sequential-color-scales)
#   -C, --cache-path TEXT   Path to SQLite DB (or directory containing disk-
#                           tree.db) to use as cache; default:
#                           $HOME/.config/disk-tree/disk-tree.db
#   -f, --fsck              `file` scheme only: validate all cache entries that
#                           begin with the provided path(s); when passed twice,
#                           exit after performing fsck  [x>=0]
#   -m, --max-entries TEXT  Only store/render the -m/--max-entries largest
#                           directories/files found; default: "10k"
#   -M, --no-max-entries    Show all directories/files, ignore -m/--max-entries
#   -n, --sort-by-name      Sort output entries by name (default is by size)
#   -o, --out-path TEXT     Paths to write output to. Supported extensions:
#                           {jpg, png, svg, html}
#   -O, --no-open           Skip attempting to `open` any output files
#   -p, --profile TEXT      AWS_PROFILE to use
#   -s, --size-mode         Pass once for SI units, twice for raw sizes  [x>=0]
#   -t, --cache-ttl TEXT    TTL for cache entries; default: "1d"
#   -T, --tmp-html          Write an HTML representation to a temporary file and
#                           open in browser; pass twice to keep the temp file
#                           around after exit  [x>=0]
#   -x, --exclude TEXT      Exclude paths
#   --help                  Show this message and exit.

Examples

S3 bucket

Visualizing s3://ctbk:

disk-tree -os3/ctbk.html s3://ctbk
# 2333 files in 138 dirs, total size 45.1G
# Writing: _s3/ctbk.html
#       4B	test.txt
#    66.1K	favicon.ico
#     3.9M	index.html
#     5.5M	static
#    11.2M	.dvc
#    95.0M	tmp
#   579.1M	stations
#     1.2G	aggregated
#     6.0G	normalized
#    37.2G	csvs

Local directory

Visualize a clone of this repo, color by size:

disk-tree -odisk-tree.html -csize
# 97 files in 47 dirs, total size 1.5M
# Writing: disk-tree.html
#       0B	disk-tree/__init__.py
#      77B	disk-tree/requirements.txt
#     867B	disk-tree/setup.py
#     2.3K	disk-tree/README.md
#    23.8K	disk-tree/disk_tree
#   291.8K	disk-tree/screenshots
#   580.4K	disk-tree/.git
#   628.6K	disk-tree/www

(default color scale is "RdBu"; see Plotly options here, -csize=<scale> to configure)

Notes

Caching

disk-tree caches file stats in a SQLite database, defaulting to ~/.config/disk-tree/disk-tree.db and a 1d TTL (see -C/--cache-path and -t/--ttl, resp.).

Performance

disk-tree is reasonably performant on S3 buckets (it caches the result of aws s3 ls --recursive s3://…, and hydrates its cache from there), but "local mode" is slow, as it stats every file and directory in a given tree, in a single-threaded tree-traversal.

Max. entries

Plotly treemaps fall over with too many elements; -m/--max-entries (default 10k) determines the maximum number of nodes (files and directories) to attempt to render.

TUI-only mode

If you omit the -o<path>.html in the examples above, disk-tree will simply print the sizes of all children of the specified URL, and exit.

Metadata

Release files for disk-tree 0.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for disk-tree 0.0.2
File Size Uploaded
disk-tree-0.0.2.tar.gz 11.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for disk-tree 0.0.2
File Interpreter ABI Platform
disk_tree-0.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 24.4 kB

Release files / disk-tree-0.0.2.tar.gz

Download URL disk-tree-0.0.2.tar.gz
Size 11.8 kB
Tags Source
SHA-256 checksum
How to use checksums
b96b6ed148c35b17c711847bb086e9bdb7ecb6d7a6f2c2030dd6d96dd606f1a4
BLAKE2b-256 checksum
How to use checksums
1d56353b0dc7fb73c68937dfee560e8b00c35c2cb0139859ac05e3671e6c22e1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release files / disk_tree-0.0.2-py3-none-any.whl

Download URL disk_tree-0.0.2-py3-none-any.whl
Size 12.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cbe0e4cb4db96594306ebe0f5c19cb5bd15ae44d4e8996eb30f67478e59ab1eb
BLAKE2b-256 checksum
How to use checksums
7bdc62fdaf96a8c8a4f445c81ca76eb545cd752fe96bb0961e9f69e0e59ae415
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.11.4

Release history Release notifications | RSS feed

This release

0.0.2 This release

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page