dirplot 0.2.0__tar.gz → 0.3.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.
Files changed (102) hide show
  1. {dirplot-0.2.0 → dirplot-0.3.0}/.claude/settings.local.json +2 -1
  2. dirplot-0.3.0/.dockerignore +11 -0
  3. dirplot-0.3.0/CHANGELOG.md +120 -0
  4. dirplot-0.3.0/Dockerfile +21 -0
  5. {dirplot-0.2.0 → dirplot-0.3.0}/PKG-INFO +100 -22
  6. {dirplot-0.2.0 → dirplot-0.3.0}/README.md +90 -20
  7. dirplot-0.3.0/docs/ARCHIVES.md +117 -0
  8. dirplot-0.3.0/docs/EXAMPLES.md +385 -0
  9. dirplot-0.3.0/docs/SSH_DESIGN.md +395 -0
  10. dirplot-0.3.0/docs/docker.png +0 -0
  11. dirplot-0.3.0/docs/fastapi.png +0 -0
  12. dirplot-0.3.0/docs/flask.png +0 -0
  13. dirplot-0.3.0/docs/k8s.png +0 -0
  14. dirplot-0.3.0/docs/pypy.png +0 -0
  15. dirplot-0.3.0/docs/python.png +0 -0
  16. dirplot-0.3.0/docs/s3.png +0 -0
  17. {dirplot-0.2.0 → dirplot-0.3.0}/pyproject.toml +13 -3
  18. dirplot-0.3.0/scripts/make_docs_images.sh +16 -0
  19. dirplot-0.3.0/scripts/make_fixtures.py +144 -0
  20. {dirplot-0.2.0 → dirplot-0.3.0}/src/dirplot/__init__.py +9 -1
  21. dirplot-0.3.0/src/dirplot/archives.py +225 -0
  22. dirplot-0.3.0/src/dirplot/docker.py +252 -0
  23. dirplot-0.3.0/src/dirplot/github.py +192 -0
  24. dirplot-0.3.0/src/dirplot/k8s.py +272 -0
  25. dirplot-0.3.0/src/dirplot/main.py +344 -0
  26. {dirplot-0.2.0 → dirplot-0.3.0}/src/dirplot/render.py +4 -0
  27. dirplot-0.3.0/src/dirplot/s3.py +167 -0
  28. {dirplot-0.2.0 → dirplot-0.3.0}/src/dirplot/scanner.py +19 -3
  29. dirplot-0.3.0/src/dirplot/ssh.py +228 -0
  30. dirplot-0.3.0/src/dirplot/svg_render.py +561 -0
  31. dirplot-0.3.0/src/dirplot/terminal.py +42 -0
  32. dirplot-0.3.0/src.svg +370 -0
  33. dirplot-0.3.0/tests/conftest.py +132 -0
  34. dirplot-0.3.0/tests/fixtures/sample.7z +0 -0
  35. dirplot-0.3.0/tests/fixtures/sample.apk +0 -0
  36. dirplot-0.3.0/tests/fixtures/sample.ear +0 -0
  37. dirplot-0.3.0/tests/fixtures/sample.epub +0 -0
  38. dirplot-0.3.0/tests/fixtures/sample.jar +0 -0
  39. dirplot-0.3.0/tests/fixtures/sample.rar +0 -0
  40. dirplot-0.3.0/tests/fixtures/sample.tar +0 -0
  41. dirplot-0.3.0/tests/fixtures/sample.tar.bz2 +0 -0
  42. dirplot-0.3.0/tests/fixtures/sample.tar.gz +0 -0
  43. dirplot-0.3.0/tests/fixtures/sample.tar.xz +0 -0
  44. dirplot-0.3.0/tests/fixtures/sample.tbz2 +0 -0
  45. dirplot-0.3.0/tests/fixtures/sample.tgz +0 -0
  46. dirplot-0.3.0/tests/fixtures/sample.txz +0 -0
  47. dirplot-0.3.0/tests/fixtures/sample.war +0 -0
  48. dirplot-0.3.0/tests/fixtures/sample.whl +0 -0
  49. dirplot-0.3.0/tests/fixtures/sample.xpi +0 -0
  50. dirplot-0.3.0/tests/fixtures/sample.zip +0 -0
  51. dirplot-0.3.0/tests/test_archives.py +371 -0
  52. {dirplot-0.2.0 → dirplot-0.3.0}/tests/test_cli.py +20 -12
  53. dirplot-0.3.0/tests/test_docker.py +386 -0
  54. {dirplot-0.2.0 → dirplot-0.3.0}/tests/test_drawing.py +8 -5
  55. dirplot-0.3.0/tests/test_github.py +193 -0
  56. dirplot-0.3.0/tests/test_k8s.py +447 -0
  57. dirplot-0.3.0/tests/test_s3.py +186 -0
  58. {dirplot-0.2.0 → dirplot-0.3.0}/tests/test_scanner.py +10 -0
  59. dirplot-0.3.0/tests/test_ssh.py +319 -0
  60. dirplot-0.3.0/tests/test_svg_render.py +402 -0
  61. {dirplot-0.2.0 → dirplot-0.3.0}/uv.lock +865 -5
  62. dirplot-0.2.0/CHANGELOG.md +0 -45
  63. dirplot-0.2.0/Untitled.ipynb +0 -90
  64. dirplot-0.2.0/map.svg +0 -213
  65. dirplot-0.2.0/src/dirplot/main.py +0 -153
  66. dirplot-0.2.0/src/dirplot/terminal.py +0 -29
  67. dirplot-0.2.0/tests/conftest.py +0 -30
  68. dirplot-0.2.0/treemap.png +0 -0
  69. {dirplot-0.2.0 → dirplot-0.3.0}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  70. {dirplot-0.2.0 → dirplot-0.3.0}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
  71. {dirplot-0.2.0 → dirplot-0.3.0}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
  72. {dirplot-0.2.0 → dirplot-0.3.0}/.github/dependabot.yml +0 -0
  73. {dirplot-0.2.0 → dirplot-0.3.0}/.github/workflows/ci.yml +0 -0
  74. {dirplot-0.2.0 → dirplot-0.3.0}/.github/workflows/publish.yml +0 -0
  75. {dirplot-0.2.0 → dirplot-0.3.0}/.gitignore +0 -0
  76. {dirplot-0.2.0 → dirplot-0.3.0}/.ipynb_checkpoints/Untitled-checkpoint.ipynb +0 -0
  77. {dirplot-0.2.0 → dirplot-0.3.0}/.pre-commit-config.yaml +0 -0
  78. {dirplot-0.2.0 → dirplot-0.3.0}/.python-version +0 -0
  79. {dirplot-0.2.0 → dirplot-0.3.0}/CONTRIBUTING.md +0 -0
  80. {dirplot-0.2.0 → dirplot-0.3.0}/LICENSE +0 -0
  81. {dirplot-0.2.0 → dirplot-0.3.0}/Makefile +0 -0
  82. {dirplot-0.2.0 → dirplot-0.3.0}/SECURITY.md +0 -0
  83. {dirplot-0.2.0 → dirplot-0.3.0}/TASKS.md~ +0 -0
  84. {dirplot-0.2.0 → dirplot-0.3.0}/docs/dirplot.png +0 -0
  85. {dirplot-0.2.0 → dirplot-0.3.0}/scripts/open_terminals.sh +0 -0
  86. {dirplot-0.2.0 → dirplot-0.3.0}/src/dirplot/__main__.py +0 -0
  87. {dirplot-0.2.0 → dirplot-0.3.0}/src/dirplot/colors.py +0 -0
  88. {dirplot-0.2.0 → dirplot-0.3.0}/src/dirplot/display.py +0 -0
  89. {dirplot-0.2.0 → dirplot-0.3.0}/src/dirplot/fonts/JetBrainsMono-Bold.ttf +0 -0
  90. {dirplot-0.2.0 → dirplot-0.3.0}/src/dirplot/fonts/JetBrainsMono-BoldItalic.ttf +0 -0
  91. {dirplot-0.2.0 → dirplot-0.3.0}/src/dirplot/fonts/JetBrainsMono-Italic.ttf +0 -0
  92. {dirplot-0.2.0 → dirplot-0.3.0}/src/dirplot/fonts/JetBrainsMono-Regular.ttf +0 -0
  93. {dirplot-0.2.0 → dirplot-0.3.0}/src/dirplot/fonts/OFL.txt +0 -0
  94. {dirplot-0.2.0 → dirplot-0.3.0}/src/dirplot/py.typed +0 -0
  95. {dirplot-0.2.0 → dirplot-0.3.0}/tests/__init__.py +0 -0
  96. {dirplot-0.2.0 → dirplot-0.3.0}/tests/example/bar/bar.py +0 -0
  97. {dirplot-0.2.0 → dirplot-0.3.0}/tests/example/bar/baz.json +0 -0
  98. {dirplot-0.2.0 → dirplot-0.3.0}/tests/example/foo/foo.md +0 -0
  99. {dirplot-0.2.0 → dirplot-0.3.0}/tests/test_colors.py +0 -0
  100. {dirplot-0.2.0 → dirplot-0.3.0}/tests/test_display.py +0 -0
  101. {dirplot-0.2.0 → dirplot-0.3.0}/tests/test_render.py +0 -0
  102. {dirplot-0.2.0 → dirplot-0.3.0}/tests/test_terminal.py +0 -0
