CLCODING
Фотография
Python is finally getting explicit lazy imports.
Python 3.15 introduces PEP 810, bringing a language-level mechanism to defer importing modules until they are actually needed.
The idea is simple:
Don't pay the cost of loading a dependency until you use it.
For large Python applications, especially CLI tools, this can make a meaningful difference.
PEP 810 reports:
Up to 50–70% faster startup in some real-world workloads 30–40% lower memory usage observed in some large applications
The biggest gains can come when an application has a large dependency tree but only uses a small portion of it during a particular execution.
This can be especially interesting for modern AI/GenAI applications with dependencies for:
→ LLM providers
→ Vector databases
→ Cloud SDKs
→ Observability
→ Database drivers
→ Optional integrations
One important limitation:
Explicit lazy imports are designed for module scope. They don't replace the traditional technique of importing something inside a function when you specifically nee
2 · 173 ·