Document the tool upgrade command (#5947)

This commit is contained in:
Charlie Marsh 2024-08-09 09:19:38 -04:00 committed by GitHub
parent eed23be1bd
commit 7a0b610c19
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 51 additions and 12 deletions

View file

@ -40,33 +40,48 @@ Tool environments are placed in a directory with the same name as the tool packa
Tool environments are _not_ intended to be mutated directly. It is strongly recommended never to
mutate a tool environment manually with a `pip` operation.
Tool environments may be either mutated or re-created by subsequent `uv tool install` operations.
To upgrade a single package in a tool environment:
```console
$ uv tool install black --upgrade-package click
```
Tool environments may be upgraded via `uv tool upgrade`, or re-created entirely via subsequent
`uv tool install` operations.
To upgrade all packages in a tool environment
```console
$ uv tool install black --upgrade
$ uv tool upgrade black
```
To reinstall a single package in a tool environment:
To upgrade a single package in a tool environment:
```console
$ uv tool install black --reinstall-package click
$ uv tool upgrade black --upgrade-package click
```
To reinstall all packages in a tool environment
```console
$ uv tool install black --reinstall
$ uv tool upgrade black --reinstall
```
All tool environment mutations will reinstall the tool executables, even if they have not changed.
To reinstall a single package in a tool environment:
```console
$ uv tool upgrade black --reinstall-package click
```
Tool upgrades will respect the version constraints provided when installing the tool. For example,
`uv tool install black >=23,<24` followed by `uv tool upgrade black` will upgrade Black to the
latest version in the range `>=23,<24`.
To instead replace the version constraints, re-install the tool with `uv tool install`:
```console
$ uv tool install black>=24
```
Similarly, tool upgrades will retain the settings provided when installing the tool. For example,
`uv tool install black --prelease allow` followed by `uv tool upgrade black` will retain the
`--prelease allow` setting.
Tool upgrades will reinstall the tool executables, even if they have not changed.
### Including additional dependencies