From 38fe40d55826a4fd1768db334f1bf15ec99f11a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bern=C3=A1t=20G=C3=A1bor?= Date: Fri, 16 Feb 2024 13:55:36 -0800 Subject: [PATCH] Use uv freeze over pip MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Bernát Gábor --- src/tox_uv/_installer.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/tox_uv/_installer.py b/src/tox_uv/_installer.py index 315b5e0..5fa463a 100644 --- a/src/tox_uv/_installer.py +++ b/src/tox_uv/_installer.py @@ -6,9 +6,10 @@ import sys from collections import defaultdict from pathlib import Path -from typing import TYPE_CHECKING, Any, Sequence +from typing import TYPE_CHECKING, Any, Sequence, cast from packaging.requirements import Requirement +from tox.config.of_type import ConfigDynamicDefinition from tox.config.types import Command from tox.execute.request import StdinSource from tox.tox_env.errors import Recreate @@ -24,6 +25,12 @@ class UvInstaller(Pip): """Pip is a python installer that can install packages as defined by PEP-508 and PEP-517.""" + def _register_config(self) -> None: + super()._register_config() + if self._with_list_deps: # pragma: no branch + conf = cast(ConfigDynamicDefinition[Command], self._env.conf._defined["list_dependencies_command"]) # noqa: SLF001 + conf.default = Command([self.uv, "pip", "freeze"]) + @property def uv(self) -> str: return str(Path(sys.executable).parent / "uv")