AST inspection mode.
bswck opened this issue · 1 comments
bswck commented
Use case
Instead of trying to look for a finder eagerly, completely defer the entire machinery logic until the first access.
It might be achieved if we analyze import nodes inside the LAZY_IMPORTING
block, which we can obtain from retrieving the source code of the previous frame using executing
or backframe
.
Example usage
No response
Additional context
No response
bswck commented
This would require some really advanced logic for handling cases like
from lazy_importing import LAZY_IMPORTING
if LAZY_IMPORTING:
import sys
if sys.version_info >= (3, 12):
import tomllib
else:
import tomli as tomllib