PEP 690: Lazy Imports

With regards to testing, I can’t see how it is much more than adding a lazy-imports toggle to the CI matrix. Perhaps Pytest can learn a command-line flag to run the test suite twice, once with lazy imports.

The point of this PEP is that library authors shouldn’t care about whether lazy imports are enabled, just like right now where libraries don’t care they’re running in a separate thread. The application developer has the authority to enable lazy imports, but also has the responsibility to test the application thoroughly once enabled.

I think preventing application developers from demanding library authors support lazy imports is the social issue that should be addressed.

3 Likes