Skip to content

Commit f2feb36

Browse files
authored
Merge branch 'main' into gh-1572-pipx-install-upgrade
2 parents e18c44f + cf06cb9 commit f2feb36

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed

docs/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,18 @@ pipx inject ipython matplotlib pandas
265265
pipx inject ipython -r useful-packages.txt
266266
```
267267

268+
### Pin installed packages
269+
270+
Use `pipx pin` when you need to hold an installation at its current version. Pinned packages are skipped by `pipx upgrade`, `pipx upgrade-all`, and `pipx reinstall`, so the environment keeps its existing app and dependency versions until you unpin it.
271+
272+
- `pipx pin PACKAGE` pins the main package and any injected packages in that virtual environment.
273+
- `pipx pin PACKAGE --injected-only` leaves the main package upgradable but pins every injected package instead.
274+
- `pipx pin PACKAGE --skip PKG_A PKG_B` pins injected packages except the ones you list (the flag implies `--injected-only`).
275+
- `pipx unpin PACKAGE` re-enables upgrades for the package and anything that was pinned with it.
276+
- `pipx list --pinned` shows every pinned environment; add `--include-injected` to see pinned injected packages.
277+
278+
pipx tracks the main package and any injected packages. It does not record individual transitive dependencies, so there is no way to pin a single dependency in isolation. Pinning the main package protects its dependency set because pipx skips running `pip install --upgrade` for that environment.
279+
268280
### Walkthrough: Running an Application in a Temporary Virtual Environment
269281

270282
This is an alternative to `pipx install`.

docs/examples.md

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,3 +187,45 @@ This example pins `pip` (temporarily, until the next automatic upgrade, if that
187187
```shell
188188
> pipx upgrade-shared --pip-args=pip==24.0
189189
```
190+
191+
## `pipx pin` examples
192+
193+
Pinning keeps an installation at its current version until you call `pipx unpin`.
194+
195+
Pin the entire environment (main package plus anything injected):
196+
197+
```shell
198+
> pipx install httpie
199+
> pipx pin httpie
200+
> pipx list --pinned
201+
httpie <current version>
202+
```
203+
204+
Pin only injected packages so the main package can continue to receive upgrades:
205+
206+
```shell
207+
> pipx inject poetry poetry-plugin-export poetry-plugin-app
208+
> pipx pin poetry --injected-only
209+
Pinned 2 packages in venv poetry
210+
- poetry-plugin-export <current version>
211+
- poetry-plugin-app <current version>
212+
```
213+
214+
Skip selected injected packages when pinning:
215+
216+
```shell
217+
> pipx inject pdm pdm-django pdm-pytorch
218+
> pipx pin pdm --skip pdm-django
219+
Pinned 1 packages in venv pdm
220+
- pdm-pytorch <current version>
221+
```
222+
223+
Unpin everything so upgrades resume:
224+
225+
```shell
226+
> pipx unpin poetry
227+
Unpinned 2 packages in venv poetry
228+
- poetry
229+
- poetry-plugin-export
230+
- poetry-plugin-app
231+
```

0 commit comments

Comments
 (0)