Talk

Walking through PEP 810: Lazy Imports

Friday, May 29

15:45 - 16:15
RoomGnocchi
LanguageEnglish
Audience levelBeginner
Elevator pitch

Slow startup times are often the “death by a thousand imports.” This talk explores PEP 810 wich brings native Lazy Imports to Python. Learn how deferring module loading can optimize your applications, the technical details of the implementation, and the trade-offs involved.

Abstract

In large-scale Python applications and CLI tools, the overhead of importing numerous modules can lead to frustratingly slow startup times. PEP 810 proposes a formal mechanism for Lazy Imports, allowing the Python interpreter to defer the actual loading of a module until the moment it is first accessed.

This talk provides a deep dive into the mechanics of PEP 810. We will explore:

  • The current challenges of the Python import system.
  • How the proposed lazy keyword and transparent deferred loading work under the hood.
  • The performance implications for application startup and memory usage.
  • Potential “gotchas,” such as delayed ImportError exceptions and side effects.

Whether you are a library maintainer or a performance-focused developer, this session will help you understand how this proposed change could reshape the way we manage dependencies in Python.

TagsPython language features
Participant

Antonio Spadaro