Home Programming Article

Python 3.15 Adds Lazy Imports After Three-Year Standards Battle

TL;DR

PEP 810 introduces optional lazy keyword for imports, enabling 50-80% startup time improvements for CLI tools without breaking existing code.

Key Points

  • Instagram achieved 50-80% startup time improvements and 40-90% memory reductions using lazy imports in production
  • Hudson River Trading migrated entire firm to lazy-by-default Python, reducing multi-minute startup times to seconds
  • PEP 810 uses explicit opt-in syntax (lazy import json) with proxy-based implementation, avoiding dict internals changes that blocked PEP 690
  • Steering Council unanimously approved PEP 810 on November 3, 2025; feature ships in Python 3.15 (October 2026)

Why It Matters

Lazy imports solve a real pain point for large Python codebases without fragmenting the ecosystem. Developers can now opt-in to deferred module loading on a per-import basis, dramatically improving CLI responsiveness and reducing memory overhead—all with a single keyword and no code restructuring. This addresses why Meta and HRT felt compelled to fork CPython internally.
Read PEP 810 specification

Source: techlife.blog