The Story of Python's Lazy Imports: Why It Took Three Years and Two Attempts

From PEP 690's rejection to PEP 810's unanimous acceptance — how Python finally got explicit lazy imports after three years of real-world production evidence and a fundamental design inversion

TechLife

> Why did you choose `lazy` as the keyword name?
> Not “why”… memorize! :)

  https://peps.python.org/pep-0810/

#Python #PEP810 #Python315 #Sugi

PEP 810 – Explicit lazy imports | peps.python.org

This PEP introduces syntax for lazy imports as an explicit language feature:

Python Enhancement Proposals (PEPs)

Lazy imports are coming to Python :tada:

PEP 810: Explicit lazy imports - PEPs - Discussions on Python.org
https://discuss.python.org/t/pep-810-explicit-lazy-imports/104131/466

#python #pep810 #lazyimports

PEP 810: Explicit lazy imports

Dear PEP 810 authors. The Steering Council is happy to unanimously[1] accept “PEP 810, Explicit lazy imports”. Congratulations! We appreciate the way you were able to build on and improve the previously discussed (and rejected) attempt at lazy imports as proposed in PEP 690. We have recommendations about some of the PEP’s details, a few suggestions for filling a couple of small gaps, and we have made decisions on the alternatives that you’ve left to the SC, all of which I’ll outline below. ...

Discussions on Python.org

The Steering Council has accepted PEP 810 (explicit lazy imports) for Python 3.15!

https://discuss.python.org/t/pep-810-explicit-lazy-imports/104131/466

#Python #PEP810 #LazyImports #lazy #Python315

PEP 810: Explicit lazy imports

Dear PEP 810 authors. The Steering Council is happy to unanimously[1] accept “PEP 810, Explicit lazy imports”. Congratulations! We appreciate the way you were able to build on and improve the previously discussed (and rejected) attempt at lazy imports as proposed in PEP 690. We have recommendations about some of the PEP’s details, a few suggestions for filling a couple of small gaps, and we have made decisions on the alternatives that you’ve left to the SC, all of which I’ll outline below. ...

Discussions on Python.org

I benchmarked `--help` on one of my CLIs with the reference implementation for PEP 810 (Explicit lazy imports).

Because my CLI already does the "inline imports" thing of moving them into functions just before they get used, I got a speedup of x1.3.

Then I moved all the imports to the top like normal, and got a speedup of x2.9!

https://hugovk.dev/blog/2025/lazy-imports/
#Python #Python315 #PEP810 #LazyImports #lazy

Three times faster with lazy imports

Hugo van Kemenade
PEP 810 – Explicit lazy imports | peps.python.org

This PEP introduces lazy imports as an explicit language feature. Currently, a module is eagerly loaded at the point of the import statement. Lazy imports defer the loading and execution of a module until the first time the imported name is used.

Python Enhancement Proposals (PEPs)