From a0bca759f362fb1294d41792f77b6c7c3c85749e Mon Sep 17 00:00:00 2001 From: Daniel Han Date: Mon, 30 Mar 2026 02:40:29 -0700 Subject: [PATCH] Fix editable install scanning 6,500+ node_modules dirs (#4697) * fix: scope packages.find to prevent node_modules namespace scanning The packages.find section had no include filter, so setuptools' find_namespace_packages discovered all directories as potential Python packages -- including the 6,557 directories inside studio/frontend/node_modules/ after the frontend build step. This caused the editable install overlay step to run 20,000+ glob operations across 6,619 "packages", which on fast NVMe takes ~5s but on slower disks can take 7+ minutes. Adding an explicit include filter scopes discovery to only the packages we actually ship (unsloth, unsloth_cli, studio, studio.backend), dropping from 6,619 to 58 discovered packages and the editable build time from 5.4s to 1.2s. Also removes the broken kernels/moe exclude (used "/" instead of "." notation so it never matched) and adds a node_modules exclude as a safety net. * fix: use precise node_modules exclude patterns Use "*.node_modules" and "*.node_modules.*" instead of "*.node_modules*" to avoid accidentally excluding valid packages that might contain "node_modules" as a substring in their name. --- pyproject.toml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index e2173d6811..b06131021a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -58,7 +58,8 @@ studio = [ ] [tool.setuptools.packages.find] -exclude = ["images*", "tests*", "kernels/moe*"] +include = ["unsloth*", "unsloth_cli*", "studio", "studio.backend*"] +exclude = ["images*", "tests*", "*.node_modules", "*.node_modules.*"] [project.optional-dependencies] triton = [