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

Introduce pipx pin and pipx unpin commands #1291

Merged
merged 28 commits into from
May 24, 2024
Merged

Conversation

dukecat0
Copy link
Member

@dukecat0 dukecat0 commented Mar 17, 2024

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

Summary of changes

Introduce pipx pin and pipx unpin commands, which can be used to pin or unpin the version
of an installed package, so it will not be upgraded by pipx upgrade or pipx upgrade-all.

Closes #891
Closes #802

Test plan

Tested by running

nox -s tests-3.12

@dukecat0 dukecat0 marked this pull request as ready for review March 17, 2024 08:44
Copy link
Contributor

@chrysle chrysle left a comment

Choose a reason for hiding this comment

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

Thanks for submitting this! I wonder whether it would be a valid use case to extend this behaviour to work with injected packages, too?

Another idea: Provide protection from removal for a pipx-installed package by pipx pin via an option.

src/pipx/commands/pin.py Outdated Show resolved Hide resolved
src/pipx/commands/pin.py Outdated Show resolved Hide resolved
@dukecat0
Copy link
Member Author

I wonder whether it would be a valid use case to extend this behaviour to work with injected packages, too?

That sounds like a good idea! Probably I will add a new option for it.

Another idea: Provide protection from removal for a pipx-installed package by pipx pin via an option.

Not sure if it's a common usage, but we can add it in the future if there are requests about this.

@dukecat0
Copy link
Member Author

I wonder whether it would be a valid use case to extend this behaviour to work with injected packages, too?

I am implementing the logic of --injected-packages-only and it will only pin injected packages only instead of main package. (As running pipx pin <package> should prevent both main package and injected packages from upgrading during pipx upgrade-all --include-injected.)

@chrysle
Copy link
Contributor

chrysle commented Mar 23, 2024

I am implementing the logic of --injected-packages-only and it will only pin injected packages only instead of main package.

Sounds good. You don't think one should be able to select which injected package to work with?

@dukecat0
Copy link
Member Author

Yes, forgot to mention it in the above comment. 😅 I will mark this PR as draft first.

@dukecat0 dukecat0 marked this pull request as draft March 23, 2024 09:26
@dukecat0 dukecat0 marked this pull request as ready for review May 21, 2024 10:37
@dukecat0 dukecat0 marked this pull request as draft May 21, 2024 10:38
@dukecat0 dukecat0 marked this pull request as ready for review May 21, 2024 10:57
@dukecat0 dukecat0 requested review from uranusjr and chrysle May 21, 2024 11:10
src/pipx/commands/pin.py Outdated Show resolved Hide resolved
src/pipx/commands/pin.py Show resolved Hide resolved
src/pipx/main.py Outdated Show resolved Hide resolved
src/pipx/main.py Outdated Show resolved Hide resolved
src/pipx/commands/pin.py Outdated Show resolved Hide resolved
src/pipx/commands/upgrade.py Outdated Show resolved Hide resolved
src/pipx/main.py Outdated Show resolved Hide resolved
tests/test_pin.py Outdated Show resolved Hide resolved
dukecat0 and others added 3 commits May 21, 2024 21:54
@dukecat0 dukecat0 requested a review from chrysle May 22, 2024 01:28
@dukecat0
Copy link
Member Author

The failed test seems unrelated to this PR.

@huxuan
Copy link
Contributor

huxuan commented May 22, 2024

The failed test seems unrelated to this PR.

Rerun makes everything OK. :-)

@gaborbernat gaborbernat merged commit 543af21 into pypa:main May 24, 2024
11 checks passed
@dukecat0 dukecat0 deleted the pin branch May 24, 2024 10: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
7 participants