Lazy imports made our CLI 4× faster — but barely helped the TUI or MCP server
Adopting Python 3.15's lazy imports: a 4× faster CLI, and where they didn't help

After moving a back office to Python 3.15.2, the team applied PEP 810 lazy imports across six pull requests. A static gate built on Meta's Lifeguard analyzer decided which imports were safe to defer, and tests forced the package's own lazy statements eager to preserve patching. CLI --help dropped from 1,314 ms to 326 ms, but the TUI improved only 20 percent and the MCP server 15 percent, since most of their remaining cost is Textual and FastMCP.
The CLI's --help became four times faster. It no longer loads DuckDB, Jinja2, markdown-it, PyYAML, httpx2 or rcssmin, and a subprocess test pins that list, so an import that brings one back fails the suite.