Accept (e.g.) 'python3.8' as --python argument (#2031)

## Summary

This PR aligns the `uv pip install --python` flag with the `uv venv
--python` flag, such that the former now accepts binary names and Python
versions by way of using the same `find_requested_python` method under
the hood.
This commit is contained in:
Charlie Marsh 2024-02-28 09:48:49 -05:00 committed by GitHub
parent 995fba8fec
commit 23afa09fae
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 60 additions and 42 deletions

View file

@ -28,7 +28,9 @@ pub enum Error {
#[error("No versions of Python could be found. Is Python installed?")]
PythonNotFound,
#[error("Failed to locate a virtualenv or Conda environment (checked: `VIRTUAL_ENV`, `CONDA_PREFIX`, and `.venv`). Run `uv venv` to create a virtualenv.")]
NotFound,
VenvNotFound,
#[error("Failed to locate Python interpreter at: `{0}`")]
RequestedPythonNotFound(String),
#[error(transparent)]
Io(#[from] io::Error),
#[error("Failed to query python interpreter `{interpreter}`")]