Skip to content

Commit

Permalink
Always pass the Python implementation to uv
Browse files Browse the repository at this point in the history
Doing so ensures that uv cannot find an unexpected implementation
(like PyPy) that matches based solely on the language version.

Fixes tox-dev#142
  • Loading branch information
kurtmckee committed Dec 19, 2024
1 parent f9555ee commit a9b2f7c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/tox_uv/_venv.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,13 +182,13 @@ def create_python_env(self) -> None:
elif (base.major, base.minor) == sys.version_info[:2] and (sys.implementation.name.lower() == imp):
version_spec = sys.executable
else:
uv_imp = "" if (imp and imp == "cpython") else imp
uv_imp = imp or ""
if not base.major:
version_spec = f"{uv_imp or ''}"
version_spec = uv_imp
elif not base.minor:
version_spec = f"{uv_imp or ''}{base.major}"
version_spec = f"{uv_imp}{base.major}"
else:
version_spec = f"{uv_imp or ''}{base.major}.{base.minor}"
version_spec = f"{uv_imp}{base.major}.{base.minor}"

cmd: list[str] = [self.uv, "venv", "-p", version_spec, "--allow-existing"]
if self.options.verbosity > 3: # noqa: PLR2004
Expand Down

0 comments on commit a9b2f7c

Please sign in to comment.