Skip to content

[v2] Upgrade prompt-toolkit to 3.0.51 #9552

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 9 commits into
base: v2
Choose a base branch
from
Open

[v2] Upgrade prompt-toolkit to 3.0.51 #9552

wants to merge 9 commits into from

Conversation

hssyoo
Copy link
Contributor

@hssyoo hssyoo commented Jun 17, 2025

Fixes #9453

Upgrades prompt-toolkit ceiling to 3.0.51.

prompt-toolkit began identifying its package version using importlib.metadata [source]. This is increasingly becoming a common pattern so I made a couple long-term decisions to unblock the upgrade.

  • The AWS CLI wraps default import finders in a custom class [source]. This decision was made early in v2 when botocore and s3transfer were vended so that existing code wouldn't need to update its imports. This prevents prompt-toolkit's metadata from being found at build time and runtime. I fixed this by instead inserting the custom wrapped import finder before the default import finder. So imports will continue working as it always has, but if it fails to load metadata, it'll fall back to the default import finder. I think in the long term we should just remove the custom import finder code altogether and make the effort to update imports (eg import botocore -> import awscli.botocore.
  • Package metadata is found in their respective dist.info directories. Our build code was intentionally removing these files from the final distribution because they were unnecessary at the time. I removed that logic since we now need package metadata at runtime.

@hssyoo
Copy link
Contributor Author

hssyoo commented Jun 17, 2025

Okay so prompt-toolkit began identifying its version using importlib.metadata.version [source]. There are 2 issues here..

  1. The AWS CLI looks for certain path finders and wraps them inside a custom path finder [source]. This prevents prompt-toolkit's metadata from being found at build time and runtime.
  2. PyInstaller doesn't copy package metadata by default when building the frozen executable. This prevents prompt-toolkit's metadata from being found at runtime. There's a way to configure this, but I haven't gotten it to work yet [docs].

@hssyoo hssyoo marked this pull request as ready for review July 11, 2025 18:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant