uv
e0fae8e6 - Add `uv python pin` (#4950)

Comment changes are shownComment changes are hidden
Commit
342 days ago
Add `uv python pin` (#4950) Adds a `uv python pin` command to write to a `.python-version` file. We support all of our Python version request formats. We also support a `--resolved` flag to pin to a specific interpreter instead of the provided version. We canonicalize the request with #4949, it's not just printed verbatim. We always attempt to find the interpreter so we can warn if it's not available. With `--resolved`, if we can't find the interpreter we fail. If no arguments are provided, we'll attempt to display the current pin. In the future: - We should confirm that this satisfies the `Requires-Python` metadata if a `pyproject.toml` is present - We should support writing to a `uv.python-version` field if `pyproject.toml` or `uv.toml` are present - We should support finding and updating the "nearest" Python version file (looking in ancestors) - We should support finding version files in workspaces - We should support some sort of global pin
Author
Parents
  • crates
    • uv-cli/src
      • File
        lib.rs
    • uv
      • src
        • commands
          • File
            mod.rs
          • python
            • File
              mod.rs
            • File
              pin.rs
        • File
          main.rs
        • File
          settings.rs
      • tests
        • common
          • File
            mod.rs
        • File
          help.rs
        • File
          python_pin.rs