@@ -6,7 +6,8 @@
6
6
  "Bash(uv pip:*)",
7
7
  "Bash(git mv:*)",
8
8
  "Bash(LC_ALL=C sed:*)",
9
- "Bash(find:*)"
9
+ "Bash(find:*)",
10
+ "Bash(docker run:*)"
10
11
  ]
11
12
  }
12
13
  }
@@ -0,0 +1,11 @@
1
+ .venv/
2
+ .git/
3
+ .pytest_cache/
4
+ __pycache__/
5
+ *.pyc
6
+ *.egg-info/
7
+ dist/
8
+ .mypy_cache/
9
+ .ruff_cache/
10
+ *.png
11
+ *.svg
@@ -0,0 +1,120 @@
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
+ ## [0.3.0] - 2026-03-10
11
+
12
+ ### Added
13
+
14
+ - Kubernetes pod scanning via `pod://pod-name/path` syntax — uses `kubectl exec` and
15
+ `find` to build the tree without copying files out of the pod. Works on any running
16
+ pod that has a POSIX shell and `find` (GNU or BusyBox). No extra dependency; only
17
+ `kubectl` is required.
18
+ - Namespace can be specified inline (`pod://pod-name@namespace:/path`) or via
19
+ `--k8s-namespace`.
20
+ - Container can be selected for multi-container pods via `--k8s-container`.
21
+ - `-xdev` is intentionally omitted so mounted volumes (emptyDir, PVC, etc.) within
22
+ the scanned path are traversed — the common case in k8s where images declare
23
+ `VOLUME` entries that are always mounted on a separate filesystem.
24
+ - Automatically falls back to a portable `sh` + `stat` loop on BusyBox/Alpine pods.
25
+ - `github://owner/repo[@branch]` URI scheme for GitHub repository scanning. The old
26
+ `github:owner/repo` shorthand has been removed.
27
+ - File tiles now have a 1-px dark outline (60/255 below fill colour per channel) so
28
+ adjacent same-coloured tiles — e.g. a directory full of extension-less files — are
29
+ always visually distinct rather than blending into a single flat block.
30
+
31
+ ### Changed
32
+
33
+ - `docs/REMOTE-ACCESS.md` renamed to `docs/EXAMPLES.md`; Docker and Kubernetes pod
34
+ sections added; images with captions added for all remote backends.
35
+
36
+ ### Fixed
37
+
38
+ - SVG tooltips now show the original byte count when `--log` is active, not the
39
+ log-transformed layout value. `Node.original_size` is populated by `apply_log_sizes`
40
+ for both file and directory nodes and is used by the SVG renderer for `data-size`.
41
+ - GitHub error messages are now clear and actionable:
42
+ - 401 explicitly says the token is invalid or expired.
43
+ - 403 distinguishes rate-limit exceeded (with the 60 vs 5,000 req/h figures and a
44
+ token hint) from a permissions failure on a private repository.
45
+ - 404 now also hints that a token is required for private repositories (GitHub returns
46
+ 404, not 403, for private repos accessed without authentication).
47
+ - Errors are caught in the CLI and printed as a single `Error: …` line to stderr
48
+ instead of showing a Python traceback.
49
+
50
+ ### Added
51
+
52
+ - Docker container scanning via `docker://container:/path` syntax — uses `docker exec`
53
+ and `find` to build the tree without copying files out of the container. Works on any
54
+ running container that has a POSIX shell and `find` (GNU or BusyBox). No extra
55
+ dependency; only the `docker` CLI is required.
56
+ - Automatically detects BusyBox `find` (Alpine-based images) and falls back to a
57
+ portable `sh` + `stat` loop when GNU `-printf` is unavailable.
58
+ - Virtual filesystems (`/proc`, `/sys`, `/dev`) are skipped via `-xdev`.
59
+ - Supports `--exclude`, `--depth`, `--log`, and all other standard options.
60
+ - `Dockerfile` and `.dockerignore` added so the project itself can be used as a
61
+ scan target.
62
+ - SVG output format via `--format svg` or by saving to a `.svg`-suffixed path with `--output`.
63
+ The output is a fully self-contained, interactive SVG file:
64
+ - **CSS hover highlight** — file tiles brighten and gain a soft glow; directory headers
65
+ brighten on mouse-over (`.tile` / `.dir-tile` classes, no JavaScript needed).
66
+ - **Floating tooltip panel** — a JavaScript-driven semi-transparent panel tracks the cursor
67
+ and shows the file or directory name, human-readable size, and file-type / item count.
68
+ No external scripts or stylesheets — the panel logic is embedded in the SVG itself.
69
+ - **Van Wijk cushion shading** — approximated via a single diagonal `linearGradient`
70
+ overlay (`gradientUnits="objectBoundingBox"`), defined once and shared across all tiles.
71
+ Matches the ×1.20 highlight / ×0.80 shadow range of the PNG renderer.
72
+ Disabled with `--no-cushion`.
73
+ - `--format png|svg` CLI option; format is also auto-detected from the `--output` file extension.
74
+ - `create_treemap_svg()` added to the public Python API (`from dirplot import create_treemap_svg`).
75
+ - `drawsvg>=2.4` added as a core dependency.
76
+ - Rename the treemap command to `map` (dirplot map <root>).
77
+ - Add `termsize` subcommand and restructure CLI as multi-command app.
78
+ - Add `--depht` parameter to limit the scanning of large file trees.
79
+ - Support for SSH remote directory scanning (`pip install dirplot[ssh]`).
80
+ - Support for AWS S3 buckets in the cloud (`pip install dirplot[s3]`).
81
+ - Support for local archive files, .zip, tgz, .tar.xz, .rar, .7z, etc.
82
+ - Include example archives for 17 different extentions for testing.
83
+ - Comprehensive documentation.
84
+
85
+ ## [0.2.0] - 2026-03-09
86
+
87
+ ### Added
88
+
89
+ - Support for Windows, incl. full test suite
90
+
91
+ ### Fixed
92
+
93
+ - Improved README, Makefile
94
+
95
+ ## [0.1.2] - 2026-03-06
96
+
97
+ ### Fixed
98
+
99
+ - Partly incorrect `uvx install dirplot` command
100
+ - Wrong version number in `uv.lock`
101
+
102
+ ## [0.1.1] - 2026-03-06
103
+
104
+ ### Fixed
105
+
106
+ - Typing complaints
107
+ - Improved README with better install/run commands
108
+
109
+ ## [0.1.0] - 2026-03-06
110
+
111
+ ### Added
112
+
113
+ - Nested squarified treemap rendered as a PNG at the exact pixel dimensions of the terminal window.
114
+ - Inline terminal display via iTerm2 and Kitty graphics protocols, auto-detected at runtime; supports iTerm2, WezTerm, Warp, Hyper, Kitty, and Ghostty.
115
+ - System-viewer fallback (`open` / `xdg-open`) as the default display mode.
116
+ - 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.
117
+ - Van Wijk quadratic cushion shading giving each tile a raised 3-D look (`--cushion`, on by default).
118
+ - Bundled JetBrains Mono fonts for crisp directory labels at any size.
119
+ - CLI options: `--output`, `--show/--no-show`, `--inline`, `--legend`, `--font-size`, `--colormap`, `--exclude`, `--size`, `--header/--no-header`, `--cushion/--no-cushion`, `--log`.
120
+ - Full test suite (65 tests), strict mypy, ruff linting, pre-commit hooks, and CI on Python 3.10–3.13.
@@ -0,0 +1,21 @@
1
+ FROM python:3.12-slim
2
+
3
+ WORKDIR /app
4
+
5
+ # Install build tools needed by some optional deps
6
+ RUN pip install --no-cache-dir uv
7
+
8
+ # Copy project metadata first for layer caching
9
+ COPY pyproject.toml README.md ./
10
+
11
+ # Copy source
12
+ COPY src/ src/
13
+
14
+ # Install dirplot with all extras
15
+ RUN uv pip install --system --no-cache ".[ssh,s3,docker,dev]"
16
+
17
+ # Copy the rest (tests, docs, etc.) so the container is a useful scan target
18
+ COPY . .
19
+
20
+ # Keep the container running so docker:// scanning works
21
+ CMD ["sleep", "infinity"]
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: dirplot
3
- Version: 0.2.0
4
- Summary: Static treemap bitmaps for directory trees, displayed as inline terminal images
3
+ Version: 0.3.0
4
+ Summary: Static treemap bitmaps for directory trees and archives, displayed as inline terminal images
5
5
  Project-URL: Repository, https://github.com/deeplook/dirplot
6
6
  License: MIT
7
7
  License-File: LICENSE
@@ -19,13 +19,17 @@ Classifier: Programming Language :: Python :: 3.12
19
19
  Classifier: Programming Language :: Python :: 3.13
20
20
  Classifier: Programming Language :: Python :: 3.14
21
21
  Classifier: Topic :: Scientific/Engineering :: Visualization
22
+ Classifier: Topic :: System :: Archiving
22
23
  Classifier: Topic :: System :: Filesystems
23
24
  Classifier: Topic :: Terminals
24
25
  Classifier: Topic :: Utilities
25
26
  Classifier: Typing :: Typed
26
27
  Requires-Python: >=3.10
28
+ Requires-Dist: drawsvg>=2.4.1
27
29
  Requires-Dist: matplotlib>=3.7
28
30
  Requires-Dist: pillow>=9.0
31
+ Requires-Dist: py7zr>=0.20
32
+ Requires-Dist: rarfile>=4.0
29
33
  Requires-Dist: squarify>=0.4
30
34
  Requires-Dist: typer>=0.9
31
35
  Provides-Extra: dev
@@ -34,6 +38,10 @@ Requires-Dist: pre-commit>=3.0; extra == 'dev'
34
38
  Requires-Dist: pytest-cov>=5.0; extra == 'dev'
