@@ -1406,6 +1406,33 @@ confusion about what the default is, or when the ``eager`` keyword would be
14061406necessary, or whether it affects lazy imports *in * the explicitly eagerly
14071407imported module.
14081408
1409+ Allowing the filter to force lazy imports even when globally disabled
1410+ ---------------------------------------------------------------------
1411+
1412+ As lazy imports allow some forms of circular imports that would otherwise
1413+ fail, as an intentional and desirable thing (especially for typing-related
1414+ imports), there was a suggestion to add a way to override the global disable
1415+ and force particular imports to be lazy, for instance by calling the lazy
1416+ imports filter even if lazy imports are globally disabled.
1417+
1418+ This approach could a complex hierarchy of the different "override" systems,
1419+ making it much harder to analyze and reason about the code. Additionally,
1420+ this may require additional complexity to introduce finer-grained systems to
1421+ enable or disable particular imports as the use of lazy imports evolves. The
1422+ global disable is not expected to see commonplace use, but be more of a
1423+ debugging and selective testing tool for those who want to tightly control
1424+ their dependency on lazy imports. We think it's reasonable for package
1425+ mantainers, as they update packages to adopt lazy imports, to decide to
1426+ *not * support running with lazy imports globally disabled.
1427+
1428+ It may be that this means that in time, as more and more packages embrace
1429+ both typing and lazy imports, the global disable becomes mostly unused and
1430+ unusable. Similar things have happened in the past with other global flags,
1431+ and given the low cost of the flag this seems acceptable. It's also easier
1432+ to add more specific re-enabling mechanisms later, when we have a clearer
1433+ picture of real-world use and patterns, than it is to remove a hastily added
1434+ mechanism that isn't quite right.
1435+
14091436Using a context manager instead of a new soft keyword
14101437-----------------------------------------------------
14111438
0 commit comments