Skip to content

[v2] Implement lazy plugin initialization#10356

Open
aemous wants to merge 2 commits into
lazy-plugin-initializationfrom
pr/lazy-plugins
Open

[v2] Implement lazy plugin initialization#10356
aemous wants to merge 2 commits into
lazy-plugin-initializationfrom
pr/lazy-plugins

Conversation

@aemous
Copy link
Copy Markdown
Contributor

@aemous aemous commented May 27, 2026

Issue #, if available:

Notes:

  • This PR (4/4) is part of an ongoing effort to reduce AWS CLI initialization time by lazily deferring plugins until they are needed. This PR uses the constructs introduced in previous PRs to lazily import plugins when they are needed (event emission time, command invocation time, and/or help docs generation time).

Description of changes:

  • Switch from using HierarchicalEmitter to LazyInitEmitter to facilitate lazy plugin loading.
  • Delete handlers.py and load plugin registry from plugin.py.
  • Update exe/pyinstaller/hook-awscli.py, to dynamically import builtin plugin modules from the plugin registry.
  • Update a few functional/unit tests that previously used register() against events, to use register_last() instead. This is required for the tests to pass, because previously the tests would register after the builtin handlers in botocore, but since switching to lazy initialization, the test code would run before the boto handlers are executed.
  • Add tests that improve test coverage on the lazy plugin initialization components.
  • Add clarifying comments to tests/unit/test_lazy_emitter.py.
  • Add changelog entry.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@aemous aemous requested a review from a team May 27, 2026 16:02
@aemous aemous added v2 performance This PR or issue is related to performance. labels May 27, 2026
@aemous aemous changed the title [v2] Implement lazy plugin initialization. [v2] Implement lazy plugin initialization May 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

performance This PR or issue is related to performance. v2

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant