Local UI to run and train LLMs and diffusion models. Supports GGUF, MLX, Qwen3.8, DeepSeek-V4.1, MiniMax-H3, Gemma 4, FLUX and more.
Python agentaichatgptdeepseekfine-tuninggemmaimage-generationllamallmllmsopenaipythonqwenreinforcement-learningself-hostedstable-diffusiontext-to-speechttsuiunsloth
Stop shipping the frontend source tree and desktop crate in the wheel (#10426)
Daniel Hanfe1d83c8a583
diff --git a/.github/workflows/wheel-smoke.yml b/.github/workflows/wheel-smoke.ymlindex 41bab003cd8..f48ecde63df 100644--- a/.github/workflows/wheel-smoke.yml+++ b/.github/workflows/wheel-smoke.yml@@ -9,7 +9,8 @@# Verified locally end-to-end against this branch:# - python -m build produces unsloth-<version>-py3-none-any.whl in 13s# - wheel content sanity passes:-# lockfile shipped, frontend dist shipped,+# frontend dist shipped, and none of the pre-build tree with it:+# no package-lock, no frontend public, no frontend src,# no node_modules in wheel, no bun.lock in wheel,# main bundle has unstable_Provider hits=1 (assistant-ui internals only).# - Unsloth backend imports cleanly from the installed wheel with the@@ -98,7 +99,12 @@ jobs:with zipfile.ZipFile(w) as z:n = z.namelist()checks = {- "lockfile shipped": any(s.endswith("studio/frontend/package-lock.json") for s in n),+ # The lockfile used to be asserted PRESENT. It is a build input for+ # `npm ci` above, not something an installed Unsloth reads, so it now+ # has to be absent along with the rest of the pre-build tree.+ "no package-lock": not any(s.endswith("studio/frontend/package-lock.json") for s in n),+ "no frontend public": not any("studio/frontend/public/" in s for s in n),+ "no frontend src": not any("studio/frontend/src/" in s for s in n),"frontend dist shipped": any(s.endswith("studio/frontend/dist/index.html") for s in n),"no node_modules": not any("studio/frontend/node_modules/" in s for s in n),"no bun.lock": not any(s.endswith("studio/frontend/bun.lock") for s in n),diff --git a/MANIFEST.in b/MANIFEST.inindex c8da64c7502..7ced62425be 100644--- a/MANIFEST.in+++ b/MANIFEST.in@@ -11,6 +11,35 @@ prune studio/frontend/testsprune unsloth_cli/testsprune unsloth/kernels/moe/tests+# Frontend pre-build tree. public/ is copied into frontend/dist by Vite, so+# shipping both put all 99 of its files in the wheel twice; src/ is .tsx that is+# already compiled into dist/assets. Only frontend/dist is served at runtime.+# Keep these in step with exclude-package-data in pyproject.toml. That entry is+# what actually keeps them out of the wheel, including the wheel `python -m build`+# rebuilds from the sdist; these prunes keep them out of the sdist itself, so the+# two artifacts agree and neither carries a tree nothing installs.+prune studio/frontend/public+prune studio/frontend/src+exclude studio/frontend/package-lock.json++# Desktop crate. `tauri build` reads these from a git checkout in+# release-desktop.yml, never from the published wheel. src-tauri/icons is+# deliberately absent here: install.sh copies icon.icns and icon.png out of+# site-packages to build the macOS and Linux launchers.+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+# `prune` only takes directories, so the crate's root files need naming. Without+# these the sdist still carried Cargo.lock and the tauri*.json configs even though+# exclude-package-data kept them out of the wheel.+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+# Backstop for a suite added anywhere else later. `prune` and a `*` glob are both# single-level, so this needs `**`, and it cannot see a root-level tests/ at all.global-exclude */tests/**diff --git a/install.sh b/install.shindex 70a8262e138..f8ba55d76eb 100755--- a/install.sh+++ b/install.sh@@ -1745,8 +1745,13 @@ LAUNCHER_EOF# Try to find rounded-512.png from installed package (site-packages) or local repo_css_found_icon=""_css_venv_dir=$(dirname "$(dirname "$_css_exe")")- # Check site-packages- for _sp in "$_css_venv_dir"/lib/python*/site-packages/unsloth/studio/frontend/public; do+ # Check site-packages. `studio` is a top-level package in the wheel (see+ # top_level.txt), not a subpackage of `unsloth`, so the old+ # site-packages/unsloth/studio/... glob never matched and every install fell+ # through to the network download below. Read it out of frontend/dist rather+ # than 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.+ for _sp in "$_css_venv_dir"/lib/python*/site-packages/studio/frontend/dist; doif [ -f "$_sp/rounded-512.png" ]; then_css_found_icon="$_sp/rounded-512.png"fidiff --git a/pyproject.toml b/pyproject.tomlindex cf6077d97b9..e5aa22a4872 100644--- a/pyproject.toml+++ b/pyproject.toml@@ -98,6 +98,41 @@ exclude = [[tool.setuptools.exclude-package-data]"studio.backend" = ["tests/*"]"studio.backend.hub" = ["tests/*"]+# Same mechanism, applied to the frontend source tree. package-data above names+# `frontend/dist/**/*` and nothing else under frontend/, but include-package-data+# plus setuptools-scm's git file finder ships every tracked file under studio/+# anyway, so the wheel carried the whole pre-build tree:+#+# frontend/public 31.1MB compressed, and every one of its 99 files is already+# in frontend/dist byte for byte, because Vite copies public/+# into dist/ during `npm run build`. Pure duplication.+# frontend/src 4.0MB of .ts/.tsx that nothing imports at runtime.+#+# Neither path is read from an installed Unsloth: run.py mounts frontend/dist+# (_DEFAULT_FRONTEND_PATH) and the only `frontend/public` references in Python are+# the remote raw.githubusercontent URLs in backend/colab.py. The desktop app is+# unaffected either way, since release-desktop.yml builds both the frontend and+# Tauri from a git checkout, not from this wheel.+#+# src-tauri is the desktop crate: Rust sources plus NSIS/AppImage/dmg installer+# branding, all consumed by `tauri build` in CI from the checkout. icons/ is the+# exception and stays, because install.sh reads icon.icns and icon.png back out of+# site-packages/studio/src-tauri/icons to build the macOS and Linux launchers.+"studio" = [+ "frontend/public/**",+ "frontend/src/**",+ "frontend/package-lock.json",+ "src-tauri/src/**",+ "src-tauri/linux/**",+ "src-tauri/windows/**",+ "src-tauri/dmg/**",+ "src-tauri/capabilities/**",+ "src-tauri/Cargo.lock",+ "src-tauri/Cargo.toml",+ "src-tauri/build.rs",+ "src-tauri/*.plist",+ "src-tauri/tauri*.json",+][project.optional-dependencies]# Unsloth's server stack, mirroring studio/backend/requirements/studio.txt.diff --git a/tests/studio/install/test_package_discovery.py b/tests/studio/install/test_package_discovery.pyindex 7fe328c46bb..05a10fc1f17 100644--- a/tests/studio/install/test_package_discovery.py+++ b/tests/studio/install/test_package_discovery.py@@ -32,12 +32,18 @@ def _exclude_package_data():assert len(section) == 2, "no exclude-package-data table in pyproject.toml"body = section[1].split("\n[", 1)[0]table = {}- for line in body.splitlines():- entry = re.match(r'^\s*"?([\w.*]+)"?\s*=\s*\[(.*?)\]\s*$', line)- if entry:- # "*" is setuptools' pyproject spelling of the all-packages key.- key = "" if entry.group(1) == "*" else entry.group(1)- table[key] = re.findall(r'["\']([^"\']+)["\']', entry.group(2))+ # DOTALL so a value spread over several lines is read whole. Matching only+ # single-line arrays would silently return {} for a multi-line entry, and every+ # caller reads an empty veto list as "nothing is excluded", so the simulation+ # would disagree with the wheel setuptools actually builds.+ for entry in re.finditer(+ r'^\s*"?([\w.*]+)"?\s*=\s*\[(.*?)\]',+ body,+ re.MULTILINE | re.DOTALL,+ ):+ # "*" is setuptools' pyproject spelling of the all-packages key.+ key = "" if entry.group(1) == "*" else entry.group(1)+ table[key] = re.findall(r'["\']([^"\']+)["\']', entry.group(2))return table@@ -115,6 +121,79 @@ def test_backend_test_suites_stay_out_of_the_wheel():assert not leaked, f"{len(leaked)} backend test files would ship, e.g. {leaked[:3]}"+def test_frontend_source_tree_stays_out_of_the_wheel():+ # public/ is copied into frontend/dist by Vite, so without the veto every one of+ # its files shipped twice, and src/ is .tsx that is already compiled into+ # dist/assets. Together they were 35MB of an 82MB wheel in 2026.9.2.+ shipped = _wheel_payload()+ leaked = [+ path+ for path in shipped+ if path.startswith(("studio/frontend/public/", "studio/frontend/src/"))+ ]+ assert not leaked, f"{len(leaked)} frontend source files would ship, e.g. {leaked[:3]}"+++def test_desktop_crate_sources_stay_out_of_the_wheel():+ # `tauri build` reads these from a git checkout in release-desktop.yml. Only+ # src-tauri/icons is needed from an installed Unsloth, by install.sh.+ leaked = [+ path+ for path in _wheel_payload()+ if path.startswith("studio/src-tauri/") and not path.startswith("studio/src-tauri/icons/")+ ]+ assert not leaked, f"{len(leaked)} desktop crate files would ship, e.g. {leaked[:3]}"+++def test_installer_icons_survive_the_src_tauri_exclusion():+ # install.sh copies both out of site-packages/studio/src-tauri/icons to build the+ # macOS .icns and the Linux .desktop launcher, so the exclusion above must not+ # take the whole directory with it.+ shipped = set(_wheel_payload())+ for path in (+ "studio/src-tauri/icons/icon.icns",+ "studio/src-tauri/icons/icon.png",+ ):+ assert path in shipped, f"{path} must stay in the wheel for install.sh"+++def test_built_wheel_has_no_frontend_source():+ """Artifact-level check, run when a wheel has already been built."""+ wheels = sorted((REPO_ROOT / "dist").glob("unsloth-*.whl"))+ if not wheels:+ pytest.skip("no built wheel in dist/, run `python -m build --wheel` first")+ names = zipfile.ZipFile(wheels[-1]).namelist()+ leaked = [n for n in names if n.startswith(("studio/frontend/public/", "studio/frontend/src/"))]+ assert not leaked, f"{wheels[-1].name} ships {len(leaked)} frontend source files"+ # The served frontend must still be there. Guarding the exclusion alone would+ # pass just as happily on a wheel with no UI in it at all.+ assert any(+ n.startswith("studio/frontend/dist/") for n in names+ ), f"{wheels[-1].name} ships no frontend/dist; the UI would 404"+++def test_manifest_prunes_match_exclude_package_data():+ """The two vetoes have to name the same paths, for different artifacts.++ exclude-package-data is what keeps these out of the WHEEL, and it keeps+ working in the sdist -> wheel rebuild `python -m build` performs: 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. These prunes are what keep them out of the SDIST+ itself, so neither artifact carries a tree nothing installs.+ """+ manifest = (REPO_ROOT / "MANIFEST.in").read_text(encoding = "utf-8")+ for path in (+ "studio/frontend/public",+ "studio/frontend/src",+ "studio/src-tauri/src",+ ):+ assert f"prune {path}\n" in manifest, f"MANIFEST.in must prune {path}"+ assert (+ "prune studio/src-tauri/icons" not in manifest+ ), "src-tauri/icons is read from site-packages by install.sh; do not prune it"++def test_backend_runtime_still_ships():shipped = set(_wheel_payload())for path in ("studio/backend/main.py", "studio/backend/hub/__init__.py"):