Skip to content

Commit a8c4487

Browse files
iisakkirotkoAntoinePrv
authored andcommitted
fix: list dependencies pulled with uv
1 parent e76f525 commit a8c4487

File tree

2 files changed

+44
-1
lines changed

2 files changed

+44
-1
lines changed

libmamba/src/core/prefix_data.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,8 @@ namespace mamba
304304
for (const auto& package : j["installed"])
305305
{
306306
// Get the package metadata, if installed with `pip`
307-
if (package.contains("installer") && package["installer"] == "pip")
307+
if (package.contains("installer")
308+
&& (package["installer"] == "pip" || package["installer"] == "uv"))
308309
{
309310
if (package.contains("metadata"))
310311
{

micromamba/tests/test_list.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,48 @@ def test_list_with_pip(tmp_home, tmp_root_prefix, tmp_path, no_pip_flag):
203203
assert all(package["name"] != "numpy" for package in res)
204204

205205

206+
env_yaml_content_to_install_numpy_with_uv = """
207+
channels:
208+
- conda-forge
209+
dependencies:
210+
- uv
211+
- pip:
212+
- pandas==2.2.3
213+
"""
214+
215+
216+
@pytest.mark.parametrize("shared_pkgs_dirs", [True], indirect=True)
217+
def test_list_with_uv(tmp_home, tmp_root_prefix, tmp_path):
218+
env_name = "env-list_with_uv"
219+
tmp_root_prefix / "envs" / env_name
220+
221+
env_file_yml = tmp_path / "test_env_yaml_content_to_install_numpy_with_uv.yaml"
222+
env_file_yml.write_text(env_yaml_content_to_install_numpy_with_uv)
223+
224+
helpers.create("-n", env_name, "python=3.12", "--json", no_dry_run=True)
225+
helpers.install("-n", env_name, "-f", env_file_yml, "--json", no_dry_run=True)
226+
227+
res = helpers.umamba_list("-n", env_name, "--json")
228+
assert any(
229+
package["name"] == "pandas"
230+
and package["version"] == "2.2.3"
231+
and package["base_url"] == "https://pypi.org/"
232+
and package["build_string"] == "pypi_0"
233+
and package["channel"] == "pypi"
234+
and package["platform"] == sys.platform + "-" + platform.machine()
235+
for package in res
236+
)
237+
# Check that dependencies are listed
238+
assert any(
239+
package["name"] == "numpy"
240+
and package["base_url"] == "https://pypi.org/"
241+
and package["build_string"] == "pypi_0"
242+
and package["channel"] == "pypi"
243+
and package["platform"] == sys.platform + "-" + platform.machine()
244+
for package in res
245+
)
246+
247+
206248
@pytest.mark.parametrize("env_selector", ["name", "prefix"])
207249
@pytest.mark.parametrize("shared_pkgs_dirs", [True], indirect=True)
208250
def test_not_existing(tmp_home, tmp_root_prefix, tmp_xtensor_env, env_selector):

0 commit comments

Comments
 (0)