Repository navigation
Stop shipping the frontend source tree and desktop crate in the wheel - #10426
Conversation
The 2026.9.2 wheel is 82MB, and 35MB of that is the pre-build frontend tree
plus the Tauri crate, neither of which an installed Unsloth reads.
include-package-data plus setuptools-scm's git file finder hands every tracked
file under studio/ to the nearest surviving package, so package-data naming
frontend/dist/**/* and nothing else under frontend/ was not the constraint it
looks like. The wheel carried:
frontend/public 31.1MB, and all 99 files are byte-identical to their copies
in frontend/dist, because Vite copies public/ into dist/
during npm run build
frontend/src 4.0MB of .ts/.tsx already compiled into dist/assets
src-tauri 0.6MB of Rust plus NSIS/AppImage/dmg installer branding
Veto them in exclude-package-data and prune them in MANIFEST.in. Both are
needed: python -m build rebuilds the wheel from the sdist, where
exclude-package-data no longer bites because there is no .git tree for the file
finder.
src-tauri/icons is deliberately kept. install.sh reads icon.icns and icon.png
back out of site-packages/studio/src-tauri/icons to build the macOS and Linux
launchers, and test_installer_shortcut_icons.py pins them to package-data.
Nothing else changes hands. run.py mounts frontend/dist, which still ships in
full; the only frontend/public references in Python are the remote
raw.githubusercontent URLs in backend/colab.py. The desktop release is
unaffected because release-desktop.yml builds the frontend and Tauri from a git
checkout, and its PyPI stamp check reads
studio/backend/utils/_studio_release_build.py, which is untouched.
Measured on a local build: 82.3MB to 46.0MB.
_exclude_package_data in the test helper only matched single-line arrays, and
callers read an empty veto list as "nothing is excluded", so a multi-line entry
would have made the simulation disagree with the real wheel. Parse with DOTALL.
|
You have reached your Codex usage limits for security reviews. Please try again later. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
The site-packages branch globbed site-packages/unsloth/studio/frontend/public, but studio is a top-level package in the wheel (top_level.txt lists studio, unsloth, unsloth_cli), so unsloth/studio/ is never a real path. The glob has never matched, and every install has been falling through to the raw.githubusercontent.com download for the Linux and macOS launcher icon. Point it at frontend/dist instead of frontend/public. Vite copies public/ into dist/ at build time, so the file is in both in a checkout, but only dist/ ships in the wheel now that public/ is excluded. Fixing this to frontend/public would have made a working lookup break on the very next release. The src-tauri/icons lookups just below already use the correct top-level path.
|
Pushed a second commit. While auditing every place an installed Unsloth reads an asset back out of site-packages, I found one that the
for _sp in "$_css_venv_dir"/lib/python*/site-packages/unsloth/studio/frontend/public; do
So The fix points it at
Worth flagging that repairing this to The |
|
Measured the combined effect rather than leaving it as an estimate. Built a wheel from both branches merged, using the real built JS/CSS/font output lifted out of the published 2026.9.2 wheel (604 files from Integrity checks on the resulting wheel:
The PR body says "roughly 20MB" for the pair; the measured figure is 22.35MB. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 8e0407b84f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| "studio" = [ | ||
| "frontend/public/**", | ||
| "frontend/src/**", | ||
| "frontend/package-lock.json", |
There was a problem hiding this comment.
Remove the obsolete lockfile requirement from Wheel CI
When this change triggers .github/workflows/wheel-smoke.yml, the wheel deliberately omits studio/frontend/package-lock.json, but the workflow's Wheel content sanity step still defines "lockfile shipped" as requiring that file and exits nonzero when any check is false (lines 100–121). Consequently, every PR or main push containing this packaging change fails Wheel CI even when the artifact is correct; update that workflow assertion together with this exclusion.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Correct, and it was the one real break in this PR. Fixed in 1d14b1b, before this review landed.
wheel-smoke.yml exits non-zero when any check is false, so excluding the lockfile failed the job outright. The assertion dates from the original Studio PR-time CI (#5298) and encoded the old policy. It is now inverted to sit alongside the existing no bun.lock and no node_modules checks, since the lockfile is a build input for the npm ci step in that same job rather than something an installed Unsloth reads. I also added no frontend public and no frontend src so wheel-smoke actively guards this exclusion, and kept frontend dist shipped asserted positively so a wheel with no UI in it cannot pass.
Verified against a locally built wheel: all six checks PASS.
Worth noting two independent adversarial review passes flagged this same workflow, so the finding replicates.
| prune studio/src-tauri/src | ||
| prune studio/src-tauri/linux | ||
| prune studio/src-tauri/windows | ||
| prune studio/src-tauri/dmg | ||
| prune studio/src-tauri/capabilities |
There was a problem hiding this comment.
Prune the remaining top-level Tauri crate files
For an sdist build, setuptools-scm seeds the manifest with all tracked files and these directives remove only the listed subdirectories. The archive therefore still contains studio/src-tauri/Cargo.lock, Cargo.toml, build.rs, both plist files, and every tauri*.json, even though the new exclude-package-data table vetoes the same files from the wheel and the change claims the desktop crate is absent from both artifacts. Add matching exclude directives here so the published sdist does not retain this portion of the crate.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Correct, and already fixed in 81d15fb. prune only accepts directories, so pruning the five subdirectories left the crate's root files behind.
The current tip adds exactly the directives you describe:
exclude studio/src-tauri/Cargo.lock
exclude studio/src-tauri/Cargo.toml
exclude studio/src-tauri/build.rs
exclude studio/src-tauri/*.plist
exclude studio/src-tauri/tauri*.json
Rebuilt sdist afterwards: src-tauri/ now contains the five icons and nothing else. Those stay because install.sh reads icon.icns and icon.png back out of site-packages to build the macOS and Linux launchers.
One correction to the reasoning though. The premise that this was also needed for the wheel is not right: exclude-package-data keeps these out of the wheel on its own, including the wheel python -m build rebuilds from the sdist. I checked by restoring the excluded files into an extracted sdist and listing them in its manifest, and the rebuilt wheel still excluded them, which matches setuptools' documented exclusion precedence. So these directives are about the sdist only. The PR text and the MANIFEST.in comment originally overstated that and have been corrected too.
prune only takes directories, so pruning src-tauri/{src,linux,windows,dmg,
capabilities} left Cargo.lock, Cargo.toml, build.rs, the two plists and the four
tauri*.json configs in the sdist. exclude-package-data kept them out of the
wheel either way, so this is the sdist catching up to the wheel rather than a
fix to what installs. src-tauri/ in the sdist is now the five icons and nothing
else.
Also corrects the comment above the frontend prunes. exclude-package-data is
what keeps these out of the wheel, including the wheel python -m build rebuilds
from the sdist; the prunes here keep them out of the sdist itself.
|
You have reached your Codex usage limits for security reviews. Please try again later. |
|
Ran five independent reviews of this branch, each on a separate angle, plus a deterministic route check. All five returned SAFE. Summarising the parts that are actual evidence rather than opinion. The central premise, checked file by fileIn the published 2026.9.2 wheel, comparing
Deterministic route checkRather than reasoning about it, one review extracted the PR's actual serving function and middleware and requested every asset:
Byte comparison specifically rules out an HTML fallback returning 200 while serving the wrong thing. Separately I resolved every asset-path string literal in An import-specifier scan across 1361 checkout and 1353 wheel Desktop
One consumer that looked alarming and is not
Installed-artifact testingOne review went past static analysis: it built both the wheel and the sdist under the pinned setuptools 82.0.1 / setuptools-scm 9.2.2, ran Two corrections, both now pushed
LimitsNone of the five could run a native desktop binary, a real browser session, or a full GitHub Actions release; the frontend |
…hips wheel-smoke.yml asserted "lockfile shipped", so excluding studio/frontend/package-lock.json failed the job outright (it exits non-zero when any check fails). The assertion dates from the original Studio PR-time CI (#5298) and encodes the old policy. The lockfile is a build input for the npm ci step in that same job, not something an installed Unsloth reads, so the check is inverted to match the rest of the pre-build tree, alongside the existing no-bun.lock and no-node_modules checks. Added the same negative check for frontend/public and frontend/src so wheel-smoke actively guards the exclusion rather than being neutral about it, with "frontend dist shipped" still asserted positively so a wheel with no UI in it cannot pass. Verified against a locally built wheel: all six checks PASS. Also corrects the docstring on test_manifest_prunes_match_exclude_package_data. It repeated the claim that exclude-package-data stops applying in the sdist to wheel rebuild. Restoring the excluded files into an extracted sdist and listing them in its manifest still produces a wheel without them, which is setuptools' documented exclusion precedence. The two vetoes cover different artifacts, not different stages.
|
You have reached your Codex usage limits for security reviews. Please try again later. |
|
Second review round against the current tip, five fresh adversarial passes plus a real-server route check. One returned BREAKS, and it was right. Fixed in 1d14b1b. The break
"lockfile shipped": any(s.endswith("studio/frontend/package-lock.json") for s in n),The job exits non-zero when any check fails, so excluding the lockfile failed wheel-smoke outright. Two of the five reviews found it independently. It is CI-only, not an installed-runtime reader, but it would have gone red on this PR. The assertion dates from the original Studio PR-time CI (#5298) and encodes the old policy. The lockfile is a build input for the Real-server route checkRather than simulating routing in-process, I built the wheel from this branch, The control is the important part. A missing asset does not 404 here: the catch-all at So a status-code-only route check would have passed even if this PR had broken every avatar. Byte comparison is what makes 703/703 meaningful. Second correction
Non-findings worth recording
Final tally across both rounds: 9 SAFE, 1 BREAKS, the BREAKS fixed and its root cause now guarded by the same workflow that caught it. |
The summary at the top still advertised 'lockfile shipped', which is the assertion the previous commit inverted.
|
You have reached your Codex usage limits for security reviews. Please try again later. |
|
Third review round, this time against the actual tip Hunting for a second wheel-smokeThe lockfile assertion was found late and by accident, so one pass was tasked with assuming a third landmine exists: sweep every assertion in all 45 workflow files, all of No second executable assertion requiring an excluded path from inside an installed Unsloth was found. 265 distinct tests passed. The strongest candidate turned out to be a false alarm worth recording: The wheel-smoke fix, executed rather than readBoth artifact-check steps were run verbatim, no substitutions:
The backend import smoke, the CLI-without-structlog check and the lockfile supply-chain audit were also run from the installed wheel, all passing. Resulting artifacts: 46,207,928-byte wheel, 51,526,006-byte sdist. Runtime, reproduced independentlyA separate pass rebuilt at this tip, installed into a fresh venv, started the real app and requested every asset: 703/703 exact byte matches, 0 404s, 0 shell substitutions, and it confirmed the trap fires by requesting Guard tests are not vacuousI mutation-tested the new tests by breaking the tree four ways. Each trips exactly one test, and the tree restores clean:
The One thing to know before merging or reverting
Cumulative across three rounds: 15 review passes, 14 SAFE, 1 BREAKS, the BREAKS fixed and now guarded by the same workflow that caught it. |
|
@codex review |
|
You have reached your Codex usage limits for security reviews. Please try again later. |
|
Codex Review: Didn't find any major issues. Hooray! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
The 2026.9.2 wheel is 82.3MB. 35MB of that is the pre-build frontend tree and the Tauri desktop crate, neither of which an installed Unsloth ever reads.
What was happening
include-package-data = truecombined with setuptools-scm's git file finder hands every tracked file understudio/to the nearest surviving package. Sopackage-datanamingfrontend/dist/**/*and nothing else underfrontend/was never the constraint it looks like, and the wheel carried the whole source tree:studio/frontend/publicfrontend/dist. Vite copiespublic/intodist/duringnpm run build, so every one of them shipped twice.studio/frontend/src.ts/.tsxfiles, already compiled intodist/assets.studio/src-tauritauri buildfrom a checkout.The duplication is exact, not approximate. Comparing CRCs across the two directories in the published wheel: 99 files in
public/, 99 present indist/, 0 differing, 0 unique topublic/.The fix
Veto them in
exclude-package-dataand prune them inMANIFEST.in. Both are needed, for the reason the top ofMANIFEST.inalready documents:python -m buildrebuilds the wheel from the sdist, whereexclude-package-datano longer bites because there is no.gittree for the file finder.src-tauri/iconsis deliberately kept.install.sh:1764and1776readicon.icnsandicon.pngback out ofsite-packages/studio/src-tauri/iconsto build the macOS.icnsand the Linux.desktoplauncher, andtest_installer_shortcut_icons.pyalready pins both topackage-data.Why this does not affect Studio or the desktop release
frontend/distand onlyfrontend/dist(run.py:1725,_DEFAULT_FRONTEND_PATH, plus the site-packages fallbacks at 1746). It still ships in full.frontend/publicreferences in Python are the remoteraw.githubusercontent.comURLs inbackend/colab.py, which are unaffected by packaging.frontend/srcandsrc-taurireference in Python is inside a comment.release-desktop.ymlbuilds the frontend (working-directory: studio/frontend, line 706) and Tauri (line 723) fromactions/checkout, not from the wheel, andtauri.conf.jsonsetsfrontendDist: "../frontend/dist"so the app bundles its own build.studio/backend/utils/_studio_release_build.py(stamp_studio_release.py:45), which nothing here touches, so--verify-diststill passes.Verification
Built locally with a stand-in
frontend/dist, then inspected both artifacts:frontend/public/,frontend/src/,src-tauri/{src,linux,windows,dmg,capabilities}/,frontend/package-lock.json,Cargo.lockfrontend/dist/,src-tauri/icons/icon.icns,src-tauri/icons/icon.png,_studio_release_build.py,backend/vendor/,backend/assets/docs_ui/,backend/plugins/82.3MB to 46.0MB.
Tests
Four regression tests in
test_package_discovery.py, reusing its existing_wheel_payload()simulation, plus an artifact-level check that also assertsfrontend/distis still present, since guarding the exclusion alone would pass just as happily on a wheel with no UI in it at all. One more asserts theMANIFEST.inprunes stay in step withexclude-package-data.One helper fix was needed:
_exclude_package_data()matched single-line arrays only, and every caller reads an empty veto list as "nothing is excluded", so a multi-line entry would have made the simulation quietly disagree with the wheel setuptools actually builds. It now parses withDOTALL.Image assets are the other half of the remaining size and are left for a separate PR.