Skip to content

Does uv python pin 3.xx also update pyproject.toml and uv.lock? #14841

Description

@adityashukzy

Question

Hello, I'm relatively new to uv.

I cloned a git repo of mine to begin with, and then uv init'ed within the folder. This initialized the usual files (pyproject.toml, main.py, uv.lock, etc.).

However, at this point, the Python version picked up in .python-version was the default one in my usr/bin/python which was Python 3.9.

I wanted instead for it to install and use Python 3.10 for this project.

Thus, I ran the following:

  1. uv python install 3.10
  2. uv python pin 3.10

Now, as expected this change is reflected in the .python-version file (which displays 3.10). However, the pyproject.toml and uv.loc files still show the old info.

pyproject.toml:

requires-python = ">=3.9"

uv.lock:

version = 1
revision = 2
requires-python = ">=3.9"

Questions:

  1. Do I manually need to change the values for requires-python in the above 2 files after doing uv python pin 3.xx? Is that even required? If so, why is that not taken care of by the pin command?
  2. As I understand it, uv python install 3.10 will install that Python version globally? Is there any way to install python only for this project / associated environment? I do not wish to pollute the global space with multiple Python versions.

As I am new, I may have some incorrect assumptions. So please correct me where needed.

uv has been a fantastic tool so far, so kudos to the community!

Thank you!

Platform

macOS Sequoia 15.5 (Darwin 24.5.0 arm64)

Version

uv 0.8.2 (21fadbc 2025-07-22)

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionAsking for clarification or support

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions