`_get_exposed_apps_for_package` and `pipx uninstall` should use metadata to determine apps
See original GitHub issueDescribe the bug
As detailed in #548 by @jwodder (https://github.com/pipxproject/pipx/issues/548#issuecomment-733831958):
I believe I know whatβs going on. I just stumbled upon this behavior and was about to file a bug report.
The problem is: When pipx installs package foo that depends on bar that has an entry point bar-cmd, if a bar-cmd program already exists in
PIPX_BIN_DIR(e.g., if bar is already installed at the user level), then bar-cmd will be listed as a pipx-installed command in the output frompipx installandpipx listeven though it is not. Fortunately, pipx has enough sense to not delete bar-cmd whenpipx uninstall foois run, which suggests that it can tell whether a given command is managed by pipx, itβs just not doing it in all cases.
This may only be happening for Windows and other filesystems that pipx thinks have no symlinks. EDIT: This seems to occur anytime there are non-symlinked files inside of ~/.local/bin, which can happen either through pipx or through other tools like pip install --user that install to that directory.
Since the code that examines the binary directory was likely implemented before we had metadata in pipx, we should use our available metadata now to make app attribution more robust.
How to reproduce
On Windows:
> pipx install textract
done!
creating virtual environment...
installing textract...
installed package textract 1.6.3, Python 3.9.0
These apps are now globally available
- textract
> pipx install organize-tool
done!
creating virtual environment...
installing organize-tool...
installed package organize-tool 1.9.1, Python 3.9.0
These apps are now globally available
- organize.exe
- textract
>
Expected behavior
textract should not be listed as an organize-tool app, because it is a dependency of organize-tool and organize-tool was not installed using --include-deps.
Issue Analytics
- State:
- Created 3 years ago
- Comments:8 (5 by maintainers)

Top Related StackOverflow Question
Hereβs a transcript from reproducing the bug on Docker:
OH, I see. Because you are installing
keyringoutside of pipx, those apps do not get symlinks, even though you are on a symlink-capable system. Therefore when pipx scans the~/.local/bindirectory and sees those apps without links, it falls back on the βbadβ way of attributing apps.Got it. Ok this all makes sense.