dirplot 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- dirplot-0.1.0/.claude/settings.local.json +12 -0
- dirplot-0.1.0/.github/ISSUE_TEMPLATE/bug_report.md +28 -0
- dirplot-0.1.0/.github/ISSUE_TEMPLATE/feature_request.md +17 -0
- dirplot-0.1.0/.github/PULL_REQUEST_TEMPLATE.md +16 -0
- dirplot-0.1.0/.github/dependabot.yml +11 -0
- dirplot-0.1.0/.github/workflows/ci.yml +38 -0
- dirplot-0.1.0/.github/workflows/publish.yml +23 -0
- dirplot-0.1.0/.gitignore +40 -0
- dirplot-0.1.0/.pre-commit-config.yaml +17 -0
- dirplot-0.1.0/.python-version +1 -0
- dirplot-0.1.0/CHANGELOG.md +22 -0
- dirplot-0.1.0/CONTRIBUTING.md +35 -0
- dirplot-0.1.0/LICENSE +21 -0
- dirplot-0.1.0/Makefile +38 -0
- dirplot-0.1.0/PKG-INFO +155 -0
- dirplot-0.1.0/README.md +118 -0
- dirplot-0.1.0/SECURITY.md +14 -0
- dirplot-0.1.0/docs/dirplot.png +0 -0
- dirplot-0.1.0/pyproject.toml +107 -0
- dirplot-0.1.0/scripts/open_terminals.sh +71 -0
- dirplot-0.1.0/src/dirplot/__init__.py +3 -0
- dirplot-0.1.0/src/dirplot/__main__.py +11 -0
- dirplot-0.1.0/src/dirplot/colors.py +731 -0
- dirplot-0.1.0/src/dirplot/display.py +142 -0
- dirplot-0.1.0/src/dirplot/fonts/JetBrainsMono-Bold.ttf +0 -0
- dirplot-0.1.0/src/dirplot/fonts/JetBrainsMono-BoldItalic.ttf +0 -0
- dirplot-0.1.0/src/dirplot/fonts/JetBrainsMono-Italic.ttf +0 -0
- dirplot-0.1.0/src/dirplot/fonts/JetBrainsMono-Regular.ttf +0 -0
- dirplot-0.1.0/src/dirplot/fonts/OFL.txt +93 -0
- dirplot-0.1.0/src/dirplot/main.py +153 -0
- dirplot-0.1.0/src/dirplot/py.typed +0 -0
- dirplot-0.1.0/src/dirplot/render.py +350 -0
- dirplot-0.1.0/src/dirplot/scanner.py +76 -0
- dirplot-0.1.0/src/dirplot/terminal.py +28 -0
- dirplot-0.1.0/tests/__init__.py +0 -0
- dirplot-0.1.0/tests/conftest.py +30 -0
- dirplot-0.1.0/tests/example/bar/bar.py +1 -0
- dirplot-0.1.0/tests/example/bar/baz.json +1 -0
- dirplot-0.1.0/tests/example/foo/foo.md +1 -0
- dirplot-0.1.0/tests/test_cli.py +101 -0
- dirplot-0.1.0/tests/test_colors.py +52 -0
- dirplot-0.1.0/tests/test_display.py +144 -0
- dirplot-0.1.0/tests/test_drawing.py +139 -0
- dirplot-0.1.0/tests/test_render.py +91 -0
- dirplot-0.1.0/tests/test_scanner.py +130 -0
- dirplot-0.1.0/tests/test_terminal.py +54 -0
- dirplot-0.1.0/uv.lock +1415 -0
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Bug Report
|
|
3
|
+
about: Report a bug
|
|
4
|
+
labels: bug
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Description
|
|
8
|
+
|
|
9
|
+
A clear description of the bug.
|
|
10
|
+
|
|
11
|
+
## Steps to Reproduce
|
|
12
|
+
|
|
13
|
+
1. ...
|
|
14
|
+
2. ...
|
|
15
|
+
|
|
16
|
+
## Expected Behavior
|
|
17
|
+
|
|
18
|
+
What should happen.
|
|
19
|
+
|
|
20
|
+
## Actual Behavior
|
|
21
|
+
|
|
22
|
+
What actually happens.
|
|
23
|
+
|
|
24
|
+
## Environment
|
|
25
|
+
|
|
26
|
+
- Python version:
|
|
27
|
+
- dirplot version:
|
|
28
|
+
- OS:
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Feature Request
|
|
3
|
+
about: Suggest a feature
|
|
4
|
+
labels: enhancement
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Description
|
|
8
|
+
|
|
9
|
+
A clear description of the feature.
|
|
10
|
+
|
|
11
|
+
## Use Case
|
|
12
|
+
|
|
13
|
+
Why is this feature needed?
|
|
14
|
+
|
|
15
|
+
## Proposed Solution
|
|
16
|
+
|
|
17
|
+
How might this be implemented?
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
## Description
|
|
2
|
+
|
|
3
|
+
<!-- Brief description of changes. -->
|
|
4
|
+
|
|
5
|
+
## Type of Change
|
|
6
|
+
|
|
7
|
+
- [ ] Bug fix
|
|
8
|
+
- [ ] New feature
|
|
9
|
+
- [ ] Breaking change
|
|
10
|
+
- [ ] Documentation update
|
|
11
|
+
|
|
12
|
+
## Checklist
|
|
13
|
+
|
|
14
|
+
- [ ] Tests pass (`make test`)
|
|
15
|
+
- [ ] Linting passes (`make lint`)
|
|
16
|
+
- [ ] Documentation updated (if needed)
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
test:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
strategy:
|
|
13
|
+
matrix:
|
|
14
|
+
python-version: ["3.10", "3.11", "3.12", "3.13"]
|
|
15
|
+
|
|
16
|
+
steps:
|
|
17
|
+
- uses: actions/checkout@v4
|
|
18
|
+
|
|
19
|
+
- name: Install uv
|
|
20
|
+
uses: astral-sh/setup-uv@v5
|
|
21
|
+
|
|
22
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
23
|
+
run: uv python install ${{ matrix.python-version }}
|
|
24
|
+
|
|
25
|
+
- name: Install dependencies
|
|
26
|
+
run: uv sync --all-extras
|
|
27
|
+
|
|
28
|
+
- name: Format check
|
|
29
|
+
run: uv run ruff format --check src tests
|
|
30
|
+
|
|
31
|
+
- name: Lint
|
|
32
|
+
run: uv run ruff check src tests
|
|
33
|
+
|
|
34
|
+
- name: Type check
|
|
35
|
+
run: uv run mypy src
|
|
36
|
+
|
|
37
|
+
- name: Test
|
|
38
|
+
run: uv run pytest --cov=src --cov-report=xml
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
name: Publish
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
|
|
7
|
+
jobs:
|
|
8
|
+
publish:
|
|
9
|
+
runs-on: ubuntu-latest
|
|
10
|
+
|
|
11
|
+
steps:
|
|
12
|
+
- uses: actions/checkout@v4
|
|
13
|
+
|
|
14
|
+
- name: Install uv
|
|
15
|
+
uses: astral-sh/setup-uv@v4
|
|
16
|
+
|
|
17
|
+
- name: Build
|
|
18
|
+
run: uv build
|
|
19
|
+
|
|
20
|
+
- name: Publish to PyPI
|
|
21
|
+
env:
|
|
22
|
+
UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }}
|
|
23
|
+
run: uv publish
|
dirplot-0.1.0/.gitignore
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Python
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*.so
|
|
5
|
+
build/
|
|
6
|
+
dist/
|
|
7
|
+
*.egg-info/
|
|
8
|
+
.eggs/
|
|
9
|
+
|
|
10
|
+
# Virtual environments
|
|
11
|
+
.venv/
|
|
12
|
+
venv/
|
|
13
|
+
ENV/
|
|
14
|
+
|
|
15
|
+
# Tools
|
|
16
|
+
.mypy_cache/
|
|
17
|
+
.pytest_cache/
|
|
18
|
+
.ruff_cache/
|
|
19
|
+
.coverage
|
|
20
|
+
htmlcov/
|
|
21
|
+
coverage.xml
|
|
22
|
+
|
|
23
|
+
# IDE
|
|
24
|
+
.idea/
|
|
25
|
+
.vscode/
|
|
26
|
+
*.swp
|
|
27
|
+
*.swo
|
|
28
|
+
|
|
29
|
+
# Environment
|
|
30
|
+
.env
|
|
31
|
+
.env.local
|
|
32
|
+
|
|
33
|
+
# OS
|
|
34
|
+
.DS_Store
|
|
35
|
+
Thumbs.db
|
|
36
|
+
|
|
37
|
+
# Project-specific
|
|
38
|
+
NOTES.md
|
|
39
|
+
TASKS.md
|
|
40
|
+
tests/example_dirplot.png
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
repos:
|
|
2
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
3
|
+
rev: v5.0.0
|
|
4
|
+
hooks:
|
|
5
|
+
- id: trailing-whitespace
|
|
6
|
+
- id: end-of-file-fixer
|
|
7
|
+
- id: check-yaml
|
|
8
|
+
- id: check-toml
|
|
9
|
+
- id: check-added-large-files
|
|
10
|
+
- id: check-merge-conflict
|
|
11
|
+
|
|
12
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
13
|
+
rev: v0.9.0
|
|
14
|
+
hooks:
|
|
15
|
+
- id: ruff
|
|
16
|
+
args: [--fix]
|
|
17
|
+
- id: ruff-format
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
3.12
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
## [0.1.0] - 2026-03-06
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- Nested squarified treemap rendered as a PNG at the exact pixel dimensions of the terminal window.
|
|
16
|
+
- Inline terminal display via iTerm2 and Kitty graphics protocols, auto-detected at runtime; supports iTerm2, WezTerm, Warp, Hyper, Kitty, and Ghostty.
|
|
17
|
+
- System-viewer fallback (`open` / `xdg-open`) as the default display mode.
|
|
18
|
+
- File-extension colours from the GitHub Linguist palette (~500 known extensions); unknown extensions fall back to a stable MD5-derived colour from the chosen colormap.
|
|
19
|
+
- Van Wijk quadratic cushion shading giving each tile a raised 3-D look (`--cushion`, on by default).
|
|
20
|
+
- Bundled JetBrains Mono fonts for crisp directory labels at any size.
|
|
21
|
+
- CLI options: `--output`, `--show/--no-show`, `--inline`, `--legend`, `--font-size`, `--colormap`, `--exclude`, `--size`, `--header/--no-header`, `--cushion/--no-cushion`, `--log`.
|
|
22
|
+
- Full test suite (65 tests), strict mypy, ruff linting, pre-commit hooks, and CI on Python 3.10–3.13.
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# Contributing
|
|
2
|
+
|
|
3
|
+
## Development Setup
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
git clone https://github.com/deeplook/dirplot
|
|
7
|
+
cd dirplot
|
|
8
|
+
uv sync --all-extras
|
|
9
|
+
uv run pre-commit install
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Code Style
|
|
13
|
+
|
|
14
|
+
This project uses [ruff](https://docs.astral.sh/ruff/) for linting and formatting, and [mypy](https://mypy.readthedocs.io/) for type checking.
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
make format # auto-format and fix lint issues
|
|
18
|
+
make lint # check only (no changes)
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Testing
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
make test # run the test suite
|
|
25
|
+
make coverage # run with coverage report
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Target: 90 % line coverage.
|
|
29
|
+
|
|
30
|
+
## Submitting Changes
|
|
31
|
+
|
|
32
|
+
1. Fork the repository and create a feature branch (`feature/my-thing`).
|
|
33
|
+
2. Make your changes, add tests if needed.
|
|
34
|
+
3. Run `make lint` and `make test` — both must pass.
|
|
35
|
+
4. Open a pull request against `main`.
|
dirplot-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Dinu Gherman
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
dirplot-0.1.0/Makefile
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
.PHONY: install lint format test coverage clean install-tool check-all publish-test publish
|
|
2
|
+
|
|
3
|
+
install:
|
|
4
|
+
uv sync --all-extras
|
|
5
|
+
|
|
6
|
+
lint:
|
|
7
|
+
uv run ruff check src tests
|
|
8
|
+
uv run mypy src
|
|
9
|
+
|
|
10
|
+
format:
|
|
11
|
+
uv run ruff format src tests
|
|
12
|
+
uv run ruff check --fix src tests
|
|
13
|
+
|
|
14
|
+
test:
|
|
15
|
+
uv run --all-extras pytest
|
|
16
|
+
|
|
17
|
+
coverage:
|
|
18
|
+
uv run --all-extras pytest --cov=src --cov-report=html --cov-report=term
|
|
19
|
+
|
|
20
|
+
clean:
|
|
21
|
+
rm -rf dist build *.egg-info
|
|
22
|
+
rm -rf .pytest_cache .mypy_cache .ruff_cache
|
|
23
|
+
rm -rf htmlcov .coverage coverage.xml
|
|
24
|
+
find . -type d -name __pycache__ -exec rm -rf {} +
|
|
25
|
+
|
|
26
|
+
install-tool:
|
|
27
|
+
uv tool install --reinstall .
|
|
28
|
+
|
|
29
|
+
publish-test:
|
|
30
|
+
uv build
|
|
31
|
+
uv publish --index testpypi --token $(TEST_PYPI_TOKEN)
|
|
32
|
+
|
|
33
|
+
publish:
|
|
34
|
+
uv build
|
|
35
|
+
uv publish --token $(PYPI_TOKEN)
|
|
36
|
+
|
|
37
|
+
check-all: install format lint test clean
|
|
38
|
+
@echo "All checks passed!"
|
dirplot-0.1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: dirplot
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Static treemap bitmaps for directory trees, displayed as inline terminal images
|
|
5
|
+
Project-URL: Repository, https://github.com/deeplook/dirplot
|
|
6
|
+
License: MIT
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Classifier: Development Status :: 4 - Beta
|
|
9
|
+
Classifier: Environment :: Console
|
|
10
|
+
Classifier: Intended Audience :: Developers
|
|
11
|
+
Classifier: Intended Audience :: System Administrators
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
20
|
+
Classifier: Topic :: Scientific/Engineering :: Visualization
|
|
21
|
+
Classifier: Topic :: System :: Filesystems
|
|
22
|
+
Classifier: Topic :: Terminals
|
|
23
|
+
Classifier: Topic :: Utilities
|
|
24
|
+
Classifier: Typing :: Typed
|
|
25
|
+
Requires-Python: >=3.10
|
|
26
|
+
Requires-Dist: matplotlib>=3.7
|
|
27
|
+
Requires-Dist: pillow>=9.0
|
|
28
|
+
Requires-Dist: squarify>=0.4
|
|
29
|
+
Requires-Dist: typer>=0.9
|
|
30
|
+
Provides-Extra: dev
|
|
31
|
+
Requires-Dist: mypy>=1.10; extra == 'dev'
|
|
32
|
+
Requires-Dist: pre-commit>=3.0; extra == 'dev'
|
|
33
|
+
Requires-Dist: pytest-cov>=5.0; extra == 'dev'
|
|
34
|
+
Requires-Dist: pytest>=8.0; extra == 'dev'
|
|
35
|
+
Requires-Dist: ruff>=0.4; extra == 'dev'
|
|
36
|
+
Description-Content-Type: text/markdown
|
|
37
|
+
|
|
38
|
+
# dirplot
|
|
39
|
+
|
|
40
|
+
[](https://github.com/deeplook/dirplot/actions/workflows/ci.yml)
|
|
41
|
+
[](https://pypi.org/project/dirplot/)
|
|
42
|
+
[](https://pypi.org/project/dirplot/)
|
|
43
|
+
[](https://pepy.tech/project/dirplot)
|
|
44
|
+
[](https://pypi.org/project/dirplot/)
|
|
45
|
+
[](https://www.buymeacoffee.com/deeplook)
|
|
46
|
+
|
|
47
|
+
**dirplot** creates static nested treemap images for directory trees. It can display them in the system image viewer (default, works everywhere) or inline inside the terminal using the [iTerm2 inline image protocol](https://iterm2.com/documentation-images.html) or the [Kitty graphics protocol](https://sw.kovidgoyal.net/kitty/graphics-protocol/) — detected automatically at runtime.
|
|
48
|
+
|
|
49
|
+
Each rectangle represents a file; its **area** is proportional to the file size and its **colour** is determined by the file extension. Directories are shown as labelled, nested containers, mirroring the actual hierarchy.
|
|
50
|
+
|
|
51
|
+

|
|
52
|
+
|
|
53
|
+
## Installation
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
# As a standalone tool (recommended)
|
|
57
|
+
uv tool install dirplot
|
|
58
|
+
|
|
59
|
+
# Into the current environment
|
|
60
|
+
pip install dirplot
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### From GitHub
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
# As a standalone tool
|
|
67
|
+
uv tool install git+https://github.com/deeplook/dirplot
|
|
68
|
+
|
|
69
|
+
# Into the current environment
|
|
70
|
+
pip install git+https://github.com/deeplook/dirplot
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Usage
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
# Show dirplot for the current directory (opens image in system viewer)
|
|
77
|
+
dirplot .
|
|
78
|
+
|
|
79
|
+
# Save to a file without displaying
|
|
80
|
+
dirplot . --output dirplot.png --no-show
|
|
81
|
+
|
|
82
|
+
# Display inline (protocol auto-detected: iTerm2, Kitty, Ghostty)
|
|
83
|
+
dirplot . --inline
|
|
84
|
+
|
|
85
|
+
# Exclude directories
|
|
86
|
+
dirplot . --exclude .venv --exclude .git
|
|
87
|
+
|
|
88
|
+
# Use a different colormap and larger directory labels
|
|
89
|
+
dirplot . --colormap Set2 --font-size 18
|
|
90
|
+
|
|
91
|
+
# Render at a fixed resolution instead of terminal size
|
|
92
|
+
dirplot . --size 1920x1080 --output dirplot.png --no-show
|
|
93
|
+
|
|
94
|
+
# Don't apply cushion shading — makes tiles look flat
|
|
95
|
+
dirplot . --no-cushion
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
### Options
|
|
99
|
+
|
|
100
|
+
| Flag | Short | Default | Description |
|
|
101
|
+
|---|---|---|---|
|
|
102
|
+
| `--output` | `-o` | — | Save PNG to this path |
|
|
103
|
+
| `--show/--no-show` | | `--show` | Display the image after rendering |
|
|
104
|
+
| `--inline` | | off | Display in terminal (protocol auto-detected) |
|
|
105
|
+
| `--legend/--no-legend` | | `--no-legend` | Show file-extension colour legend |
|
|
106
|
+
| `--font-size` | `-s` | `12` | Directory label font size in pixels |
|
|
107
|
+
| `--colormap` | `-c` | `tab20` | Matplotlib colormap for unknown extensions |
|
|
108
|
+
| `--exclude` | `-e` | — | Path to exclude (repeatable) |
|
|
109
|
+
| `--size` | | terminal size | Output dimensions as `WIDTHxHEIGHT` (e.g. `1920x1080`) |
|
|
110
|
+
| `--header/--no-header` | | `--header` | Print info lines before rendering |
|
|
111
|
+
| `--cushion/--no-cushion` | | `--cushion` | Apply van Wijk cushion shading for a raised 3-D look |
|
|
112
|
+
|
|
113
|
+
## Inline Display
|
|
114
|
+
|
|
115
|
+
The `--inline` flag renders the image directly in the terminal. The protocol is auto-detected at runtime: terminals that support the [Kitty graphics protocol](https://sw.kovidgoyal.net/kitty/graphics-protocol/) use APC chunks (`ESC_G…`); all others fall back to the [iTerm2 inline image protocol](https://iterm2.com/documentation-images.html) (`ESC]1337;File=…`).
|
|
116
|
+
|
|
117
|
+
| Terminal | Platform | Protocol |
|
|
118
|
+
|---|---|---|
|
|
119
|
+
| [iTerm2](https://iterm2.com/) | macOS | iTerm2 |
|
|
120
|
+
| [WezTerm](https://wezfurlong.org/wezterm/) | macOS, Linux, Windows | iTerm2 |
|
|
121
|
+
| [Warp](https://www.warp.dev/) | macOS, Linux | iTerm2 |
|
|
122
|
+
| [Hyper](https://hyper.is/) | macOS, Linux, Windows | iTerm2 |
|
|
123
|
+
| [Kitty](https://sw.kovidgoyal.net/kitty/) | macOS, Linux | Kitty |
|
|
124
|
+
| [Ghostty](https://ghostty.org/) | macOS, Linux | Kitty |
|
|
125
|
+
|
|
126
|
+
The default mode (`--show`, no `--inline`) opens the PNG in the system viewer (`open` on macOS, `xdg-open` on Linux) and works in any terminal.
|
|
127
|
+
|
|
128
|
+
> **Note:** `--inline` does not work in AI coding assistants such as Claude Code, Cursor, or GitHub Copilot Chat. These tools intercept terminal output as plain text and do not implement any graphics protocol, so the escape sequences are either stripped or displayed as garbage. Use the default `--show` mode (system viewer) or `--output` to save the PNG to a file instead.
|
|
129
|
+
|
|
130
|
+
## How It Works
|
|
131
|
+
|
|
132
|
+
1. Scans the directory tree, collecting each file's path, extension, and size in bytes.
|
|
133
|
+
2. Computes a squarified dirplot layout recursively — directories allocate space for their children.
|
|
134
|
+
3. Renders to a PNG via Pillow (PIL) at the exact pixel dimensions of the current terminal window (detected via `TIOCGWINSZ`), or at a custom size when `--size` is given.
|
|
135
|
+
4. Displays via the system image viewer (`open` / `xdg-open`) or inline via an auto-detected terminal graphics protocol (iTerm2 or Kitty).
|
|
136
|
+
|
|
137
|
+
Extension colours come from the [GitHub Linguist](https://github.com/github/linguist) language colour table (~500 known extensions). Unknown extensions fall back to an MD5-stable colour derived from the chosen `--colormap`. File label text is automatically black or white depending on the background luminance.
|
|
138
|
+
|
|
139
|
+
## Development
|
|
140
|
+
|
|
141
|
+
```bash
|
|
142
|
+
git clone https://github.com/deeplook/dirplot
|
|
143
|
+
cd dirplot
|
|
144
|
+
make test
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for full details.
|
|
148
|
+
|
|
149
|
+
## Platform Support
|
|
150
|
+
|
|
151
|
+
This tool has been developed and tested on macOS. Linux should work, and Windows support is untested. Feedback and bug reports from Linux and Windows users are very welcome — please open an issue on GitHub.
|
|
152
|
+
|
|
153
|
+
## License
|
|
154
|
+
|
|
155
|
+
[MIT](LICENSE)
|
dirplot-0.1.0/README.md
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# dirplot
|
|
2
|
+
|
|
3
|
+
[](https://github.com/deeplook/dirplot/actions/workflows/ci.yml)
|
|
4
|
+
[](https://pypi.org/project/dirplot/)
|
|
5
|
+
[](https://pypi.org/project/dirplot/)
|
|
6
|
+
[](https://pepy.tech/project/dirplot)
|
|
7
|
+
[](https://pypi.org/project/dirplot/)
|
|
8
|
+
[](https://www.buymeacoffee.com/deeplook)
|
|
9
|
+
|
|
10
|
+
**dirplot** creates static nested treemap images for directory trees. It can display them in the system image viewer (default, works everywhere) or inline inside the terminal using the [iTerm2 inline image protocol](https://iterm2.com/documentation-images.html) or the [Kitty graphics protocol](https://sw.kovidgoyal.net/kitty/graphics-protocol/) — detected automatically at runtime.
|
|
11
|
+
|
|
12
|
+
Each rectangle represents a file; its **area** is proportional to the file size and its **colour** is determined by the file extension. Directories are shown as labelled, nested containers, mirroring the actual hierarchy.
|
|
13
|
+
|
|
14
|
+

|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
# As a standalone tool (recommended)
|
|
20
|
+
uv tool install dirplot
|
|
21
|
+
|
|
22
|
+
# Into the current environment
|
|
23
|
+
pip install dirplot
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### From GitHub
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
# As a standalone tool
|
|
30
|
+
uv tool install git+https://github.com/deeplook/dirplot
|
|
31
|
+
|
|
32
|
+
# Into the current environment
|
|
33
|
+
pip install git+https://github.com/deeplook/dirplot
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
## Usage
|
|
37
|
+
|
|
38
|
+
```bash
|
|
39
|
+
# Show dirplot for the current directory (opens image in system viewer)
|
|
40
|
+
dirplot .
|
|
41
|
+
|
|
42
|
+
# Save to a file without displaying
|
|
43
|
+
dirplot . --output dirplot.png --no-show
|
|
44
|
+
|
|
45
|
+
# Display inline (protocol auto-detected: iTerm2, Kitty, Ghostty)
|
|
46
|
+
dirplot . --inline
|
|
47
|
+
|
|
48
|
+
# Exclude directories
|
|
49
|
+
dirplot . --exclude .venv --exclude .git
|
|
50
|
+
|
|
51
|
+
# Use a different colormap and larger directory labels
|
|
52
|
+
dirplot . --colormap Set2 --font-size 18
|
|
53
|
+
|
|
54
|
+
# Render at a fixed resolution instead of terminal size
|
|
55
|
+
dirplot . --size 1920x1080 --output dirplot.png --no-show
|
|
56
|
+
|
|
57
|
+
# Don't apply cushion shading — makes tiles look flat
|
|
58
|
+
dirplot . --no-cushion
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Options
|
|
62
|
+
|
|
63
|
+
| Flag | Short | Default | Description |
|
|
64
|
+
|---|---|---|---|
|
|
65
|
+
| `--output` | `-o` | — | Save PNG to this path |
|
|
66
|
+
| `--show/--no-show` | | `--show` | Display the image after rendering |
|
|
67
|
+
| `--inline` | | off | Display in terminal (protocol auto-detected) |
|
|
68
|
+
| `--legend/--no-legend` | | `--no-legend` | Show file-extension colour legend |
|
|
69
|
+
| `--font-size` | `-s` | `12` | Directory label font size in pixels |
|
|
70
|
+
| `--colormap` | `-c` | `tab20` | Matplotlib colormap for unknown extensions |
|
|
71
|
+
| `--exclude` | `-e` | — | Path to exclude (repeatable) |
|
|
72
|
+
| `--size` | | terminal size | Output dimensions as `WIDTHxHEIGHT` (e.g. `1920x1080`) |
|
|
73
|
+
| `--header/--no-header` | | `--header` | Print info lines before rendering |
|
|
74
|
+
| `--cushion/--no-cushion` | | `--cushion` | Apply van Wijk cushion shading for a raised 3-D look |
|
|
75
|
+
|
|
76
|
+
## Inline Display
|
|
77
|
+
|
|
78
|
+
The `--inline` flag renders the image directly in the terminal. The protocol is auto-detected at runtime: terminals that support the [Kitty graphics protocol](https://sw.kovidgoyal.net/kitty/graphics-protocol/) use APC chunks (`ESC_G…`); all others fall back to the [iTerm2 inline image protocol](https://iterm2.com/documentation-images.html) (`ESC]1337;File=…`).
|
|
79
|
+
|
|
80
|
+
| Terminal | Platform | Protocol |
|
|
81
|
+
|---|---|---|
|
|
82
|
+
| [iTerm2](https://iterm2.com/) | macOS | iTerm2 |
|
|
83
|
+
| [WezTerm](https://wezfurlong.org/wezterm/) | macOS, Linux, Windows | iTerm2 |
|
|
84
|
+
| [Warp](https://www.warp.dev/) | macOS, Linux | iTerm2 |
|
|
85
|
+
| [Hyper](https://hyper.is/) | macOS, Linux, Windows | iTerm2 |
|
|
86
|
+
| [Kitty](https://sw.kovidgoyal.net/kitty/) | macOS, Linux | Kitty |
|
|
87
|
+
| [Ghostty](https://ghostty.org/) | macOS, Linux | Kitty |
|
|
88
|
+
|
|
89
|
+
The default mode (`--show`, no `--inline`) opens the PNG in the system viewer (`open` on macOS, `xdg-open` on Linux) and works in any terminal.
|
|
90
|
+
|
|
91
|
+
> **Note:** `--inline` does not work in AI coding assistants such as Claude Code, Cursor, or GitHub Copilot Chat. These tools intercept terminal output as plain text and do not implement any graphics protocol, so the escape sequences are either stripped or displayed as garbage. Use the default `--show` mode (system viewer) or `--output` to save the PNG to a file instead.
|
|
92
|
+
|
|
93
|
+
## How It Works
|
|
94
|
+
|
|
95
|
+
1. Scans the directory tree, collecting each file's path, extension, and size in bytes.
|
|
96
|
+
2. Computes a squarified dirplot layout recursively — directories allocate space for their children.
|
|
97
|
+
3. Renders to a PNG via Pillow (PIL) at the exact pixel dimensions of the current terminal window (detected via `TIOCGWINSZ`), or at a custom size when `--size` is given.
|
|
98
|
+
4. Displays via the system image viewer (`open` / `xdg-open`) or inline via an auto-detected terminal graphics protocol (iTerm2 or Kitty).
|
|
99
|
+
|
|
100
|
+
Extension colours come from the [GitHub Linguist](https://github.com/github/linguist) language colour table (~500 known extensions). Unknown extensions fall back to an MD5-stable colour derived from the chosen `--colormap`. File label text is automatically black or white depending on the background luminance.
|
|
101
|
+
|
|
102
|
+
## Development
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
git clone https://github.com/deeplook/dirplot
|
|
106
|
+
cd dirplot
|
|
107
|
+
make test
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for full details.
|
|
111
|
+
|
|
112
|
+
## Platform Support
|
|
113
|
+
|
|
114
|
+
This tool has been developed and tested on macOS. Linux should work, and Windows support is untested. Feedback and bug reports from Linux and Windows users are very welcome — please open an issue on GitHub.
|
|
115
|
+
|
|
116
|
+
## License
|
|
117
|
+
|
|
118
|
+
[MIT](LICENSE)
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# Security Policy
|
|
2
|
+
|
|
3
|
+
## Supported Versions
|
|
4
|
+
|
|
5
|
+
| Version | Supported |
|
|
6
|
+
|---------|--------------------|
|
|
7
|
+
| 0.1.x | :white_check_mark: |
|
|
8
|
+
|
|
9
|
+
## Reporting a Vulnerability
|
|
10
|
+
|
|
11
|
+
Please do **not** create a public GitHub issue for security vulnerabilities.
|
|
12
|
+
|
|
13
|
+
Instead, open a [GitHub Security Advisory](https://github.com/deeplook/dirplot/security/advisories/new)
|
|
14
|
+
or email the maintainer directly.
|
|
Binary file
|