If you're building Python executables with PyInstaller, Nuitka, or cx_Freeze and fighting bloated file sizes, this is worth knowing about. It analyzes your import graph with AST parsing to identify dependencies that get bundled but never actually run, then generates minimal stub replacements. The analyze tool detects stubbable packages and flags try-except protected imports for nofollow treatment. The generate and generate_submodule tools create stub code and build instructions with backup commands. One verified case stripped PySide6 from an asammdf build by stubbing the gui submodule, dropping the exe from 431MB to 259MB with zero runtime breakage. It won't catch dynamic imports or handle pip-to-import name mismatches, but the algorithm errs toward safety, marking ambiguous cases as required rather than risking a broken build.
claude mcp add --transport stdio io.github.koyoyeager-pystub uvx pystub