For a uv project with pyproject.toml and uv.lock, use uv lock --upgrade-package PACKAGE for a targeted resolution update or uv lock --upgrade for all packages within the declared constraints. Then sync and test. For a pip-style environment without a uv project, use uv pip install --upgrade PACKAGE. These workflows update different things.
Contents
Choose the command by what you maintain
| Task | Command | Important boundary |
|---|---|---|
| Update one locked project dependency | uv lock --upgrade-package httpx | Updates the lockfile; still respects project constraints. |
| Update the project environment and resolution | uv sync --upgrade-package httpx | Updates the lock and environment together. |
| Upgrade all allowed project packages | uv lock --upgrade, then uv sync | Review a potentially wider dependency change. |
| Upgrade a package in a pip-style environment | uv pip install --upgrade httpx | Does not establish a maintained project lockfile. |
| Refresh compiled requirements | uv pip compile requirements.in --upgrade -o requirements.txt | Compilation and installation are separate steps. |
A reviewable targeted project update
uv lock --upgrade-package httpx
# Review the pyproject/lockfile diff before applying it.
uv sync
# Run the test command appropriate to your own project.
The package name is an example, not a recommendation that every project needs that package or its latest release. If your declaration pins a version, an upgrade flag cannot silently ignore that requirement. Decide whether a constraint change is appropriate and review that change explicitly.
A targeted request can still move transitive dependencies when resolution requires it. Compare the complete lockfile diff, not only the requested package's version. Separate an update's installation success from its application compatibility.
Why ordinary sync may keep an older version
With an existing lockfile, uv normally prefers already locked versions that still satisfy the project's requirements. A newer upstream release does not by itself make that lockfile outdated. uv lock --check checks consistency with metadata; it does not mean “upgrade everything.”
--locked checks that the lockfile is current and refuses to update it. --frozen uses the existing lock without that consistency check. Those are reproducibility controls, not commands for fetching the newest compatible package. Standard uv run can lock/sync automatically; be deliberate in CI if you want changes to fail instead of modifying resolution.
Requirements files use another workflow
If requirements.in is your source, compile it to pinned output, review the output, then install or synchronize it according to your project's policy. An exact sync may remove packages that are not in the selected dependency set. Read the proposed command before applying it to an environment you share with other work.
For one targeted requirements update, use the compile command's --upgrade-package option rather than an unreviewed shell pipeline that upgrades every installed package. Installed packages can include temporary tools and dependencies that are not your application's intended requirements.
Verify the change and preserve a rollback path
- Start with a known code/lockfile version and preserve local changes.
- Review upstream release notes and relevant compatibility/security changes.
- Make the smallest useful dependency change, inspect the full diff and test the application behavior it can affect.
- Commit dependency declarations and the lockfile together when appropriate. Recover by restoring the previous reviewed files and syncing in a suitable environment—not by guessing old transitive versions.
The commands here were checked against current uv documentation. This article does not claim that an upgrade was performed on your environment or that a successful resolver run proves every dependency safe.
Sources and checking notes
- uv: locking, syncing and upgrading locked versions
- uv: pip-interface package management
- uv: requirements compilation and upgrades
- uv: project dependency declarations
Article history
Sources checked October 23, 2026
- Removed stale claims that uv lacks a project-wide upgrade operation.
- Separated project/uv.lock operations from the pip-compatible environment workflow and requirements compilation.
- Added an original decision table and a review/rollback sequence; did not upgrade this repository.
