Skip to content

fix: list dependencies pulled with uv #4026

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion libmamba/src/core/prefix_data.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,8 @@ namespace mamba
for (const auto& package : j["installed"])
{
// Get the package metadata, if installed with `pip`
if (package.contains("installer") && package["installer"] == "pip")
if (package.contains("installer")
&& (package["installer"] == "pip" || package["installer"] == "uv"))
{
if (package.contains("metadata"))
{
Expand Down
42 changes: 42 additions & 0 deletions micromamba/tests/test_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,48 @@ def test_list_with_pip(tmp_home, tmp_root_prefix, tmp_path, no_pip_flag):
assert all(package["name"] != "numpy" for package in res)


env_yaml_content_to_install_numpy_with_uv = """
channels:
- conda-forge
dependencies:
- uv
- pip:
- pandas==2.2.3
"""


@pytest.mark.parametrize("shared_pkgs_dirs", [True], indirect=True)
def test_list_with_uv(tmp_home, tmp_root_prefix, tmp_path):
env_name = "env-list_with_uv"
tmp_root_prefix / "envs" / env_name

env_file_yml = tmp_path / "test_env_yaml_content_to_install_numpy_with_uv.yaml"
env_file_yml.write_text(env_yaml_content_to_install_numpy_with_uv)

helpers.create("-n", env_name, "python=3.12", "--json", no_dry_run=True)
helpers.install("-n", env_name, "-f", env_file_yml, "--json", no_dry_run=True)

res = helpers.umamba_list("-n", env_name, "--json")
assert any(
package["name"] == "pandas"
and package["version"] == "2.2.3"
and package["base_url"] == "https://pypi.org/"
and package["build_string"] == "pypi_0"
and package["channel"] == "pypi"
and package["platform"] == sys.platform + "-" + platform.machine()
for package in res
)
# Check that dependencies are listed
assert any(
package["name"] == "numpy"
and package["base_url"] == "https://pypi.org/"
and package["build_string"] == "pypi_0"
and package["channel"] == "pypi"
and package["platform"] == sys.platform + "-" + platform.machine()
for package in res
)


@pytest.mark.parametrize("env_selector", ["name", "prefix"])
@pytest.mark.parametrize("shared_pkgs_dirs", [True], indirect=True)
def test_not_existing(tmp_home, tmp_root_prefix, tmp_xtensor_env, env_selector):
Expand Down
Loading