Skip to content
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

Avoid reinstalling injected package without --force #1305

Merged
merged 8 commits into from
Mar 30, 2024

Conversation

huxuan
Copy link
Member

@huxuan huxuan commented Mar 27, 2024

  • I have added a news fragment under changelog.d/ (if the patch affects the end users)

Summary of changes

Fix #1300

Test plan

Tested by running

> pipx install pycowsay
  installed package pycowsay 0.0.0.2, installed using Python 3.10.12
  These apps are now globally available
    - pycowsay
  These manual pages are now globally available
    - man6/pycowsay.6
done! ✨ 🌟 ✨
> pipx inject pycowsay cowsay
  injected package cowsay into venv pycowsay
done! ✨ 🌟 ✨
> pipx inject pycowsay cowsay
cowsay already seems to be injected in 'pycowsay'. Not modifying existing installation in '/usr/local/pipx/venvs/pycowsay'. Pass '--force' to force installation.
> pipx inject pycowsay cowsay --force
  injected package cowsay into venv pycowsay
done! ✨ 🌟 ✨

@chrysle chrysle changed the title Avoid installing existed injected package without --force Avoid reinstalling injected package without --force Mar 27, 2024
changelog.d/1300.bugfix.md Outdated Show resolved Hide resolved
src/pipx/commands/inject.py Show resolved Hide resolved
src/pipx/commands/inject.py Outdated Show resolved Hide resolved
src/pipx/commands/inject.py Outdated Show resolved Hide resolved
huxuan and others added 5 commits March 27, 2024 15:22
Co-authored-by: chrysle <fritzihab@posteo.de>
Co-authored-by: chrysle <fritzihab@posteo.de>
Co-authored-by: chrysle <fritzihab@posteo.de>
@huxuan huxuan requested a review from chrysle March 27, 2024 07:26
chrysle
chrysle previously approved these changes Mar 27, 2024
@chrysle
Copy link
Contributor

chrysle commented Mar 27, 2024

Looks like you need to fix a test..

@huxuan
Copy link
Member Author

huxuan commented Mar 28, 2024

Looks like you need to fix a test..

Sorry for the test broken, I should test it locally.

The test case try to inject isort into pylint [1] but actually isort is already a dependency of pylint [2], that is why isort is not injected. So maybe I should change the test case? Since the injection is meaningless.

[1]

assert not run_pipx_cli(["inject", "pylint", PKG["isort"]["spec"]])

[2] https://github.com/pylint-dev/pylint/blob/10a093ea85f8cb2a3268f439c3b1f40319023956/pyproject.toml#L45

@huxuan
Copy link
Member Author

huxuan commented Mar 28, 2024

Hi @chrysle, I fixed the test by changing isort to black, all local tests passed. PTAL :-)

image

@huxuan huxuan requested a review from chrysle March 28, 2024 05:49
@chrysle chrysle enabled auto-merge (squash) March 30, 2024 13:36
@chrysle chrysle merged commit 8fbc085 into pypa:main Mar 30, 2024
14 checks passed
@chrysle
Copy link
Contributor

chrysle commented Mar 30, 2024

Thank you!

@huxuan huxuan deleted the xuan.hu/fix-inject-force branch April 11, 2024 05:07
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.

inject command does not respect "--force" option
2 participants