uv 0.12 Cheatsheet: Defaults, Upgrade Checks & Commands
uv 0.12 is a version of the Python package and project manager uv; its practical defaults center on project environments, dependency locking, and fast package installation. This cheatsheet explains the commands to check your installed version, upgrade uv, inspect a project, and avoid assuming that a newer release automatically changes your project’s dependencies.
What uv 0.12 Is
uv is a command-line tool for Python work. Depending on how you use it, it can create virtual environments, install packages, manage project dependencies, run commands inside a project environment, and provide Python interpreter management. It is not itself a Python language version, and “uv 0.12” means the uv tool’s release version.
That distinction matters when reading upgrade advice. Updating uv changes the tool you invoke; it does not, by itself, upgrade Python, rewrite your dependency requirements, or guarantee that every package in an existing project will be replaced. Project files and explicit commands determine those outcomes.
Check the Installed Version
Start by checking which uv executable your shell is running:
uv --versionprints the installed uv version.uv helpdisplays general help, whileuv help syncoruv sync --helpcan show command-specific options supported by your installation.which uvon macOS or Linux, orwhere uvon Windows, can help identify the executable path if multiple installations may be present.
If the result is not 0.12, first identify how uv was installed. A shell can find an older executable earlier in its search path, even after you install a newer copy. Check the path and the installation method before repeating an upgrade.
Upgrade Checks and Commands
Use the update method that matches your installation. For installations managed by uv itself, the commonly used self-update command is:
uv self update
That command is not the right route for every installation. If uv came from an operating-system package manager, a standalone installer, or another tool, update it through that same channel. Package-manager commands and available versions vary, so consult the documentation for the method you actually used rather than mixing installation methods.
- Run
uv --versionand note the current version. - Update using the original installation channel; use
uv self updateonly when appropriate for that installation. - Open a new terminal or refresh the shell’s command lookup if needed.
- Run
uv --versionagain and checkwhich uvorwhere uvif the version did not change. - In a project, inspect its files and run the project checks your team uses before committing any resulting changes.
A successful tool upgrade and a successful project upgrade are separate checks. The first verifies the uv executable. The second means reviewing and testing project changes, such as edits to pyproject.toml or uv.lock, rather than assuming they happened automatically.
Everyday Project Command Cheatsheet
These commands cover common workflows. Run project commands from the directory containing the project configuration, unless you deliberately specify another location.
uv initstarts a new project in the current directory; options can tailor the kind of project created.uv add requestsadds a dependency to a project and updates its project metadata and lock information as needed. Replacerequestswith the package you intend to use.uv remove requestsremoves a project dependency.uv syncsynchronizes the project environment with its declared dependencies and lockfile.uv lockresolves dependencies and updates the lockfile without being a substitute for reviewing the result.uv run python main.pyruns a command in the project environment; it can prepare the environment when required.uv treedisplays the project’s dependency tree, which is useful for tracing why a package is present.uv pip install requestsprovides a pip-compatible installation workflow. It is distinct from adding a dependency to a project withuv add.
Options and behavior can differ by uv release and command context. For an exact option, check the help output from the installed version; a copied command from a newer guide may not be available in an older one.
Defaults: Projects, Environments, and Lockfiles
In a typical uv-managed project, pyproject.toml records project configuration and declared dependencies, while uv.lock records a resolved set of dependency versions. The lockfile helps make installations reproducible across machines, provided the relevant files are kept and used consistently.
Project workflows commonly use a local .venv directory for the virtual environment. uv sync is the direct command to bring that environment into line with the project. Do not assume that every invocation of uv creates the same environment: commands, options, configuration, working directory, and existing files all affect what happens.
A lockfile is not a promise that packages never change. Adding or removing dependencies, deliberately updating resolution, changing Python constraints, or changing relevant configuration can alter it. Conversely, simply upgrading the uv executable does not mean all locked packages have been upgraded. Review lockfile diffs, particularly in shared projects, and run tests after dependency changes.
Updating Dependencies Without Confusion
There are two different upgrade questions: “How do I update uv?” and “How do I update my project’s packages?” The first concerns the tool executable. The second concerns dependency declarations, resolution, and the lockfile.
For a project, begin by examining the current declarations and lockfile. Use the project’s documented update procedure and the installed version’s help to determine the appropriate update options. Then inspect the changes with your version-control tools and run tests. Avoid deleting a lockfile as a routine fix: that can trigger a fresh resolution and produce broad, unintended version changes.
For example, if uv --version reports an older release, updating uv may resolve a tool-version concern while leaving a project’s locked dependencies alone. If a package is outdated, update the project using its dependency-management workflow; changing the uv executable alone does not express that request.
Common Problems and Practical Checks
- Version appears unchanged: Check the executable path, open a fresh terminal, and confirm that the update targeted the installation your shell uses.
- Command is not recognized: Confirm uv is installed and available on the shell’s PATH. On Windows, reopen the terminal after installer changes; on Unix-like systems, check the shell configuration and command path.
- Unexpected dependency changes: Review the exact command, project configuration, and lockfile diff. Restore unintended edits through version control rather than guessing which versions to pin.
- Different results on another machine: Check that the project’s lockfile is present, committed where appropriate, and used by the workflow. Also compare Python constraints and platform-specific requirements.
- Confusion between pip and project commands: Use
uv addwhen you mean to declare a project dependency; use pip-compatible commands when that is the intended workflow.
When working on a team project, coordinate changes to dependency files and follow its established testing and review process. Avoid running upgrade commands in a production environment as an experiment; validate changes in the project’s normal development or deployment workflow.
Frequently Asked Questions
How do I check whether uv 0.12 is installed?
Run uv --version. If the output is not the expected version, check which executable is being used with which uv or where uv.
What command upgrades uv?uv self update is used for suitable self-managed installations. If another tool or package manager installed uv, update it through that original channel.
Does upgrading uv update my Python packages?
No, not automatically. Updating uv updates the tool. Project dependency updates require changes to dependency declarations or resolution through the project’s workflow.
What is the difference between uv add and uv pip install?uv add manages a dependency declared by a uv project. uv pip install offers a pip-compatible installation workflow and does not mean the same thing as adding a project dependency.
Should I delete uv.lock when an install fails?
Usually, do not start by deleting it. Check the error, project constraints, and lockfile changes first. Removing it can cause dependencies to be resolved again and create wider changes.
How can I confirm an upgrade worked?
Check uv --version in a fresh terminal, verify the executable path if needed, then run the project’s normal synchronization and tests. Treat tool verification and project validation as separate steps.
Related
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.