Managing Python Versions In Your uv Projects
One of the many ways the package manager uv has changed Python is by making it painless to install and run different versions of the Python interpreter.
That said, I've occasionally gotten tripped up configuring this correctly in my development environments. I've written a few articles to try to clarify things:
- What is a .python-version file? Not unique to uv, a .python-version file specifies which Python version should be used for a particular project or directory.
- .python-version vs requires-python in pyproject.toml. The former is for development environments, while the latter is for package metadata.
- How to change the python version of a uv project. If
uv run
isn't using the version of Python you expected or wanted, here is what you can do.
The goal of the handbook is to help you understand the ecosystem of tools used to make Python development easier and more productive. What are some missing topics you'd like to see included?
Don't miss what's next. Subscribe to Python Developer Tooling Handbook: