Skip to content

[v2] Implement LazyCommand for deferring modules until their commands are invoked, and make PrefixTrie public#10299

Merged
aemous merged 5 commits into
lazy-plugin-initializationfrom
pr/prefix-trie-lazy-command
May 13, 2026
Merged

[v2] Implement LazyCommand for deferring modules until their commands are invoked, and make PrefixTrie public#10299
aemous merged 5 commits into
lazy-plugin-initializationfrom
pr/prefix-trie-lazy-command

Conversation

@aemous
Copy link
Copy Markdown
Contributor

@aemous aemous commented May 11, 2026

Issue #, if available:

Notes:

  • This PR is part of an ongoing effort to reduce AWS CLI initialization time by lazily deferring plugins until they are needed. This PR makes an existing PrefixTrie implementation public, which will be used in a future PR to efficiently model a plugin event-dependency registry. Also, it implements LazyCommand, which will be used in a future PR to automatically defer plugin imports for plugins that add custom commands to AWS CLI.

Description of changes:

  • Switched PrefixTrie from a private interface to a public interface (i.e. rename _PrefixTrie to PrefixTrie).
  • Implemented unit tests for the PrefixTrie class.
  • Implemented new LazyCommand class, which can wrap CLICommand instances and defer importing or invoking them until the command is called.
  • Implemented unit and functional tests for the LazyCommand class.

Description of tests:

  • Successfully ran all test suites and pre-production build workflow (see GitHub CI).

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 added v2 performance This PR or issue is related to performance. labels May 11, 2026
@aemous aemous changed the title [v2] [v2] Implement LazyCommand for deferring modules until their commands are invoked, and make PrefixTrie public May 11, 2026
@aemous aemous requested a review from a team May 11, 2026 17:57
@aemous aemous marked this pull request as ready for review May 11, 2026 18:02
@aemous aemous force-pushed the pr/prefix-trie-lazy-command branch from f6197f4 to 494bd6a Compare May 11, 2026 20:31
Copy link
Copy Markdown
Contributor

@hssyoo hssyoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small nit that I don't mind addressing in a followup.

Comment thread tests/unit/botocore/test_hooks.py Outdated
@aemous aemous requested a review from hssyoo May 13, 2026 15:20
@aemous aemous merged commit a454da3 into lazy-plugin-initialization May 13, 2026
108 of 109 checks passed
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.

2 participants