Skip to content

"uv python pin --global" Should Automatically Use Latest or Current Project Version #13854

@zyads

Description

@zyads

Summary

When using the uv python pin --global command, it currently requires a specific Python version to be provided. As opposed to showing an error: "No pinned Python version found," it would be more user-friendly if the command could automatically determine and use the latest available Python version or the version currently selected in the current project (if a .python-version file exists).

Steps to Reproduce

  1. Run uv python pin --global without specifying a version.
  2. Observe the error message: "No pinned Python version found."

Expected Behavior

  • If no version is specified, uv python pin --global should:
    • Check for the latest available Python version and use that.
    • Alternatively, if a .python-version file exists in the current project, use the version specified in that file.

Actual Behavior

  • The command fails with the error message "No pinned Python version found" and requires a specific version to be provided.

System Information
UV Version: 0.7.11
Python Version: 3.13
Operating System: Linux

Related Documentation
UV Python Version Management
UV Install Python Guide

Thank you for considering this enhancement!

Example

  • Use Case: Users often want to set a global Python version that matches their current project or the latest available version without having to manually specify it each time.
  • Proposed Solution:
    • Add a flag to automatically determine the latest version or use the current project's version.
    • Example: uv python pin --global --latest to use the latest available version.
    • Example: uv python pin --global --set-current-to-global to use the version specified in the current project's .python-version file.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or improvement to existing functionalityneeds-decisionUndecided if this should be done

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions