dark-matter-cli 0.2.0__py3-none-win_amd64.whl

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.
@@ -0,0 +1,282 @@
1
+ Metadata-Version: 2.4
2
+ Name: dark-matter-cli
3
+ Version: 0.2.0
4
+ Classifier: Environment :: Console
5
+ Classifier: License :: OSI Approved :: MIT License
6
+ Classifier: Operating System :: MacOS
7
+ Classifier: Operating System :: Microsoft :: Windows
8
+ Classifier: Operating System :: POSIX :: Linux
9
+ Classifier: Programming Language :: Rust
10
+ Classifier: Topic :: System :: Systems Administration
11
+ License-File: LICENSE
12
+ Summary: A dependency-graph-aware storage profiler for Homebrew.
13
+ Home-Page: https://github.com/jacksonfergusondev/dark-matter
14
+ Author-email: Jackson Ferguson <jackson.ferguson0@gmail.com>
15
+ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
16
+ Project-URL: Author, https://jacksonferguson.me
17
+ Project-URL: Issues, https://github.com/jacksonfergusondev/dark-matter/issues
18
+ Project-URL: PyPI, https://pypi.org/project/dark-matter-cli/
19
+ Project-URL: Repository, https://github.com/jacksonfergusondev/dark-matter
20
+
21
+ <!-- rumdl-disable-file first-line-heading -->
22
+ <div align="center">
23
+
24
+ <picture>
25
+ <source media="(prefers-color-scheme: dark)" srcset="assets/readme-dark.svg">
26
+ <source media="(prefers-color-scheme: light)" srcset="assets/readme-light.svg">
27
+ <img alt="Dark Matter Logo"
28
+ src="assets/readme-light.svg"
29
+ width="450"
30
+ style="max-width:100%; height:auto;">
31
+ </picture>
32
+
33
+ **Dependency-graph-aware storage analysis for Homebrew.**
34
+
35
+ [![PyPI Version](https://img.shields.io/pypi/v/dark-matter-cli?style=flat-square&color=94a3b8&labelColor=0A0A0A&logo=pypi&logoColor=94a3b8)](https://pypi.org/project/dark-matter-cli/)
36
+ [![CI](https://img.shields.io/github/actions/workflow/status/JacksonFergusonDev/dark-matter/ci.yml?style=flat-square&color=94a3b8&labelColor=0A0A0A&label=CI)](https://github.com/JacksonFergusonDev/dark-matter/actions/workflows/ci.yml)
37
+ [![Release](https://img.shields.io/github/actions/workflow/status/JacksonFergusonDev/dark-matter/release.yml?style=flat-square&color=94a3b8&labelColor=0A0A0A&label=Release)](https://github.com/JacksonFergusonDev/dark-matter/actions/workflows/release.yml)
38
+ [![Rust](https://img.shields.io/badge/rust-2024-94a3b8?style=flat-square&color=94a3b8&labelColor=0A0A0A&logo=rust&logoColor=94a3b8)](https://www.rust-lang.org/)
39
+ [![Clippy](https://img.shields.io/badge/clippy-pedantic-94a3b8?style=flat-square&labelColor=0A0A0A)](https://doc.rust-lang.org/clippy/)
40
+ [![prek](https://img.shields.io/badge/prek-enabled-94a3b8?style=flat-square&labelColor=0A0A0A)](https://github.com/j178/prek)
41
+ [![License](https://img.shields.io/badge/license-MIT-94a3b8?style=flat-square&labelColor=0A0A0A)](LICENSE)
42
+
43
+ </div>
44
+
45
+ ## Why
46
+
47
+ Homebrew flattens every dependency into a single `Cellar` directory. Tools like `du` or `ncdu` can tell you a formula takes up 500 MB, but they have no concept of *why* — whether that mass belongs to the formula itself or to a shared runtime pulled in by five other packages you installed for unrelated reasons.
48
+
49
+ Dark Matter reconstructs the dependency graph Homebrew already knows about and uses it to answer a more useful question: for each package you explicitly installed, how much disk space does it actually cost you, once shared dependencies are fairly split across everything that depends on them?
50
+
51
+ ## How it works
52
+
53
+ Dark Matter parses Homebrew's own JSON metadata (via `brew info --json=v2` or its local API cache, including Homebrew 7's per-platform format), rebuilds the dependency DAG, and walks it to compute two figures per package:
54
+
55
+ - **Core size** — the package's own on-disk footprint (or, in theoretical mode, its compressed bottle archive). For formulae this is the keg Homebrew currently uses; older versions waiting for `brew cleanup` are reported by `cleanup` instead.
56
+ - **Weighted recursive size** — the core size plus a *fair share* of every transitive dependency, where each shared dependency's cost is divided evenly across the root packages that need it.
57
+
58
+ The ratio between the two — the **Bloat Ratio** — is the headline number. A low ratio means a package is mostly self-contained; a high ratio means most of its footprint belongs to shared infrastructure it happens to require. Packages with no measurable core size (meta-packages, for example) have no meaningful ratio and show `—`.
59
+
60
+ ### The attribution model
61
+
62
+ Costs are attributed to **roots**: the packages you asked for (formulae installed on request, and every cask), plus any package nothing else depends on, such as an orphaned dependency. In catalog mode nothing is "requested", so roots are the formulae no other formula depends on.
63
+
64
+ - A root owns its own core size in full. If you requested `python` and something else also depends on it, that dependent isn't charged for `python` — you'd have it either way.
65
+ - Every other package is split evenly across the roots whose dependency closure contains it. Intermediate dependencies never take a share.
66
+
67
+ Dependencies come from each formula's definition plus the runtime dependencies Homebrew recorded when the keg was installed, which is what `brew autoremove` relies on. A keg keeps linking against what it was built with even after the formula drops a dependency.
68
+
69
+ `analyze` and `leaderboard` list only roots by default, because a dependency's size is already counted in the roots that share it. That can hide large packages: in the catalog, `texlive` (about 2 GB) has a single dependent, so it shows up as that package's weighted size. Pass `--all` to list dependencies too; their weighted sizes overlap their roots', so don't add them up.
70
+
71
+ Every package is reachable from at least one root, so the shares always add up to what's on disk:
72
+
73
+ $$\sum_{r \in \text{roots}} W(r) = \sum_{p} m_{core}(p)$$
74
+
75
+ Run with `--verbose` to see this check for your own installation.
76
+
77
+ ## Features
78
+
79
+ - **Comprehensive analysis suite**
80
+ - `analyze` — measures what's actually on disk, using `brew info --json=v2 --installed` and parallel filesystem traversal for exact byte counts. These are file sizes, like Finder's "Size"; `du` counts allocated disk blocks instead, so it can differ by a few percent. Casks are measured where they are installed (e.g. `/Applications/Foo.app`), not just their `Caskroom` staging directory.
81
+ - `leaderboard` — a theoretical mode that ranks Homebrew's *entire* formula catalog from the local API cache, without requiring anything to be installed. Casks ship no bottles, so they can only be measured once installed, with `analyze`.
82
+ - `inspect` & `compare` — targeted analysis of individual or grouped packages, scoping disk measurement (or network resolution in theoretical mode) strictly to the targets' dependency closure.
83
+ - `explain` — breaks down a target package's bloat by attributing fractional byte costs to each of its transitive dependencies.
84
+ - `export` — streams the computed bloat data to CSV or JSON for integration into external data pipelines.
85
+ - **Cleanup planning**
86
+ - `reclaim` — how much space `brew uninstall <packages>` followed by `brew autoremove` would free, and which uninstalls Homebrew would refuse because something still needs the package.
87
+ - `orphans` — dependencies nothing you requested still needs: what `brew autoremove` would remove, with sizes.
88
+ - `cleanup` — old versions still sitting in the Cellar that `brew cleanup` would remove. Like Homebrew, it leaves alone formulae whose newest version isn't installed yet, and pinned or linked versions.
89
+ - `diff` — compares two `export` snapshots to show what grew, shrank, appeared, or disappeared, e.g. after a `brew upgrade`.
90
+ - **Fractional Attribution Model** — shared dependencies (`openssl`, `zlib`, etc.) are divided evenly across the root packages that need them instead of being double-counted, and the shares add up to exactly the bytes measured. See [the attribution model](#the-attribution-model).
91
+ - **Single native binary & daemon-free** — compiled Rust executable with zero runtime dependencies, no background indexing, and no persistent database. Every run is a fresh, on-demand computation.
92
+ - **Tested and linted** — checked with `clippy` (pedantic), `rustfmt`, unit tests, property-based mass-conservation tests (`proptest`), and CLI integration tests across macOS, Linux, and Windows (x86_64 and ARM64), plus a live Homebrew smoke test, nightly Homebrew receipt parity checks, and a coverage floor in CI.
93
+
94
+ ## A note on theoretical measurements
95
+
96
+ `leaderboard`, `inspect`, `compare`, and `explain` rely on `Content-Length` headers from `ghcr.io` blob storage, which report *compressed* archive size, not the size a package occupies once unpacked to disk. The absolute numbers they report will therefore run lower than `analyze`'s physical measurements.
97
+
98
+ The Bloat Ratio holds up better than the absolute sizes, but compression doesn't cancel out. Each bottle has its own compression factor $c_p$ (unpacked size over archive size), so the theoretical ratio weighs every package by how well it happens to compress:
99
+
100
+ $$R_{theoretical} = \frac{m_{core}/c_{core} + \sum_d s_d/c_d}{m_{core}/c_{core}}$$
101
+
102
+ where $s_d$ is the unpacked share of dependency $d$. The factors would only cancel if every package compressed equally well, and they don't. Across 106 formulae installed on one `arm64_tahoe` machine, $c_p$ ranged from 1.8× (`bat`) to 7.8× (`libxcb`), with a median of 3.0×. A package that compresses unusually well next to dependencies that don't (or the reverse) can have its theoretical ratio off by up to the spread between those extremes, about 4×.
103
+
104
+ Treat theoretical modes as a guide to orders of magnitude: they reliably separate a 1× package from a 100× one, but a 2× and a 4× package may well swap places once installed. For real figures, install the packages and run `analyze`, `inspect`, or `explain`.
105
+
106
+ ## Installation
107
+
108
+ With [Homebrew](https://brew.sh):
109
+
110
+ ```bash
111
+ brew install jacksonfergusondev/tap/dark-matter
112
+ ```
113
+
114
+ Or from [PyPI](https://pypi.org/project/dark-matter-cli/) (prebuilt native wheels via `maturin`) with [`uv`](https://docs.astral.sh/uv/):
115
+
116
+ ```bash
117
+ uv tool install dark-matter-cli
118
+ ```
119
+
120
+ Or download a prebuilt binary from the [Releases page](https://github.com/JacksonFergusonDev/dark-matter/releases), or build from source with Cargo:
121
+
122
+ ```bash
123
+ git clone https://github.com/jacksonfergusondev/dark-matter.git
124
+ cd dark-matter
125
+ cargo install --path .
126
+ ```
127
+
128
+ ## Usage
129
+
130
+ ```bash
131
+ # Analyze what's actually installed
132
+ dark-matter analyze
133
+
134
+ # Rank the entire Homebrew catalog by theoretical bloat
135
+ dark-matter leaderboard
136
+
137
+ # Evaluate a specific formula instantly
138
+ dark-matter inspect uv
139
+
140
+ # Break down the dependency bloat of a specific package, as a table or a tree
141
+ dark-matter explain uv
142
+ dark-matter explain uv --tree
143
+
144
+ # Compare multiple packages side-by-side
145
+ dark-matter compare uv poetry pdm
146
+
147
+ # Export the entire graph to JSON for external analysis
148
+ dark-matter export --format json > homebrew_bloat.json
149
+
150
+ # See what removing packages would free, and what's already removable
151
+ dark-matter reclaim ffmpeg imagemagick
152
+ dark-matter orphans
153
+ dark-matter cleanup
154
+
155
+ # Snapshot today, then compare after an upgrade
156
+ dark-matter export --format json > snapshot-$(date +%F).json
157
+ dark-matter diff snapshot-2026-10-01.json snapshot-2026-10-12.json
158
+ ```
159
+
160
+ Exports include every package. Filter on `Is_Root` to get the rows whose `Weighted_Bytes` sum to the total; `Is_Requested` marks the packages you installed on purpose. `Bloat_Ratio` is empty (CSV) or `null` (JSON) when a package has no core size.
161
+
162
+ Sizes are shown in decimal units (1 MB = 1,000,000 bytes), matching Finder. Exports always contain exact byte counts.
163
+
164
+ All commands accept the global `--verbose` / `-v` flag for debug logging (written to stderr), and `--version` to print the installed version.
165
+
166
+ When `inspect`, `compare`, or `explain` are pointed at packages that aren't installed, Dark Matter offers to fall back to the theoretical catalog.
167
+
168
+ Theoretical modes read the catalog Homebrew caches for the current platform, so run `brew update` first if it's missing. Formulae without a bottle for the platform count as 0, and so do bottles whose size couldn't be fetched from ghcr.io; Dark Matter warns when that happens, and the next run retries them. `--arch` defaults to this machine's bottle tag (e.g. `arm64_tahoe`, `x86_64_linux`).
169
+
170
+ ### Shell completion
171
+
172
+ Tab completion covers subcommands, options, and the names of installed packages. Install it for your current shell (bash, zsh, fish, elvish, or PowerShell) with:
173
+
174
+ ```bash
175
+ dark-matter --install-completion
176
+ ```
177
+
178
+ Then restart your shell. `--show-completion` prints the activation snippet instead, if you'd rather add it to your shell config yourself.
179
+
180
+ ### `analyze`
181
+
182
+ | Flag | Default | Description |
183
+ | --- | --- | --- |
184
+ | `--sort` / `-s` | `ratio` | Sort by `ratio`, `core`, or `recursive` |
185
+ | `--top` / `-n` | `20` | Number of packages to display (at least 1) |
186
+ | `--fractional` / `--standard` | `--fractional` | Toggle the Fractional Attribution Model |
187
+ | `--all` / `-A` | off | Also list dependencies, marked `· dependency` |
188
+
189
+ ### `leaderboard`
190
+
191
+ | Flag | Default | Description |
192
+ | --- | --- | --- |
193
+ | `--sort` / `-s` | `ratio` | Sort by `ratio`, `core`, or `recursive` |
194
+ | `--top` / `-n` | `20` | Number of packages to display (at least 1) |
195
+ | `--arch` / `-a` | detected | Target bottle tag |
196
+ | `--all` / `-A` | off | Also list dependencies, marked `· dependency` |
197
+
198
+ ### `inspect`
199
+
200
+ | Argument/Flag | Default | Description |
201
+ | --- | --- | --- |
202
+ | `[PACKAGE]` | **Required** | The target package to analyze |
203
+ | `--source` / `-s` | `installed` | Data source to compute: `installed` or `catalog` |
204
+ | `--arch` / `-a` | detected | Target bottle tag |
205
+
206
+ ### `compare`
207
+
208
+ | Argument/Flag | Default | Description |
209
+ | --- | --- | --- |
210
+ | `[PACKAGES]...` | **Required** | A space-separated list of packages to compare |
211
+ | `--sort` / `-s` | `ratio` | Sort by `ratio`, `core`, or `recursive` |
212
+ | `--source` | `installed` | Data source to compute: `installed` or `catalog` |
213
+ | `--arch` / `-a` | detected | Target bottle tag |
214
+
215
+ ### `explain`
216
+
217
+ | Argument/Flag | Default | Description |
218
+ | --- | --- | --- |
219
+ | `[PACKAGE]` | **Required** | The specific package to analyze |
220
+ | `--source` / `-s` | `installed` | Data source to compute: `installed` or `catalog` |
221
+ | `--arch` / `-a` | detected | Target bottle tag |
222
+ | `--tree` / `-t` | off | Show the dependency tree instead of a table |
223
+
224
+ ### `reclaim`
225
+
226
+ | Argument | Default | Description |
227
+ | --- | --- | --- |
228
+ | `[PACKAGES]...` | **Required** | The installed packages to (hypothetically) uninstall |
229
+
230
+ Only bytes the packages are responsible for are counted: existing orphans are left to `orphans`.
231
+
232
+ ### `orphans` and `cleanup`
233
+
234
+ Neither takes options. Both measure the local installation only.
235
+
236
+ ### `diff`
237
+
238
+ | Argument/Flag | Default | Description |
239
+ | --- | --- | --- |
240
+ | `[OLD]` | **Required** | The earlier `export` snapshot (`.csv`, or JSON otherwise) |
241
+ | `[NEW]` | **Required** | The later `export` snapshot |
242
+ | `--top` / `-n` | `20` | Number of packages to display (at least 1) |
243
+
244
+ ### `export`
245
+
246
+ | Flag | Default | Description |
247
+ | --- | --- | --- |
248
+ | `--source` / `-s` | `installed` | Data source to compute: `installed` or `catalog` |
249
+ | `--format` / `-f` | `csv` | Output format: `csv` or `json` |
250
+ | `--arch` / `-a` | detected | Target bottle tag (for `catalog` source) |
251
+
252
+ ## Development
253
+
254
+ The project uses [`just`](https://github.com/casey/just) to wrap common tasks:
255
+
256
+ ```bash
257
+ just format # cargo fmt + rumdl fmt
258
+ just lint # cargo fmt --check + cargo clippy + rumdl
259
+ just test # cargo test --all-targets
260
+ just test-cov # cargo llvm-cov (85% line floor)
261
+ just smoke # live Homebrew smoke test
262
+ just build # cargo build --release
263
+ just ci # the full pipeline CI runs, locally
264
+ just changelog # preview release notes for unreleased commits
265
+ ```
266
+
267
+ ## Changelog
268
+
269
+ Release notes for every version are on the [Releases page](https://github.com/JacksonFergusonDev/dark-matter/releases). They're generated from commit messages by [git-cliff](https://git-cliff.org), configured in `cliff.toml`; `just changelog` previews the notes for unreleased changes.
270
+
271
+ ## Contact
272
+
273
+ [![GitHub](https://img.shields.io/badge/GitHub-100000?style=for-the-badge&logo=github&logoColor=white)](https://github.com/JacksonFergusonDev)
274
+ [![LinkedIn](https://img.shields.io/badge/LinkedIn-0077B5?style=for-the-badge&logo=linkedin&logoColor=white)](https://www.linkedin.com/in/jackson--ferguson/)
275
+ [![Email](https://img.shields.io/badge/Email-D14836?style=for-the-badge&logo=gmail&logoColor=white)](mailto:jackson.ferguson0@gmail.com)
276
+
277
+ [![Website](https://raw.githubusercontent.com/JacksonFergusonDev/JacksonFergusonDev.github.io/refs/heads/main/.github/assets/badge.svg)](https://jacksonferguson.me)
278
+
279
+ ## 📄 License
280
+
281
+ This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.
282
+
@@ -0,0 +1,6 @@
1
+ dark_matter_cli-0.2.0.data/scripts/dark-matter.exe,sha256=sjQVzdBn9JwrCGWmOGtyphy2W8mDNYqjfbo-IhHG7bY,6840320
2
+ dark_matter_cli-0.2.0.dist-info/METADATA,sha256=LEaOckoWNUb1LWGBETGtswCd4iTLsp-8wQwzbY_qfio,17009
3
+ dark_matter_cli-0.2.0.dist-info/WHEEL,sha256=Uvw7WSmy7Kj2FBk8Va4L_dq4MDW8X5Ynby-pOX3ZNS0,94
4
+ dark_matter_cli-0.2.0.dist-info/licenses/LICENSE,sha256=JyYU3RNZBbzW7cxCaKjxaUr0QjHSvjbcYfwbEmVMtNQ,1094
5
+ dark_matter_cli-0.2.0.dist-info/sboms/dark-matter.cyclonedx.json,sha256=IIibCx9aXoX-OWIxcDsbAhTPPHzdhCDGy_yAB4sXlB8,238132
6
+ dark_matter_cli-0.2.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: maturin (1.16.0)
3
+ Root-Is-Purelib: false
4
+ Tag: py3-none-win_amd64
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Jackson Ferguson
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.