Termsslug: lazy-import

Lazy Import

惰性导入

A deferred loading mechanism that executes module imports only when symbols are actually used, reducing startup time and memory

Curated Intelligence

2 items · Page 1/1
Hacker News AIT2·Tools
58 pts
Python 3.15 Lazy Imports Cut CLI Startup Time by 4x

The team migrated its back office to Python 3.15.2 and used PEP 810 lazy imports to make the CLI's --help roughly 4x faster, down from about 1.3 seconds. The post details six pull requests, a safety gate built before deferring any import, cases where lazy imports are not actually lazy, and why the TUI and MCP server entry points improved far less than the CLI.

Simon Willison 博客T2·Tools
68 pts
Python 3.15 Release Introduces Explicit Lazy Imports to Optimize LLM Plugin Loading and Dependency Management

Python 3.15 has been released, featuring explicit lazy imports via PEP 810 that defer module loading until first use. This significantly improves startup performance for projects with heavy dependencies, such as LLM CLI tools, while signaling the end of support for Python 3.10 and enabling developers to fully leverage features from version 3.11 onwards.