Hello,

PEP 690 is now live! It proposes an exciting new feature to transparently defer the execution of imported modules until the moment when an imported object is used. Since Python programs commonly import many more modules than a single invocation of the program is likely to use in practice, lazy imports can greatly reduce the overall number of modules loaded, improving startup time and memory usage.

At Meta, we have implemented this feature in Cinder, and has already demonstrated startup time improvements up to 70% and memory-use reductions up to 40% on real-world Python CLIs, while also eliminating the risk for most import cycles.

Please, don't reply to this message. Feel free to comment or share thoughts and feedback in Python Discourse at https://discuss.python.org/t/pep-690-lazy-imports.

Best,
Germán

---

Relevant links follow:

https://peps.python.org/pep-0690
https://github.com/facebookincubator/cinder
https://github.com/facebookincubator/cinder/blob/cinder/3.8/CinderDoc/lazy_imports.rst
https://discuss.python.org/t/pep-690-lazy-imports