35
39
  Requires-Dist: pytest>=8.0; extra == 'dev'
36
40
  Requires-Dist: ruff>=0.4; extra == 'dev'
41
+ Provides-Extra: s3
42
+ Requires-Dist: boto3>=1.26; extra == 's3'
43
+ Provides-Extra: ssh
44
+ Requires-Dist: paramiko>=3.0; extra == 'ssh'
37
45
  Description-Content-Type: text/markdown
38
46
 
39
47
  # dirplot
@@ -58,10 +66,12 @@ Description-Content-Type: text/markdown
58
66
  - Label colour (black/white) chosen automatically based on background luminance.
59
67
  - Output resolution matches the current terminal window pixel size (via `TIOCGWINSZ`), or a custom `WIDTHxHEIGHT`.
60
68
  - Van Wijk cushion shading gives tiles a raised 3-D appearance (optional).
69
+ - **SVG output** (`--format svg` or `--output file.svg`) produces a fully self-contained interactive file: CSS hover highlight, a JavaScript floating tooltip panel, and cushion shading via a gradient — no external dependencies.
61
70
  - Display via system image viewer or inline in the terminal (iTerm2 and Kitty protocols, auto-detected).
62
- - Save output to a PNG file with `--output`.
71
+ - Save output to a PNG or SVG file with `--output`.
63
72
  - Exclude paths with `--exclude` (repeatable).
