Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork34.2k
RefactorPlatforms/WASI/__main__.py for lazy importing and future new subcommands#145404
RefactorPlatforms/WASI/__main__.py for lazy importing and future new subcommands#145404brettcannon wants to merge 11 commits intopython:mainfrom
Platforms/WASI/__main__.py for lazy importing and future new subcommands#145404Conversation
Along the way, support lazy importing.
Uh oh!
There was an error while loading.Please reload this page.
hugovk commentedMar 2, 2026
Ruff and isort issues:
Although this PR is using |
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Uh oh!
There was an error while loading.Please reload this page.
hugovk commentedMar 2, 2026
Now we have this duplicate: -id:ruff-checkname:Run Ruff (lint) on Tools/build/args:[--exit-non-zero-on-fix, --config=Tools/build/.ruff.toml]files:^Tools/build/ -id:ruff-checkname:Run Ruff (lint) on Tools/build/args:[--exit-non-zero-on-fix, --config=Tools/build/.ruff.toml]files:^Tools/build/ |
brettcannon commentedMar 2, 2026
Correct! (The initial version did, but I realized backporting would not be fun with Maybe that will help define what to do with |
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
When you're done making the requested changes, leave the comment: |
brettcannon commentedMar 4, 2026
I have made the requested changes; please review again. |
Thanks for making the requested changes! @savannahostrowski,@hugovk: please review the changes made to this pull request. |
Everything related to the
buildsubcommand & friends has been moved into a_buildmodule which is now lazily imported in__main__which now only handles argparse. This did require tweaking what the defaults are in the argument parser so that it didn't trigger needing to import_build. It also required changing dispatching to subcommands from a dict to amatchstatement to also avoid triggering the import of_build. As well, all imports in_buildthat are not needed for every subcommand has also been made lazy. Since neither PEP 8 or Ruff/Black have decided how to sort lazy imports, they are interleaved and imports are sorted by name as if thelazyaspect of the statement wasn't there.This work also sets things up so that any future subcommands can go into their own module and also be lazily imported into
__main__.