wheelpaths 0.3.2__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.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Anish Pentyala
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.
@@ -0,0 +1,30 @@
1
+ # Invocation-wide limits validation
2
+
3
+ The change adds explicit admission caps to an offline planner. It does not claim
4
+ that old behavior accepted corrupt wheels or produced incorrect collision
5
+ reports; the missing behavior was an invocation-wide bound.
6
+
7
+ The existing 72 parameterized tests remain unchanged. New controls check exact
8
+ cap equality/overflow, repeated inputs, aggregate rather than per-file counts,
9
+ bounded second-file reads, no file open for over-limit wheel lists, no metadata
10
+ read before member admission, generated console/gui claims, skipped relocation
11
+ directories, per-call budget reset, existing per-archive caps, bad types/ranges,
12
+ CLI INVALID with no partial plan and preserved collision exit/report behavior.
13
+ All 124 parameterized cases (72 existing plus 52 new) pass on actual Python
14
+ 3.10, 3.13 and 3.15, matching the existing workflow matrix. Two expected ZIP
15
+ warnings come from existing deliberate duplicate-member fixtures. One hundred
16
+ seeded valid wheel-set reports match unchanged released local source exactly in
17
+ separate processes, including hashes, claims/order and conflicts. This sampled
18
+ parity does not prove equality for every possible input.
19
+
20
+ Four production mutants are caught: disabled wheel count cap (2 failures),
21
+ disabled aggregate byte-cap check (3), reset member budget per wheel (1), and
22
+ omitted generated-script claim counting (1). Restored tests pass. Some disabled
23
+ byte-check cases still fail later as truncated ZIP input: the negative control
24
+ checks the explicit aggregate-cap contract, not a claim that every mutant would
25
+ produce a falsely clear collision plan.
26
+
27
+ A fresh neutral installed-wheel Python3.13 run passes all124 cases with isolated
28
+ imports outside the checkout. Source/wheel/installed bytes and packaged README/
29
+ validation text are checked in the review packet. No hosted checks, performance
30
+ claim, external adoption or new original is claimed.
@@ -0,0 +1,2 @@
1
+ include README.md LICENSE LIMITS_VALIDATION.md
2
+ recursive-include tests *.py
@@ -0,0 +1,254 @@
1
+ Metadata-Version: 2.4
2
+ Name: wheelpaths
3
+ Version: 0.3.2
4
+ Summary: Offline collision plans for explicit POSIX wheel installation layouts
5
+ Author: Anish Pentyala
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/anishpentyala/wheelpaths
8
+ Project-URL: Repository, https://github.com/anishpentyala/wheelpaths
9
+ Project-URL: Issues, https://github.com/anishpentyala/wheelpaths/issues
10
+ Keywords: wheel,python-packaging,file-collisions
11
+ Requires-Python: >=3.10
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Dynamic: license-file
15
+
16
+ # wheelpaths
17
+
18
+ Check whether a chosen set of Python wheels would claim the same installation paths.
19
+
20
+ [![Tests](https://github.com/anishpentyala/wheelpaths/actions/workflows/tests.yml/badge.svg)](https://github.com/anishpentyala/wheelpaths/actions)
21
+
22
+ ## Quickstart
23
+
24
+ ```sh
25
+ python -m pip install "git+https://github.com/anishpentyala/wheelpaths.git"
26
+ python -m pip download --only-binary=:all: --no-deps jwt==1.4.0 PyJWT==2.15.1 -d wheels
27
+ printf '{"purelib":"/venv/lib/site-packages","platlib":"/venv/lib/site-packages","scripts":"/venv/bin","data":"/venv"}' > scheme.json
28
+ wheelpaths --scheme scheme.json wheels/*.whl > plan.json
29
+ ```
30
+
31
+ The pinned JWT wheel pair has four shared destinations under that scheme:
32
+
33
+ ```text
34
+ jwt/__init__.py
35
+ jwt/exceptions.py
36
+ jwt/py.typed
37
+ jwt/utils.py
38
+ ```
39
+
40
+ The planner exits 1 for collisions. It reads archives without installing,
41
+ extracting or importing them. This explicit POSIX path model does not inspect
42
+ an existing environment, resolve dependencies or prove an installation is safe.
43
+
44
+ Installation is currently from source. A PyPI release is being prepared; do not
45
+ assume `pip install wheelpaths` is available until its package page is linked here.
46
+
47
+ ## Details
48
+
49
+ Plan collisions in the destinations of a chosen set of Python wheels, without
50
+ installing them or importing their code. Supply an explicit POSIX installation
51
+ scheme. The output binds every claim to the SHA256 of the exact archive snapshot
52
+ read for the plan and distinguishes archive members from generated entry-point
53
+ scripts.
54
+
55
+ This is a path planner, not a package resolver, wheel validator or safe-install
56
+ certificate. `NO_COLLISIONS_IN_MODEL` means exactly that. It does not mean the
57
+ packages can be used together or installed safely.
58
+
59
+ ## Run
60
+
61
+ Install from this repository with `pip install .`, then:
62
+
63
+ ```sh
64
+ wheelpaths --scheme scheme.json first.whl second.whl > plan.json
65
+ ```
66
+
67
+ `scheme.json` must have exactly these four keys, with canonical absolute POSIX
68
+ paths. Equal destinations are allowed and important:
69
+
70
+ ```json
71
+ {
72
+ "purelib": "/venv/lib/python3.12/site-packages",
73
+ "platlib": "/venv/lib/python3.12/site-packages",
74
+ "scripts": "/venv/bin",
75
+ "data": "/venv"
76
+ }
77
+ ```
78
+
79
+ Exit 0: no collision found in the supported model. Exit 1: collisions found.
80
+ Exit 2: invalid/unsupported input, never a clear plan. Argument syntax errors use
81
+ argparse's stderr and exit 2; data/input errors produce JSON with status INVALID.
82
+
83
+ Root members use `Root-Is-Purelib`. Members in the wheel's own `.data/purelib`,
84
+ `.data/platlib`, `.data/scripts` and `.data/data` are relocated. `console_scripts`
85
+ and `gui_scripts` create POSIX command-name claims. Other entry-point groups
86
+ are ignored, including misspelled script group names; they do not generate
87
+ commands in this model. Equal targets are conflicts
88
+ even with equal contents: two owners can remove each other's files on uninstall.
89
+ A file that another claim needs as a directory is also a conflict. Shared
90
+ directories alone, including namespace-package directories, are not conflicts.
91
+
92
+ Inputs must resolve to regular files, verified on the opened descriptor. Symlinks
93
+ to regular files are allowed. On systems with `O_NONBLOCK`, FIFOs without writers
94
+ are refused without waiting for a producer. Other device or socket open failures
95
+ also produce INVALID; there is no universal timeout for regular files on a slow
96
+ or remote filesystem. The scheme JSON is UTF-8 and at most 1 MiB, including
97
+ whitespace. An over-limit or nonregular later input produces no partial plan.
98
+
99
+ Archives are never extracted. Per archive, at most 256 MiB of archive bytes, 100,000 members and 1 MiB per
100
+ read metadata file are accepted. Invocation-wide limits additionally cap the
101
+ wheel count, aggregate archive bytes, aggregate ZIP members and projected claims.
102
+ These are admission limits, not a general hostile-input sandbox or hard limits
103
+ on memory, disk, CPU time or serialized report bytes. ZIP central directories,
104
+ metadata text and path/claim objects still need memory. Conflict claim references
105
+ have a separate admission cap, including repetitions across conflicts.
106
+
107
+ ## Supported boundary
108
+
109
+ - Metadata ZIP compression must be stored or deflated; corrupted reads are INVALID.
110
+ - Wheel-Version 1.0, one expected `.dist-info` directory, optional matching `.data`.
111
+ - Explicit exact, case-sensitive POSIX lexical paths only.
112
+ - Candidate wheel set only; no network and no installed environment inspection.
113
+ - Headers and unknown schemes, special/symlink ZIP entries, duplicate members,
114
+ traversal/noncanonical paths and unknown metadata layouts fail explicitly.
115
+ - Root metadata identity is checked against the filename. RECORD contents,
116
+ member payload checksums, dependency metadata and wheel validity are not checked.
117
+
118
+ Not modeled: existing files, filesystem symlinks, case/Unicode aliases, Windows
119
+ launchers, generated bytecode, installer-added metadata such as INSTALLER, import
120
+ shadowing, ABI/tag compatibility, package dependencies or execution safety. The
121
+ scheme must reflect the intended install layout; it is not inferred from the
122
+ machine running the planner. No guarantee about a specific installer's extra
123
+ files or behavior is implied. No source builds or editable installs.
124
+
125
+ ## Checked example
126
+
127
+ An offline plan for actual `jwt 1.4.0` and `PyJWT 2.15.1` wheels finds four shared
128
+ destinations: `jwt/__init__.py`, `jwt/exceptions.py`, `jwt/py.typed` and
129
+ `jwt/utils.py`. The archive URLs and hashes are in `evidence/downloads.json`.
130
+ In a disposable staging directory, pypa installer copied the first wheel's 14
131
+ projected paths and refused the second wheel at the first predicted collision.
132
+ This is local verification, not maintainer adoption. The packages were not imported.
133
+
134
+ The test suite also checks `.data` relocation, aliased/distinct scheme roots,
135
+ console/gui scripts, within-wheel projection collisions, file/directory clashes,
136
+ namespace-directory sharing, invalid metadata, duplicate members, special files,
137
+ and machine-readable CLI outcomes. See `evidence/QUALIFICATION.md` for exact
138
+ runtime, negative-control and installed-artifact scope.
139
+
140
+ ### OpenCV desktop and headless wheels
141
+
142
+ A second offline check uses the manylinux2014 x86-64 `opencv-python` and
143
+ `opencv-python-headless` wheels for version `5.1.0.95`. Under the explicit scheme
144
+ in [`evidence/opencv-downloads.json`](evidence/opencv-downloads.json), the pair
145
+ produces 230 claims and 41 same-target conflicts, all under `cv2`. The manifest
146
+ pins both archive URLs, sizes and SHA256 hashes, plus the checked planner commit.
147
+ Pass those two wheel files and that scheme to the command in **Run** to reproduce
148
+ the plan. Neither wheel was installed or imported.
149
+
150
+ For these exact archives, an independent intersection of regular ZIP member
151
+ names gives the same 41 targets. Neither archive has `.data` relocation members
152
+ or entry-point metadata, both have `Root-Is-Purelib: false`, and the scheme's
153
+ library roots are equal. That simple intersection is not an oracle for arbitrary
154
+ wheels. Each wheel alone has no collision in this model, not a safe-install
155
+ certificate.
156
+
157
+ This illustrates a known packaging boundary, not a newly discovered OpenCV bug
158
+ or maintainer adoption. Both [OpenCV package](https://pypi.org/project/opencv-python/)
159
+ and [headless package](https://pypi.org/project/opencv-python-headless/) pages
160
+ already say to choose only one variant because they share the `cv2` namespace.
161
+
162
+ ## Existing work and intended use
163
+
164
+ Conflict detection is not new. ModuleGuard already studies and detects import
165
+ module conflicts. check-wheel-contents checks individual wheel contents.
166
+ Installer and package-manager overwrite checks are useful at install time.
167
+ wheelpaths instead emits an explicit, offline, cross-archive destination plan
168
+ including non-module `.data` and generated command targets. It is a small CI or
169
+ release-preflight building block, not a replacement for those tools. The research
170
+ notes cite their actual capabilities and do not claim exhaustive novelty.
171
+
172
+ ## License
173
+
174
+ MIT. No package-index release is implied by this repository.
175
+
176
+
177
+ ## Invocation-wide admission limits
178
+
179
+ | Option | Default | What counts |
180
+ | --- | --- | --- |
181
+ | `--max-wheels` | 100 | Every supplied input, including repeated paths |
182
+ | `--max-total-archive-bytes` | 1073741824 (1 GiB) | Sum of exact archive bytes read across inputs |
183
+ | `--max-total-members` | 250000 | Every ZIP member, including directories/metadata |
184
+ | `--max-claims` | 500000 | Each projected file/directory/generated script claim |
185
+ | `--max-conflict-claims` | 500000 | Every claim reference in every reported conflict, counting repetitions |
186
+
187
+ Each cap is an integer from 1 through 1000000000000. API booleans are not
188
+ integers here. Use `audit(wheels, scheme, limits=Limits(...))`, importing `Limits`
189
+ from `wheelpaths`, or the CLI flags above. Existing per-archive limits still
190
+ apply independently, even if an aggregate cap is raised. Equality with a cap is
191
+ allowed; exceeding any cap returns INVALID/exit2, never a partial collision plan.
192
+ Raising a cap is an explicit choice to admit more input, not a safety guarantee.
193
+
194
+ The wheel count is checked before any archive is opened. Each archive read is
195
+ bounded by the smaller of the per-archive limit plus one byte and the remaining
196
+ aggregate byte budget plus one. The one excess byte detects an overrun, is never
197
+ accepted into a plan, and need not be the entire next archive. Aggregate member
198
+ counts are checked after ZIP indexing but before reading metadata. Claims are
199
+ counted as projected, including generated console/gui scripts and repeated
200
+ claims; a relocation-only directory entry skipped by the existing planner still
201
+ counts as a ZIP member but does not create a projected claim. No file content is
202
+ installed, extracted or executed. Budgets reset for each audit call.
203
+
204
+ These new defaults intentionally reject formerly uncapped large invocations.
205
+ For inputs admitted under the defaults, successful plan structure, owner hashes,
206
+ claim ordering, collision semantics and report schema remain unchanged. No new
207
+ fields are added to successful reports. The CLI's INVALID JSON keeps its existing
208
+ shape; consumers must not interpret an invalid result as a collision-free plan.
209
+
210
+ ### Conflict report admission
211
+
212
+ `Limits(max_conflict_claims=N)` or `--max-conflict-claims N` limits the sum of
213
+ `len(conflict["claims"])` across the complete report. A claim repeated in several
214
+ conflicts is counted every time. Both same-target and file/directory conflicts
215
+ count. Shared directories alone do not create conflicts or spend this budget.
216
+ For example, one file blocking 100 descendant targets creates 200 claim references,
217
+ even though the blocking file is only one projected claim.
218
+
219
+ Equality with the cap is accepted. If the next conflict would exceed it, the
220
+ whole audit raises `InvalidPlan`, or the CLI returns INVALID/exit 2 without a
221
+ partial conflict plan. It never clips conflicts or presents an incomplete list
222
+ as a complete report. The cap is checked before constructing a combined
223
+ ancestor/descendant conflict-claim list. Budget state resets for each audit call.
224
+ This new default intentionally rejects previously admitted reports above the
225
+ cap; reports within it retain the same fields, ordering and collision semantics.
226
+
227
+ This limits claim-reference count, not unique claims, string lengths, encoded
228
+ JSON bytes or every intermediate allocation. Input claims and ZIP indexes have
229
+ already been collected before conflict analysis. A long target or member string
230
+ can make each reference large, so this is not a hard output-size or RAM bound.
231
+ No file is installed, executed, extracted, deleted or repaired.
232
+
233
+ ### Output failures
234
+
235
+ The installed command and `python -m wheelpaths.cli` return exit 2 if stdout
236
+ cannot be written or flushed, including closed pipes and full devices. This
237
+ overrides the model's clear/collision status. Partial bytes already written
238
+ cannot be retracted; check the process exit status before using a report.
239
+ The process runner redirects failed stdout to the null device before Python's
240
+ shutdown flush, avoiding an ignored flush exception and exit 120.
241
+
242
+ The callable `wheelpaths.cli.main(argv)` returns 2 on output failure without
243
+ closing or redirecting caller-owned streams. Embedding applications own their
244
+ own later flush/shutdown behavior.
245
+
246
+
247
+ ## Scheme decoder limits
248
+
249
+ A scheme JSON document nested beyond Python's decoder limit returns INVALID
250
+ JSON and exit 2, rather than an uncaught traceback and exit 1 (which otherwise
251
+ means a collision was found). This refusal happens before reading wheel
252
+ archives. The nesting guard applies only to scheme decoding; unexpected planner
253
+ failures are not silently turned into input errors. This is not a hard input
254
+ byte, memory, or CPU limit for scheme files.
@@ -0,0 +1,239 @@
1
+ # wheelpaths
2
+
3
+ Check whether a chosen set of Python wheels would claim the same installation paths.
4
+
5
+ [![Tests](https://github.com/anishpentyala/wheelpaths/actions/workflows/tests.yml/badge.svg)](https://github.com/anishpentyala/wheelpaths/actions)
6
+
7
+ ## Quickstart
8
+
9
+ ```sh
10
+ python -m pip install "git+https://github.com/anishpentyala/wheelpaths.git"
11
+ python -m pip download --only-binary=:all: --no-deps jwt==1.4.0 PyJWT==2.15.1 -d wheels
12
+ printf '{"purelib":"/venv/lib/site-packages","platlib":"/venv/lib/site-packages","scripts":"/venv/bin","data":"/venv"}' > scheme.json
13
+ wheelpaths --scheme scheme.json wheels/*.whl > plan.json
14
+ ```
15
+
16
+ The pinned JWT wheel pair has four shared destinations under that scheme:
17
+
18
+ ```text
19
+ jwt/__init__.py
20
+ jwt/exceptions.py
21
+ jwt/py.typed
22
+ jwt/utils.py
23
+ ```
24
+
25
+ The planner exits 1 for collisions. It reads archives without installing,
26
+ extracting or importing them. This explicit POSIX path model does not inspect
27
+ an existing environment, resolve dependencies or prove an installation is safe.
28
+
29
+ Installation is currently from source. A PyPI release is being prepared; do not
30
+ assume `pip install wheelpaths` is available until its package page is linked here.
31
+
32
+ ## Details
33
+
34
+ Plan collisions in the destinations of a chosen set of Python wheels, without
35
+ installing them or importing their code. Supply an explicit POSIX installation
36
+ scheme. The output binds every claim to the SHA256 of the exact archive snapshot
37
+ read for the plan and distinguishes archive members from generated entry-point
38
+ scripts.
39
+
40
+ This is a path planner, not a package resolver, wheel validator or safe-install
41
+ certificate. `NO_COLLISIONS_IN_MODEL` means exactly that. It does not mean the
42
+ packages can be used together or installed safely.
43
+
44
+ ## Run
45
+
46
+ Install from this repository with `pip install .`, then:
47
+
48
+ ```sh
49
+ wheelpaths --scheme scheme.json first.whl second.whl > plan.json
50
+ ```
51
+
52
+ `scheme.json` must have exactly these four keys, with canonical absolute POSIX
53
+ paths. Equal destinations are allowed and important:
54
+
55
+ ```json
56
+ {
57
+ "purelib": "/venv/lib/python3.12/site-packages",
58
+ "platlib": "/venv/lib/python3.12/site-packages",
59
+ "scripts": "/venv/bin",
60
+ "data": "/venv"
61
+ }
62
+ ```
63
+
64
+ Exit 0: no collision found in the supported model. Exit 1: collisions found.
65
+ Exit 2: invalid/unsupported input, never a clear plan. Argument syntax errors use
66
+ argparse's stderr and exit 2; data/input errors produce JSON with status INVALID.
67
+
68
+ Root members use `Root-Is-Purelib`. Members in the wheel's own `.data/purelib`,
69
+ `.data/platlib`, `.data/scripts` and `.data/data` are relocated. `console_scripts`
70
+ and `gui_scripts` create POSIX command-name claims. Other entry-point groups
71
+ are ignored, including misspelled script group names; they do not generate
72
+ commands in this model. Equal targets are conflicts
73
+ even with equal contents: two owners can remove each other's files on uninstall.
74
+ A file that another claim needs as a directory is also a conflict. Shared
75
+ directories alone, including namespace-package directories, are not conflicts.
76
+
77
+ Inputs must resolve to regular files, verified on the opened descriptor. Symlinks
78
+ to regular files are allowed. On systems with `O_NONBLOCK`, FIFOs without writers
79
+ are refused without waiting for a producer. Other device or socket open failures
80
+ also produce INVALID; there is no universal timeout for regular files on a slow
81
+ or remote filesystem. The scheme JSON is UTF-8 and at most 1 MiB, including
82
+ whitespace. An over-limit or nonregular later input produces no partial plan.
83
+
84
+ Archives are never extracted. Per archive, at most 256 MiB of archive bytes, 100,000 members and 1 MiB per
85
+ read metadata file are accepted. Invocation-wide limits additionally cap the
86
+ wheel count, aggregate archive bytes, aggregate ZIP members and projected claims.
87
+ These are admission limits, not a general hostile-input sandbox or hard limits
88
+ on memory, disk, CPU time or serialized report bytes. ZIP central directories,
89
+ metadata text and path/claim objects still need memory. Conflict claim references
90
+ have a separate admission cap, including repetitions across conflicts.
91
+
92
+ ## Supported boundary
93
+
94
+ - Metadata ZIP compression must be stored or deflated; corrupted reads are INVALID.
95
+ - Wheel-Version 1.0, one expected `.dist-info` directory, optional matching `.data`.
96
+ - Explicit exact, case-sensitive POSIX lexical paths only.
97
+ - Candidate wheel set only; no network and no installed environment inspection.
98
+ - Headers and unknown schemes, special/symlink ZIP entries, duplicate members,
99
+ traversal/noncanonical paths and unknown metadata layouts fail explicitly.
100
+ - Root metadata identity is checked against the filename. RECORD contents,
101
+ member payload checksums, dependency metadata and wheel validity are not checked.
102
+
103
+ Not modeled: existing files, filesystem symlinks, case/Unicode aliases, Windows
104
+ launchers, generated bytecode, installer-added metadata such as INSTALLER, import
105
+ shadowing, ABI/tag compatibility, package dependencies or execution safety. The
106
+ scheme must reflect the intended install layout; it is not inferred from the
107
+ machine running the planner. No guarantee about a specific installer's extra
108
+ files or behavior is implied. No source builds or editable installs.
109
+
110
+ ## Checked example
111
+
112
+ An offline plan for actual `jwt 1.4.0` and `PyJWT 2.15.1` wheels finds four shared
113
+ destinations: `jwt/__init__.py`, `jwt/exceptions.py`, `jwt/py.typed` and
114
+ `jwt/utils.py`. The archive URLs and hashes are in `evidence/downloads.json`.
115
+ In a disposable staging directory, pypa installer copied the first wheel's 14
116
+ projected paths and refused the second wheel at the first predicted collision.
117
+ This is local verification, not maintainer adoption. The packages were not imported.
118
+
119
+ The test suite also checks `.data` relocation, aliased/distinct scheme roots,
120
+ console/gui scripts, within-wheel projection collisions, file/directory clashes,
121
+ namespace-directory sharing, invalid metadata, duplicate members, special files,
122
+ and machine-readable CLI outcomes. See `evidence/QUALIFICATION.md` for exact
123
+ runtime, negative-control and installed-artifact scope.
124
+
125
+ ### OpenCV desktop and headless wheels
126
+
127
+ A second offline check uses the manylinux2014 x86-64 `opencv-python` and
128
+ `opencv-python-headless` wheels for version `5.1.0.95`. Under the explicit scheme
129
+ in [`evidence/opencv-downloads.json`](evidence/opencv-downloads.json), the pair
130
+ produces 230 claims and 41 same-target conflicts, all under `cv2`. The manifest
131
+ pins both archive URLs, sizes and SHA256 hashes, plus the checked planner commit.
132
+ Pass those two wheel files and that scheme to the command in **Run** to reproduce
133
+ the plan. Neither wheel was installed or imported.
134
+
135
+ For these exact archives, an independent intersection of regular ZIP member
136
+ names gives the same 41 targets. Neither archive has `.data` relocation members
137
+ or entry-point metadata, both have `Root-Is-Purelib: false`, and the scheme's
138
+ library roots are equal. That simple intersection is not an oracle for arbitrary
139
+ wheels. Each wheel alone has no collision in this model, not a safe-install
140
+ certificate.
141
+
142
+ This illustrates a known packaging boundary, not a newly discovered OpenCV bug
143
+ or maintainer adoption. Both [OpenCV package](https://pypi.org/project/opencv-python/)
144
+ and [headless package](https://pypi.org/project/opencv-python-headless/) pages
145
+ already say to choose only one variant because they share the `cv2` namespace.
146
+
147
+ ## Existing work and intended use
148
+
149
+ Conflict detection is not new. ModuleGuard already studies and detects import
150
+ module conflicts. check-wheel-contents checks individual wheel contents.
151
+ Installer and package-manager overwrite checks are useful at install time.
152
+ wheelpaths instead emits an explicit, offline, cross-archive destination plan
153
+ including non-module `.data` and generated command targets. It is a small CI or
154
+ release-preflight building block, not a replacement for those tools. The research
155
+ notes cite their actual capabilities and do not claim exhaustive novelty.
156
+
157
+ ## License
158
+
159
+ MIT. No package-index release is implied by this repository.
160
+
161
+
162
+ ## Invocation-wide admission limits
163
+
164
+ | Option | Default | What counts |
165
+ | --- | --- | --- |
166
+ | `--max-wheels` | 100 | Every supplied input, including repeated paths |
167
+ | `--max-total-archive-bytes` | 1073741824 (1 GiB) | Sum of exact archive bytes read across inputs |
168
+ | `--max-total-members` | 250000 | Every ZIP member, including directories/metadata |
169
+ | `--max-claims` | 500000 | Each projected file/directory/generated script claim |
170
+ | `--max-conflict-claims` | 500000 | Every claim reference in every reported conflict, counting repetitions |
171
+
172
+ Each cap is an integer from 1 through 1000000000000. API booleans are not
173
+ integers here. Use `audit(wheels, scheme, limits=Limits(...))`, importing `Limits`
174
+ from `wheelpaths`, or the CLI flags above. Existing per-archive limits still
175
+ apply independently, even if an aggregate cap is raised. Equality with a cap is
176
+ allowed; exceeding any cap returns INVALID/exit2, never a partial collision plan.
177
+ Raising a cap is an explicit choice to admit more input, not a safety guarantee.
178
+
179
+ The wheel count is checked before any archive is opened. Each archive read is
180
+ bounded by the smaller of the per-archive limit plus one byte and the remaining
181
+ aggregate byte budget plus one. The one excess byte detects an overrun, is never
182
+ accepted into a plan, and need not be the entire next archive. Aggregate member
183
+ counts are checked after ZIP indexing but before reading metadata. Claims are
184
+ counted as projected, including generated console/gui scripts and repeated
185
+ claims; a relocation-only directory entry skipped by the existing planner still
186
+ counts as a ZIP member but does not create a projected claim. No file content is
187
+ installed, extracted or executed. Budgets reset for each audit call.
188
+
189
+ These new defaults intentionally reject formerly uncapped large invocations.
190
+ For inputs admitted under the defaults, successful plan structure, owner hashes,
191
+ claim ordering, collision semantics and report schema remain unchanged. No new
192
+ fields are added to successful reports. The CLI's INVALID JSON keeps its existing
193
+ shape; consumers must not interpret an invalid result as a collision-free plan.
194
+
195
+ ### Conflict report admission
196
+
197
+ `Limits(max_conflict_claims=N)` or `--max-conflict-claims N` limits the sum of
198
+ `len(conflict["claims"])` across the complete report. A claim repeated in several
199
+ conflicts is counted every time. Both same-target and file/directory conflicts
200
+ count. Shared directories alone do not create conflicts or spend this budget.
201
+ For example, one file blocking 100 descendant targets creates 200 claim references,
202
+ even though the blocking file is only one projected claim.
203
+
204
+ Equality with the cap is accepted. If the next conflict would exceed it, the
205
+ whole audit raises `InvalidPlan`, or the CLI returns INVALID/exit 2 without a
206
+ partial conflict plan. It never clips conflicts or presents an incomplete list
207
+ as a complete report. The cap is checked before constructing a combined
208
+ ancestor/descendant conflict-claim list. Budget state resets for each audit call.
209
+ This new default intentionally rejects previously admitted reports above the
210
+ cap; reports within it retain the same fields, ordering and collision semantics.
211
+
212
+ This limits claim-reference count, not unique claims, string lengths, encoded
213
+ JSON bytes or every intermediate allocation. Input claims and ZIP indexes have
214
+ already been collected before conflict analysis. A long target or member string
215
+ can make each reference large, so this is not a hard output-size or RAM bound.
216
+ No file is installed, executed, extracted, deleted or repaired.
217
+
218
+ ### Output failures
219
+
220
+ The installed command and `python -m wheelpaths.cli` return exit 2 if stdout
221
+ cannot be written or flushed, including closed pipes and full devices. This
222
+ overrides the model's clear/collision status. Partial bytes already written
223
+ cannot be retracted; check the process exit status before using a report.
224
+ The process runner redirects failed stdout to the null device before Python's
225
+ shutdown flush, avoiding an ignored flush exception and exit 120.
226
+
227
+ The callable `wheelpaths.cli.main(argv)` returns 2 on output failure without
228
+ closing or redirecting caller-owned streams. Embedding applications own their
229
+ own later flush/shutdown behavior.
230
+
231
+
232
+ ## Scheme decoder limits
233
+
234
+ A scheme JSON document nested beyond Python's decoder limit returns INVALID
235
+ JSON and exit 2, rather than an uncaught traceback and exit 1 (which otherwise
236
+ means a collision was found). This refusal happens before reading wheel
237
+ archives. The nesting guard applies only to scheme decoding; unexpected planner
238
+ failures are not silently turned into input errors. This is not a hard input
239
+ byte, memory, or CPU limit for scheme files.
@@ -0,0 +1,22 @@
1
+ [build-system]
2
+ requires = ["setuptools>=77"]
3
+ build-backend = "setuptools.build_meta"
4
+ [project]
5
+ readme = "README.md"
6
+ name = "wheelpaths"
7
+ version = "0.3.2"
8
+ description = "Offline collision plans for explicit POSIX wheel installation layouts"
9
+ requires-python = ">=3.10"
10
+ license = "MIT"
11
+ authors = [{name = "Anish Pentyala"}]
12
+ keywords = ["wheel", "python-packaging", "file-collisions"]
13
+ license-files = ["LICENSE"]
14
+ [project.urls]
15
+ Homepage = "https://github.com/anishpentyala/wheelpaths"
16
+ Repository = "https://github.com/anishpentyala/wheelpaths"
17
+ Issues = "https://github.com/anishpentyala/wheelpaths/issues"
18
+
19
+ [project.scripts]
20
+ wheelpaths = "wheelpaths.cli:entrypoint"
21
+ [tool.setuptools.packages.find]
22
+ where = ["src"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,4 @@
1
+ """Offline lexical installation path plans. Never installs or imports a wheel."""
2
+ from .planner import audit, InvalidPlan, Limits
3
+
4
+ __all__ = ['audit', 'InvalidPlan', 'Limits']
@@ -0,0 +1,81 @@
1
+ """Machine-readable exit codes: 0 no modeled collision, 1 collisions, 2 invalid."""
2
+ import argparse
3
+ import json
4
+ import os
5
+ import sys
6
+ from functools import partial
7
+ from .planner import audit, InvalidPlan, Limits, _read_regular
8
+
9
+ MAX_SCHEME_BYTES = 1024 * 1024
10
+
11
+
12
+ def no_duplicates(pairs):
13
+ result = {}
14
+ for key, value in pairs:
15
+ if key in result:
16
+ raise InvalidPlan('duplicate JSON key: ' + key)
17
+ result[key] = value
18
+ return result
19
+
20
+
21
+ def _execute(argv=None):
22
+ parser = argparse.ArgumentParser(
23
+ description=__doc__,
24
+ **({"color": False} if sys.version_info >= (3, 14) else {}),
25
+ **({"formatter_class": partial(argparse.HelpFormatter, color=False)}
26
+ if sys.version_info[:2] == (3, 14) else {}))
27
+ parser.add_argument('--scheme', required=True,
28
+ help='JSON file with explicit absolute POSIX scheme paths')
29
+ parser.add_argument('wheels', nargs='+')
30
+ for name, value in vars(Limits()).items():
31
+ parser.add_argument('--' + name.replace('_', '-'), type=int, default=value)
32
+ args = parser.parse_args(argv)
33
+ try:
34
+ raw_scheme = _read_regular(args.scheme, MAX_SCHEME_BYTES)
35
+ if len(raw_scheme) > MAX_SCHEME_BYTES:
36
+ raise InvalidPlan('scheme JSON exceeds 1 MiB byte limit')
37
+ try:
38
+ scheme = json.loads(raw_scheme.decode('utf-8'), object_pairs_hook=no_duplicates)
39
+ except RecursionError as exc:
40
+ raise InvalidPlan('scheme JSON exceeds decoder nesting limit') from exc
41
+ result = audit(args.wheels, scheme, limits=Limits(**{
42
+ name: getattr(args, name) for name in vars(Limits())}))
43
+ except (InvalidPlan, ValueError, OSError) as exc:
44
+ result = {'schema': 1, 'status': 'INVALID', 'error': str(exc)}
45
+ code = 2
46
+ else:
47
+ code = 1 if result['conflicts'] else 0
48
+ try:
49
+ sys.stdout.write(json.dumps(result, sort_keys=(code != 2)) + '\n')
50
+ sys.stdout.flush()
51
+ except (OSError, ValueError, AttributeError):
52
+ return 2, True
53
+ return code, False
54
+
55
+
56
+ def main(argv=None):
57
+ """Return the report exit code without redirecting caller-owned streams."""
58
+ return _execute(argv)[0]
59
+
60
+
61
+ def entrypoint():
62
+ """Process runner: stop a failed stdout from failing again at shutdown."""
63
+ code, output_failed = _execute()
64
+ if output_failed:
65
+ # A failed buffered flush is retried during interpreter shutdown,
66
+ # which otherwise replaces the intended exit 2 with exit 120.
67
+ try:
68
+ stdout_fd = sys.stdout.fileno()
69
+ null_fd = os.open(os.devnull, os.O_WRONLY)
70
+ try:
71
+ os.dup2(null_fd, stdout_fd)
72
+ finally:
73
+ if null_fd != stdout_fd:
74
+ os.close(null_fd)
75
+ except (OSError, ValueError, AttributeError):
76
+ sys.stdout = open(os.devnull, 'w')
77
+ return code
78
+
79
+
80
+ if __name__ == '__main__':
81
+ sys.exit(entrypoint())