Repository navigation
Conversation
|
FYI, I'm adding a mechanism in pip where we will prevent imports from running after a certain point, before we vendor libraries that use lazy imports we will also need to add a mechanism to resolve all lazy imports and import them: pypa/pip#13829 This is not a blocker for packaging, we vendor packaging and can make sure one doesn't land without the other. But I do believe my approach is best practices for all Python package installers that use the same Python environment they are installing into, so once this lands on pip side I do think we should communicate this to known Python packaging installers that use packaging, before packaging adopts lazy imports. |
|
It seems like a "resolve all lazy imports" function would be really useful - package installers could resolve them all right before installing packages, and still get the benefits of lazy imports for things like The vendoring tool could learn to remove |
|
FYI, I'm now +1 on lazy modules, pip is ready. |
4132036 to
618a013
Compare
|
Two updates (besides the bump in flake8-lazy): this is now maintained by a pre-commit hook, and I'm using the |
|
I’ll rebase. Are we fine with the two changes (set and pre-commit hook)? |
Generated with flake8-lazy 0.10.1 (`--apply list`). Assisted-by: ClaudeCode:claude-opus-5-5
Generated with flake8-lazy 0.10.1 (`--apply set`). Assisted-by: ClaudeCode:claude-opus-5-5
Assisted-by: ClaudeCode:claude-opus-5-5
bc22e7c to
c48354e
Compare
This is the output of
uvx flake8-lazy --apply src/**.py. See post: https://iscinumpy.dev/post/flake8-lazyOpening this as draft for awareness and to get eyes on the changes; it's
possible I've forgotten some or added too many. Probably should wait to put
this in until 3.15b1. It's easy to rerun if there are conflicts in the future.
I don't really know how to test this, other than running a python process and checking to see what's in
sys.modules(which I did locally), or checking-Ximporttime, etc. We don't have a CLI (yet?)) to check import times on.