You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/posts/2025/2025-08-26-python-uv-cheat-sheet.md
+14-3Lines changed: 14 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ categories:
10
10
comments: true
11
11
date:
12
12
created: 2025-08-26
13
-
updated: 2025-09-07
13
+
updated: 2025-10-04
14
14
---
15
15
16
16
# Python uv cheat sheet
@@ -391,9 +391,20 @@ Skipping bytecode compilation can be undesirable in workflows; for example, we r
391
391
392
392
## Upgrade packages and uv.lock
393
393
394
-
The only way to change the package version constraints is to edit manually the `pyproject.toml` file directly. After making changes to `pyproject.toml`, you should run `uv sync` to update the venv dependencies and the `uv.lock` file accordingly. Or `uv lock` to update only the `uv.lock` file without changing the venv dependencies.
394
+
### Upgrade pyproject.toml
395
395
396
-
[`uv.lock` file](https://docs.astral.sh/uv/concepts/projects/layout/#the-lockfile) can be updated by `uv lock`, `uv sync`, `uv run`, `uv add`, `uv remove`.
396
+
The only way to change the package version constraints is to edit manually the `pyproject.toml` file directly.
397
+
After making changes to `pyproject.toml`, you should run `uv sync` to upgrade the venv dependencies and the `uv.lock` file accordingly.
398
+
Or `uv lock` to upgrade only the `uv.lock` file without changing the venv dependencies.
399
+
400
+
!!! note "other semi-automatic ways to upgrade pyproject.toml"
401
+
Beside above mentioned manual edit of `pyproject.toml` with `uv tree --outdated | grep latest`, we do have some semi-automatic ways to upgrade`pyproject.toml`, like [Github dependabot](https://docs.github.com/en/code-security/getting-started/dependabot-quickstart-guide), or [Renovate](https://docs.renovatebot.com/), they will create PRs to upgrade`pyproject.toml` automatically.
402
+
403
+
Or locally in VSCode, the [Dependi extension](https://marketplace.visualstudio.com/items?itemName=fill-labs.dependi) is pretty good, it shows in-line the latest version in the editor, and can upgrade the whole `pyproject.toml`with a click.
404
+
405
+
### Upgrade uv.lock
406
+
407
+
[`uv.lock` file](https://docs.astral.sh/uv/concepts/projects/layout/#the-lockfile) can be updated by `uv lock`,`uv sync`,`uv run`,`uv add`,`uv remove`.
0 commit comments