Skip to content
STIRUP

TECHNOLOGY INTELLIGENCE

Understand what's next.

Python 3.15 and uv.lock file compatibility issues

Python 3.15 may cause compatibility problems with packages due to uv.lock files pinning incompatible dependency versions, such as when PyO3 does not support Python 3.15.

Share
AI-generated conceptual illustration accompanying: Python 3.15 and uv.lock file compatibility issues
AI-generated editorial illustration of the article topic; not a photograph, product screenshot or measured result.

Python 3.15 and uv.lock file issues

Python 3.15 introduces new features and improvements, but users may encounter compatibility issues with certain packages. One common problem involves the uv.lock file, which can pin dependency versions that are incompatible with Python 3.15. For instance, some packages may not yet have wheels built for Python 3.15, leading to errors during installation or testing. An example from Simon Willison’s Weblog highlights an error when trying to build watchfiles==1.1.1, where the Python interpreter version (3.15) exceeds the maximum supported version (3.14) for PyO3. In such cases, deleting the uv.lock file and rerunning uv run pytest often resolves the issue. This approach allows uv to regenerate the lock file with updated dependency versions compatible with Python 3.15.

uv.lock file management in projects

Managing the uv.lock file in Python projects can be a source of confusion, particularly when working with libraries that do not include this file by default. As noted in discussions around Python 3.15, many library developers avoid including a uv.lock file because it locks dependency versions, which can be restrictive for other projects that rely on the library. However, running commands like uv run pytest may inadvertently generate a uv.lock file, which is typically excluded from version control via .gitignore. This can lead to inconsistencies if the file is not properly managed. Developers are advised to be mindful of when and where these files are created, ensuring they do not interfere with the intended behavior of their projects or dependencies.

Impact of uv.lock on dependency resolution

The uv.lock file plays a critical role in dependency resolution within Python projects, but it can sometimes cause issues when dependencies are not yet compatible with the latest Python versions. As noted in Simon Willison’s Weblog, uv.lock may pin a dependency version that lacks support for newer Python interpreters, such as Python 3.15. For instance, an attempt to build watchfiles==1.1.1 failed due to an incompatibility with PyO3, which only supports up to Python 3.14. In such cases, deleting the uv.lock file and rerunning uv run pytest can often resolve the issue by allowing the system to re-evaluate and select compatible versions of dependencies. This approach should be used with caution, as it may lead to unexpected changes in the project's dependency tree. The advice to delete the file is specific to situations where version mismatches occur and should not be applied universally.

Sources and reporting notes

Based on published source material. No independent hands-on testing is claimed.

Read more