64
73
  - Works on macOS, Linux, and Windows; WSL2 fully supported.
74
+ - Scan remote hosts over SSH (`pip install "dirplot[ssh]"`), AWS S3 buckets (`pip install "dirplot[s3]"`), any public/private GitHub repository, **running Docker containers**, or **Kubernetes pods** — all without extra dependencies beyond the respective CLI/SDK. See [EXAMPLES.md](docs/EXAMPLES.md).
65
75
 
66
76
  ## How It Works
67
77
 
@@ -105,34 +115,44 @@ This tool has been developed and tested on macOS and is CI-tested on Linux and W
105
115
  uvx dirplot --help
106
116
 
107
117
  # Show dirplot for the current directory (opens image in system viewer)
108
- dirplot .
118
+ dirplot map .
119
+
120
+ # Show current terminal size in characters and pixels
121
+ dirplot termsize
109
122
 
110
123
  # Save to a file without displaying
111
- dirplot . --output dirplot.png --no-show
124
+ dirplot map . --output dirplot.png --no-show
112
125
 
113
126
  # Display inline (protocol auto-detected: iTerm2, Kitty, Ghostty)
114
- dirplot . --inline
127
+ dirplot map . --inline
115
128
 
116
129
  # Exclude directories
117
- dirplot . --exclude .venv --exclude .git
130
+ dirplot map . --exclude .venv --exclude .git
118
131
 
119
132
  # Use a different colormap and larger directory labels
120
- dirplot . --colormap Set2 --font-size 18
133
+ dirplot map . --colormap Set2 --font-size 18
121
134
 
122
135
  # Render at a fixed resolution instead of terminal size
123
- dirplot . --size 1920x1080 --output dirplot.png --no-show
136
+ dirplot map . --size 1920x1080 --output dirplot.png --no-show
124
137
 
125
138
  # Don't apply cushion shading — makes tiles look flat
126
- dirplot . --no-cushion
139
+ dirplot map . --no-cushion
140
+
141
+ # Save as an interactive SVG (hover highlight + floating tooltip)
142
+ dirplot map . --output treemap.svg --no-show
143
+
144
+ # Force SVG format explicitly
145
+ dirplot map . --format svg --output treemap.svg --no-show
127
146
  ```
128
147
 
129
148
  ### Options
130
149
 
131
150
  | Flag | Short | Default | Description |
132
151
  |---|---|---|---|
133
- | `--output` | `-o` | — | Save PNG to this path |
152
+ | `--output` | `-o` | — | Save to this path (PNG or SVG) |
153
+ | `--format` | `-f` | auto | Output format: `png` or `svg`. Auto-detected from `--output` extension |
134
154
  | `--show/--no-show` | | `--show` | Display the image after rendering |
135
- | `--inline` | | off | Display in terminal (protocol auto-detected) |
155
+ | `--inline` | | off | Display in terminal (protocol auto-detected; PNG only) |
136
156
  | `--legend/--no-legend` | | `--no-legend` | Show file-extension colour legend |
137
157
  | `--font-size` | `-s` | `12` | Directory label font size in pixels |
138
158
  | `--colormap` | `-c` | `tab20` | Matplotlib colormap for unknown extensions |
@@ -141,6 +161,7 @@ dirplot . --no-cushion
141
161
  | `--header/--no-header` | | `--header` | Print info lines before rendering |
142
162
  | `--cushion/--no-cushion` | | `--cushion` | Apply van Wijk cushion shading for a raised 3-D look |
143
163
  | `--log/--no-log` | | `--no-log` | Use log of file sizes for layout, making small files more visible |
164
+ | `--github-token` | | `$GITHUB_TOKEN` | GitHub personal access token for private repos or higher rate limits |
144
165
 
145
166
  ## Inline Display
146
167
 
@@ -159,30 +180,79 @@ The default mode (`--show`, no `--inline`) opens the PNG in the system viewer (`
159
180
 
160
181
  > **Windows note:** Common Windows shells (PowerShell, cmd, Git Bash) and terminal emulators (Windows Terminal, ConEmu) do not support any inline image protocol. `--inline` will silently produce no output in these environments. [WezTerm](https://wezfurlong.org/wezterm/) is currently the only mainstream Windows terminal emulator that supports inline image rendering (via the Kitty graphics protocol). WSL2 is treated as Linux and has full support.
161
182
 
183
+ > **Tip:** In terminals that support inline images (iTerm2, WezTerm, Kitty, etc.), the rendered image can often be dragged directly out of the terminal window and dropped into another application or saved to the desktop — no `--output` needed. This drag-and-drop behaviour is not guaranteed across all terminals.
184
+
162
185
  > **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. Or use [Pi](https://pi.dev) where it is easily added as an extension.
163
186
 
187
+ ## Archives
188
+
189
+ dirplot can read local archive files (zip, tar, 7z, rar, and ZIP-based formats like jar, whl, apk) as treemap inputs without unpacking them. See [ARCHIVES.md](docs/ARCHIVES.md) for supported formats, dependencies, and RAR setup on macOS.
190
+
191
+ ```bash
192
+ dirplot map project.zip
193
+ dirplot map release.tar.gz --depth 2
194
+ dirplot map app.jar
195
+ ```
196
+
197
+ ## Remote Access
198
+
199
+ dirplot can scan SSH hosts, AWS S3 buckets, GitHub repositories, running Docker containers, and Kubernetes pods. See [EXAMPLES.md](docs/EXAMPLES.md) for full details.
200
+
201
+ ```bash
202
+ pip install "dirplot[ssh]" # SSH via paramiko
203
+ pip install "dirplot[s3]" # AWS S3 via boto3
204
+ # GitHub: no extra dependency needed
205
+ # Docker: only the docker CLI required
206
+ # Kubernetes: only kubectl required
207
+ ```
208
+
209
+ ```bash
210
+ dirplot map ssh://alice@prod.example.com/var/www
211
+ dirplot map s3://noaa-ghcn-pds --no-sign
212
+ dirplot map github://pallets/flask
213
+ dirplot map docker://my-container:/app
214
+ dirplot map pod://my-pod:/app
215
+ dirplot map pod://my-pod@staging:/app
216
+ ```
217
+
218
+ ### GitHub authentication
219
+
220
+ Public repositories work without a token but are subject to GitHub's unauthenticated rate limit of **60 requests/hour**. A personal access token raises this to **5,000 requests/hour** and is required for private repositories.
221
+
222
+ Pass a token via the `--github-token` flag or the `GITHUB_TOKEN` environment variable:
223
+
224
+ ```bash
225
+ # via flag
226
+ dirplot map github://my-org/private-repo --github-token ghp_…
227
+
228
+ # via environment variable (also picked up automatically by the CLI)
229
+ export GITHUB_TOKEN=ghp_…
230
+ dirplot map github://my-org/private-repo
231
+ ```
232
+
233
+ To create a token: GitHub → Settings → Developer settings → Personal access tokens → Generate new token (see [GitHub's guide](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens)). For read-only treemap access the `public_repo` scope (or no scope for public repos) is sufficient; add `repo` for private repositories.
234
+
164
235
  ## Python API
165
236
 
166
- The public API is small — `build_tree`, `create_treemap`, and the display helpers:
237
+ The public API is small — `build_tree`, `create_treemap`, `create_treemap_svg`, and the display helpers:
167
238
 
168
239
  ```python
169
240
  from pathlib import Path
170
- from dirplot.scanner import build_tree
171
- from dirplot.render import create_treemap
241
+ from dirplot import build_tree, create_treemap, create_treemap_svg
172
242
 
173
- # Build the tree and render to a PNG in memory
174
243
  root = build_tree(Path("/path/to/project"))
175
- buf = create_treemap(root, width_px=1920, height_px=1080, colormap="tab20", cushion=True)
176
244
 
177
- # Save to disk
245
+ # PNG returns a BytesIO containing PNG bytes
246
+ buf = create_treemap(root, width_px=1920, height_px=1080, colormap="tab20", cushion=True)
178
247
  Path("treemap.png").write_bytes(buf.read())
179
248
 
180
- # In a Jupyter notebook: display inline as a cell output (no save needed)
181
- from PIL import Image
182
- Image.open(buf) # Jupyter renders PIL images automatically via _repr_png_()
249
+ # SVG returns a BytesIO containing UTF-8 SVG bytes
250
+ # Includes CSS hover highlight, a JS floating tooltip, and cushion gradient shading.
251
+ buf = create_treemap_svg(root, width_px=1920, height_px=1080, cushion=True)
252
+ Path("treemap.svg").write_bytes(buf.read())
183
253
  ```
184
254
 
185
- To open the result in the system image viewer or display it inline:
255
+ To open a PNG in the system image viewer or display it inline in the terminal:
186
256
 
187
257
  ```python
188
258
  from dirplot.display import display_window, display_inline
@@ -194,6 +264,14 @@ buf.seek(0)
194
264
  display_inline(buf) # inline in terminal (iTerm2 / Kitty / WezTerm)
195
265
  ```
196
266
 
267
+ In a Jupyter notebook, PNG output renders automatically via PIL:
268
+
269
+ ```python
270
+ from PIL import Image
271
+ buf = create_treemap(root, width_px=1280, height_px=720)
272
+ Image.open(buf) # Jupyter renders PIL images automatically via _repr_png_()
273
+ ```
274
+
197
275
  ## Development
198
276
 
199
277
  ```bash
@@ -20,10 +20,12 @@
20
20
  - Label colour (black/white) chosen automatically based on background luminance.
21
21
  - Output resolution matches the current terminal window pixel size (via `TIOCGWINSZ`), or a custom `WIDTHxHEIGHT`.
22
22
  - Van Wijk cushion shading gives tiles a raised 3-D appearance (optional).
23
+ - **SVG output** (`--format svg` or `--output file.svg`) produces a fully self-contained interactive file: CSS hover highlight, a JavaScript floating tooltip panel, and cushion shading via a gradient — no external dependencies.
23
24
  - Display via system image viewer or inline in the terminal (iTerm2 and Kitty protocols, auto-detected).
24
- - Save output to a PNG file with `--output`.
25
+ - Save output to a PNG or SVG file with `--output`.
25
26
  - Exclude paths with `--exclude` (repeatable).
26
27
  - Works on macOS, Linux, and Windows; WSL2 fully supported.
28
+ - Scan remote hosts over SSH (`pip install "dirplot[ssh]"`), AWS S3 buckets (`pip install "dirplot[s3]"`), any public/private GitHub repository, **running Docker containers**, or **Kubernetes pods** — all without extra dependencies beyond the respective CLI/SDK. See [EXAMPLES.md](docs/EXAMPLES.md).
27
29
 
28
30
  ## How It Works
29
31
 
@@ -67,34 +69,44 @@ This tool has been developed and tested on macOS and is CI-tested on Linux and W
67
69
  uvx dirplot --help
68
70
 
69
71
  # Show dirplot for the current directory (opens image in system viewer)
70
- dirplot .
72
+ dirplot map .
73
+
74
+ # Show current terminal size in characters and pixels
75
+ dirplot termsize
71
76
 
72
77
  # Save to a file without displaying
73
- dirplot . --output dirplot.png --no-show
78
+ dirplot map . --output dirplot.png --no-show
74
79
 
75
80
  # Display inline (protocol auto-detected: iTerm2, Kitty, Ghostty)
76
- dirplot . --inline
81
+ dirplot map . --inline
77
82
 
78
83
  # Exclude directories
79
- dirplot . --exclude .venv --exclude .git
84
+ dirplot map . --exclude .venv --exclude .git
80
85
 
81
86
  # Use a different colormap and larger directory labels
82
- dirplot . --colormap Set2 --font-size 18
87
+ dirplot map . --colormap Set2 --font-size 18
83
88
 
84
89
  # Render at a fixed resolution instead of terminal size
85
- dirplot . --size 1920x1080 --output dirplot.png --no-show
90
+ dirplot map . --size 1920x1080 --output dirplot.png --no-show
86
91
 
87
92
  # Don't apply cushion shading — makes tiles look flat
88
- dirplot . --no-cushion
93
+ dirplot map . --no-cushion
94
+
95
+ # Save as an interactive SVG (hover highlight + floating tooltip)
96
+ dirplot map . --output treemap.svg --no-show
97
+
98
+ # Force SVG format explicitly
99
+ dirplot map . --format svg --output treemap.svg --no-show
89
100
  ```
90
101
 
91
102
  ### Options
92
103
 
93
104
  | Flag | Short | Default | Description |
94
105
  |---|---|---|---|
95
- | `--output` | `-o` | — | Save PNG to this path |
106
+ | `--output` | `-o` | — | Save to this path (PNG or SVG) |
107
+ | `--format` | `-f` | auto | Output format: `png` or `svg`. Auto-detected from `--output` extension |
96
108
  | `--show/--no-show` | | `--show` | Display the image after rendering |
97
- | `--inline` | | off | Display in terminal (protocol auto-detected) |
109
+ | `--inline` | | off | Display in terminal (protocol auto-detected; PNG only) |
98
110
  | `--legend/--no-legend` | | `--no-legend` | Show file-extension colour legend |
99
111
  | `--font-size` | `-s` | `12` | Directory label font size in pixels |
100
112
  | `--colormap` | `-c` | `tab20` | Matplotlib colormap for unknown extensions |
@@ -103,6 +115,7 @@ dirplot . --no-cushion
103
115
  | `--header/--no-header` | | `--header` | Print info lines before rendering |
104
116
  | `--cushion/--no-cushion` | | `--cushion` | Apply van Wijk cushion shading for a raised 3-D look |
105
117
  | `--log/--no-log` | | `--no-log` | Use log of file sizes for layout, making small files more visible |
118
+ | `--github-token` | | `$GITHUB_TOKEN` | GitHub personal access token for private repos or higher rate limits |
106
119
 
107
120
  ## Inline Display
108
121
 
@@ -121,30 +134,79 @@ The default mode (`--show`, no `--inline`) opens the PNG in the system viewer (`
121
134
 
122
135
  > **Windows note:** Common Windows shells (PowerShell, cmd, Git Bash) and terminal emulators (Windows Terminal, ConEmu) do not support any inline image protocol. `--inline` will silently produce no output in these environments. [WezTerm](https://wezfurlong.org/wezterm/) is currently the only mainstream Windows terminal emulator that supports inline image rendering (via the Kitty graphics protocol). WSL2 is treated as Linux and has full support.
123
136
 
137
+ > **Tip:** In terminals that support inline images (iTerm2, WezTerm, Kitty, etc.), the rendered image can often be dragged directly out of the terminal window and dropped into another application or saved to the desktop — no `--output` needed. This drag-and-drop behaviour is not guaranteed across all terminals.
138
+
124
139
  > **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. Or use [Pi](https://pi.dev) where it is easily added as an extension.
125
140
 
141
+ ## Archives
142
+
143
+ dirplot can read local archive files (zip, tar, 7z, rar, and ZIP-based formats like jar, whl, apk) as treemap inputs without unpacking them. See [ARCHIVES.md](docs/ARCHIVES.md) for supported formats, dependencies, and RAR setup on macOS.
144
+
145
+ ```bash
146
+ dirplot map project.zip
147
+ dirplot map release.tar.gz --depth 2
148
+ dirplot map app.jar
149
+ ```
150
+
151
+ ## Remote Access
152
+
153
+ dirplot can scan SSH hosts, AWS S3 buckets, GitHub repositories, running Docker containers, and Kubernetes pods. See [EXAMPLES.md](docs/EXAMPLES.md) for full details.
154
+
155
+ ```bash
156
+ pip install "dirplot[ssh]" # SSH via paramiko
157
+ pip install "dirplot[s3]" # AWS S3 via boto3
158
+ # GitHub: no extra dependency needed
159
+ # Docker: only the docker CLI required
160
+ # Kubernetes: only kubectl required
161
+ ```
162
+
163
+ ```bash
164
+ dirplot map ssh://alice@prod.example.com/var/www
165
+ dirplot map s3://noaa-ghcn-pds --no-sign
166
+ dirplot map github://pallets/flask
167
+ dirplot map docker://my-container:/app
168
+ dirplot map pod://my-pod:/app
169
+ dirplot map pod://my-pod@staging:/app
170
+ ```
171
+
172
+ ### GitHub authentication
173
+
174
+ Public repositories work without a token but are subject to GitHub's unauthenticated rate limit of **60 requests/hour**. A personal access token raises this to **5,000 requests/hour** and is required for private repositories.
175
+
176
+ Pass a token via the `--github-token` flag or the `GITHUB_TOKEN` environment variable:
177
+
178
+ ```bash
179
+ # via flag
180
+ dirplot map github://my-org/private-repo --github-token ghp_…
181
+
182
+ # via environment variable (also picked up automatically by the CLI)
183
+ export GITHUB_TOKEN=ghp_…
184
+ dirplot map github://my-org/private-repo
185
+ ```
186
+
187
+ To create a token: GitHub → Settings → Developer settings → Personal access tokens → Generate new token (see [GitHub's guide](https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/managing-your-personal-access-tokens)). For read-only treemap access the `public_repo` scope (or no scope for public repos) is sufficient; add `repo` for private repositories.
188
+
126
189
  ## Python API
127
190
 
128
- The public API is small — `build_tree`, `create_treemap`, and the display helpers:
191
+ The public API is small — `build_tree`, `create_treemap`, `create_treemap_svg`, and the display helpers:
129
192
 
130
193
  ```python
131
194
  from pathlib import Path
132
- from dirplot.scanner import build_tree
133
- from dirplot.render import create_treemap
195
+ from dirplot import build_tree, create_treemap, create_treemap_svg
134
196
 
135
- # Build the tree and render to a PNG in memory
136
197
  root = build_tree(Path("/path/to/project"))
137
- buf = create_treemap(root, width_px=1920, height_px=1080, colormap="tab20", cushion=True)
138
198
 
139
- # Save to disk
199
+ # PNG returns a BytesIO containing PNG bytes
200
+ buf = create_treemap(root, width_px=1920, height_px=1080, colormap="tab20", cushion=True)
140
201
  Path("treemap.png").write_bytes(buf.read())
141
202
 
142
- # In a Jupyter notebook: display inline as a cell output (no save needed)
143
- from PIL import Image
144
- Image.open(buf) # Jupyter renders PIL images automatically via _repr_png_()
203
+ # SVG returns a BytesIO containing UTF-8 SVG bytes
204
+ # Includes CSS hover highlight, a JS floating tooltip, and cushion gradient shading.
205
+ buf = create_treemap_svg(root, width_px=1920, height_px=1080, cushion=True)
206
+ Path("treemap.svg").write_bytes(buf.read())
145
207
  ```
146
208
 
147
- To open the result in the system image viewer or display it inline:
209
+ To open a PNG in the system image viewer or display it inline in the terminal:
148
210
 
149
211
  ```python
150
212
  from dirplot.display import display_window, display_inline
@@ -156,6 +218,14 @@ buf.seek(0)
156
218
  display_inline(buf) # inline in terminal (iTerm2 / Kitty / WezTerm)
157
219
  ```
158
220
 
221
+ In a Jupyter notebook, PNG output renders automatically via PIL:
222
+
223
+ ```python
224
+ from PIL import Image
225
+ buf = create_treemap(root, width_px=1280, height_px=720)
226
+ Image.open(buf) # Jupyter renders PIL images automatically via _repr_png_()
227
+ ```
228
+
159
229
  ## Development
160
230
 
161
231
  ```bash