Refactor Platforms/WASI/__main__.py for lazy importing and future new subcommands#145404
Open
brettcannon wants to merge 9 commits intopython:mainfrom
Open
Refactor Platforms/WASI/__main__.py for lazy importing and future new subcommands#145404brettcannon wants to merge 9 commits intopython:mainfrom
Platforms/WASI/__main__.py for lazy importing and future new subcommands#145404brettcannon wants to merge 9 commits intopython:mainfrom
Conversation
Along the way, support lazy importing.
hugovk
approved these changes
Mar 2, 2026
Member
Ruff and isort issues:
Although this PR is using |
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
hugovk
reviewed
Mar 2, 2026
Member
|
Now we have this duplicate: - id: ruff-check
name: Run Ruff (lint) on Tools/build/
args: [--exit-non-zero-on-fix, --config=Tools/build/.ruff.toml]
files: ^Tools/build/
- id: ruff-check
name: Run Ruff (lint) on Tools/build/
args: [--exit-non-zero-on-fix, --config=Tools/build/.ruff.toml]
files: ^Tools/build/ |
hugovk
approved these changes
Mar 2, 2026
Member
Author
Correct! (The initial version did, but I realized backporting would not be fun with Maybe that will help define what to do with |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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__.