Skip to content

Clarify warning for incompletely removed distributions#14047

Open
2ykwang wants to merge 4 commits into
pypa:mainfrom
2ykwang:clarify-leftover-warning
Open

Clarify warning for incompletely removed distributions#14047
2ykwang wants to merge 4 commits into
pypa:mainfrom
2ykwang:clarify-leftover-warning

Conversation

@2ykwang

@2ykwang 2ykwang commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Fixes #11849.

add a distinct warning for ~ -prefixed leftovers, marking them as incompletely removed and safe to delete.

the check uses the metadata directory name instead of the distribution name, since pkg_resources (default on 3.10) turns the leading ~ into -. Open to a different approach.

output:

image

@sepehr-rs

Copy link
Copy Markdown
Member

Hi @2ykwang, thanks for the contribution!
Just a heads-up that pip is a volunteer project, so it may take some time before a maintainer gets to review this.
Appreciate the PR!

@2ykwang

2ykwang commented Jun 12, 2026

Copy link
Copy Markdown
Contributor Author

Thanks @sepehr-rs appreciate it. no rush!

@2ykwang
2ykwang force-pushed the clarify-leftover-warning branch from 522c0f3 to 9d4f429 Compare June 12, 2026 16:19
@2ykwang
2ykwang force-pushed the clarify-leftover-warning branch from 9d4f429 to 153a445 Compare June 12, 2026 16:30

@sepehr-rs sepehr-rs left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you for your contribution!
I tested this locally and the new warning message is more user-friendly. The tests look good too.
I do have one comment on the leftover_name logic that's worth addressing for future releases. Besides that, LGTM from me!
Let me know if you have any questions.

Comment thread src/pip/_internal/metadata/base.py Outdated
@ichard26
ichard26 self-requested a review June 20, 2026 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Better warning message for undeleted temp directories in site-packages

2 participants