From b418cf4a68224b99c609d8ce275431ef00d021cf Mon Sep 17 00:00:00 2001 From: Cornelius Roemer Date: Fri, 19 Jul 2024 14:03:13 +0200 Subject: [PATCH 001/126] doc(more_concepts.rst): improve clarity (#3357) `all the file systems are not supporting such links` is most likely meant to mean "not all are" rather "all are not" --- docs/source/advanced_usage/more_concepts.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/source/advanced_usage/more_concepts.rst b/docs/source/advanced_usage/more_concepts.rst index aab5e2ae7c..bf62271851 100644 --- a/docs/source/advanced_usage/more_concepts.rst +++ b/docs/source/advanced_usage/more_concepts.rst @@ -132,8 +132,8 @@ This is the most efficient way to link: There are some limitations to use ``hard-links``: -- all the file systems are not supporting such links -- those links are not working across file systems/partitions +- not all file systems support ``hard-links`` +- ``hard-links`` don't work across file systems/partitions .. _soft_link: From c6f2f24d5a818ed9298f0ea13fbabb2980568640 Mon Sep 17 00:00:00 2001 From: Hind-M <70631848+Hind-M@users.noreply.github.com> Date: Tue, 23 Jul 2024 13:28:12 +0200 Subject: [PATCH 002/126] Allow spaces in version after operator (#3358) Allow spaces in version after operator --- libmamba/src/specs/match_spec.cpp | 35 +++++++++++++---- libmamba/src/specs/version_spec.cpp | 39 ++++++++++--------- libmamba/tests/src/specs/test_match_spec.cpp | 40 ++++++++++++++++++++ 3 files changed, 89 insertions(+), 25 deletions(-) diff --git a/libmamba/src/specs/match_spec.cpp b/libmamba/src/specs/match_spec.cpp index e5fb33fdd6..d4fb4fbf98 100644 --- a/libmamba/src/specs/match_spec.cpp +++ b/libmamba/src/specs/match_spec.cpp @@ -446,23 +446,44 @@ namespace mamba::specs // the repr of `libblas=*=*mkl` str = util::rstrip(str, '='); - const auto pos = str.find_last_of(" ="); + auto pos = str.find_last_of(" ="); if (pos == str.npos || pos == 0) { return { str, {} }; } - if (char c = str[pos]; c == '=') + pos = str.find_last_of('='); + const char d = str[pos - 1]; + + if (d == '=' || d == '!' || d == '|' || d == ',' || d == '<' || d == '>' || d == '~') { - char d = str[pos - 1]; - if (d == '=' || d == '!' || d == '|' || d == ',' || d == '<' || d == '>' || d == '~') + // Find the position of the first non-space character after operator + const auto version_start = str.find_first_not_of(' ', pos + 1); + const auto space_start = str.find_first_of(' ', version_start); + // Find the position of the first non-space character after version + const auto build_start = str.find_first_not_of(' ', space_start); + + // If another str is present after some space => build + if ((build_start != str.npos) && (version_start != build_start)) { - return { str, {} }; + return { util::strip(str.substr(0, build_start)), str.substr(build_start) }; } + // Otherwise no build is present after the version + return { str, {} }; + } + + if (pos == str.npos) + { + // That means that there is no operator, and version and build are separated with + // space(s) + pos = str.find_last_of(' '); + return { util::strip(str.substr(0, pos)), str.substr(pos + 1) }; } - // c is either ' ' or d is none of the forbidden chars - return { str.substr(0, pos), str.substr(pos + 1) }; + // '=' is found but not combined with `d` above + // meaning that the build is right after the last '=' + const auto build_start = str.find_first_not_of(' ', pos + 1); + return { str.substr(0, pos), str.substr(build_start) }; } auto split_name_version_and_build(std::string_view str) diff --git a/libmamba/src/specs/version_spec.cpp b/libmamba/src/specs/version_spec.cpp index 6bc74139bc..9126ef88eb 100644 --- a/libmamba/src/specs/version_spec.cpp +++ b/libmamba/src/specs/version_spec.cpp @@ -339,31 +339,31 @@ namespace mamba::specs } if (util::starts_with(str, VersionSpec::greater_equal_str)) { - return Version::parse(str.substr(VersionSpec::greater_equal_str.size())) + return Version::parse(util::lstrip(str.substr(VersionSpec::greater_equal_str.size()))) .transform([](specs::Version&& ver) { return VersionPredicate::make_greater_equal(std::move(ver)); }); } if (util::starts_with(str, VersionSpec::greater_str)) { - return Version::parse(str.substr(VersionSpec::greater_str.size())) + return Version::parse(util::lstrip(str.substr(VersionSpec::greater_str.size()))) .transform([](specs::Version&& ver) { return VersionPredicate::make_greater(std::move(ver)); }); } if (util::starts_with(str, VersionSpec::less_equal_str)) { - return Version::parse(str.substr(VersionSpec::less_equal_str.size())) + return Version::parse(util::lstrip(str.substr(VersionSpec::less_equal_str.size()))) .transform([](specs::Version&& ver) { return VersionPredicate::make_less_equal(std::move(ver)); }); } if (util::starts_with(str, VersionSpec::less_str)) { - return Version::parse(str.substr(VersionSpec::less_str.size())) + return Version::parse(util::lstrip(str.substr(VersionSpec::less_str.size()))) .transform([](specs::Version&& ver) { return VersionPredicate::make_less(std::move(ver)); }); } if (util::starts_with(str, VersionSpec::compatible_str)) { - return Version::parse(str.substr(VersionSpec::compatible_str.size())) + return Version::parse(util::lstrip(str.substr(VersionSpec::compatible_str.size()))) .transform( [](specs::Version&& ver) { @@ -382,13 +382,15 @@ namespace mamba::specs // Glob suffix changes meaning for ==1.3.* if (has_glob_suffix) { - return Version::parse(str.substr(start, str.size() - glob_len - start)) + return Version::parse( + util::lstrip(str.substr(start, str.size() - glob_len - start)) + ) .transform([](specs::Version&& ver) { return VersionPredicate::make_starts_with(std::move(ver)); }); } else { - return Version::parse(str.substr(start)) + return Version::parse(util::lstrip(str.substr(start))) .transform([](specs::Version&& ver) { return VersionPredicate::make_equal_to(std::move(ver)); }); } @@ -399,14 +401,16 @@ namespace mamba::specs // Glob suffix changes meaning for !=1.3.* if (has_glob_suffix) { - return Version::parse(str.substr(start, str.size() - glob_len - start)) + return Version::parse( + util::lstrip(str.substr(start, str.size() - glob_len - start)) + ) .transform([](specs::Version&& ver) { return VersionPredicate::make_not_starts_with(std::move(ver)); } ); } else { - return Version::parse(str.substr(start)) + return Version::parse(util::lstrip(str.substr(start))) .transform([](specs::Version&& ver) { return VersionPredicate::make_not_equal_to(std::move(ver)); }); } @@ -415,7 +419,7 @@ namespace mamba::specs { const std::size_t start = VersionSpec::starts_with_str.size(); // Glob suffix does not change meaning for =1.3.* - return Version::parse(str.substr(start, str.size() - glob_len - start)) + return Version::parse(util::lstrip(str.substr(start, str.size() - glob_len - start))) .transform([](specs::Version&& ver) { return VersionPredicate::make_starts_with(std::move(ver)); }); } @@ -427,16 +431,15 @@ namespace mamba::specs // either ".*" or "*" static constexpr auto one = std::size_t(1); // MSVC const std::size_t len = str.size() - std::max(glob_len, one); - return Version::parse(str.substr(0, len)) + return Version::parse(util::lstrip(str.substr(0, len))) .transform([](specs::Version&& ver) { return VersionPredicate::make_starts_with(std::move(ver)); }); } else { - return Version::parse(str).transform( - [](specs::Version&& ver) - { return VersionPredicate::make_equal_to(std::move(ver)); } - ); + return Version::parse(util::lstrip(str)) + .transform([](specs::Version&& ver) + { return VersionPredicate::make_equal_to(std::move(ver)); }); } } return tl::make_unexpected( @@ -481,7 +484,7 @@ namespace mamba::specs str ))); } - str = str.substr(1); + str = util::lstrip(str.substr(1)); } else if (str.front() == VersionSpec::or_token) { @@ -494,7 +497,7 @@ namespace mamba::specs str ))); } - str = str.substr(1); + str = util::lstrip(str.substr(1)); } else if (str.front() == VersionSpec::left_parenthesis_token) { @@ -539,7 +542,7 @@ namespace mamba::specs str ))); } - str = rest; + str = util::lstrip(rest); } } diff --git a/libmamba/tests/src/specs/test_match_spec.cpp b/libmamba/tests/src/specs/test_match_spec.cpp index 0ade3a8523..6dee69e2dd 100644 --- a/libmamba/tests/src/specs/test_match_spec.cpp +++ b/libmamba/tests/src/specs/test_match_spec.cpp @@ -37,6 +37,36 @@ TEST_SUITE("specs::match_spec") CHECK_EQ(ms.str(), "xtensor==0.12.3"); } + SUBCASE("xtensor >= 0.12.3") + { + auto ms = MatchSpec::parse("xtensor >= 0.12.3").value(); + CHECK_EQ(ms.name().str(), "xtensor"); + CHECK_EQ(ms.version().str(), ">=0.12.3"); + CHECK(ms.build_string().is_explicitly_free()); + CHECK(ms.build_number().is_explicitly_free()); + CHECK_EQ(ms.str(), "xtensor>=0.12.3"); + } + + SUBCASE("_libgcc_mutex 0.1 conda_forge") + { + auto ms = MatchSpec::parse("_libgcc_mutex 0.1 conda_forge").value(); + CHECK_EQ(ms.name().str(), "_libgcc_mutex"); + CHECK_EQ(ms.version().str(), "==0.1"); + CHECK_EQ(ms.build_string().str(), "conda_forge"); + CHECK(ms.build_number().is_explicitly_free()); + CHECK_EQ(ms.str(), "_libgcc_mutex==0.1=conda_forge"); + } + + SUBCASE("_libgcc_mutex 0.1 conda_forge ") + { + auto ms = MatchSpec::parse("_libgcc_mutex 0.1 conda_forge ").value(); + CHECK_EQ(ms.name().str(), "_libgcc_mutex"); + CHECK_EQ(ms.version().str(), "==0.1"); + CHECK_EQ(ms.build_string().str(), "conda_forge"); + CHECK(ms.build_number().is_explicitly_free()); + CHECK_EQ(ms.str(), "_libgcc_mutex==0.1=conda_forge"); + } + SUBCASE("ipykernel") { auto ms = MatchSpec::parse("ipykernel").value(); @@ -236,6 +266,16 @@ TEST_SUITE("specs::match_spec") CHECK_EQ(ms.str(), "foo=1.0=2"); } + SUBCASE("foo = 1.0 = 2") + { + auto ms = MatchSpec::parse("foo = 1.0 = 2").value(); + CHECK_EQ(ms.conda_build_form(), "foo 1.0.* 2"); + CHECK_EQ(ms.name().str(), "foo"); + CHECK_EQ(ms.version().str(), "=1.0"); + CHECK_EQ(ms.build_string().str(), "2"); + CHECK_EQ(ms.str(), "foo=1.0=2"); + } + SUBCASE("foo=1.0=2[md5=123123123, license=BSD-3, fn='test 123.tar.bz2']") { auto ms = MatchSpec::parse("foo=1.0=2[md5=123123123, license=BSD-3, fn='test 123.tar.bz2']") From a10a532fd810453d337547f35b43abe78aee5053 Mon Sep 17 00:00:00 2001 From: Hind-M <70631848+Hind-M@users.noreply.github.com> Date: Tue, 23 Jul 2024 13:32:55 +0200 Subject: [PATCH 003/126] Remove logs for every package (#3335) --- libmamba/src/solver/libsolv/helpers.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/libmamba/src/solver/libsolv/helpers.cpp b/libmamba/src/solver/libsolv/helpers.cpp index 1bb1366d8c..59bfca15ab 100644 --- a/libmamba/src/solver/libsolv/helpers.cpp +++ b/libmamba/src/solver/libsolv/helpers.cpp @@ -172,11 +172,6 @@ namespace mamba::solver::libsolv } } } - else - { - LOG_DEBUG << "No signatures available for '" << filename - << "'. Downloading without verifying artifacts."; - } } [[nodiscard]] auto set_solvable( @@ -388,7 +383,6 @@ namespace mamba::solver::libsolv if (parsed) { on_parsed(fn); - LOG_DEBUG << "Adding package record to repo " << fn; } else { @@ -572,6 +566,10 @@ namespace mamba::solver::libsolv { signatures = std::move(maybe_sigs).value(); } + else + { + LOG_DEBUG << "No signatures available or requested. Downloading without verifying artifacts."; + } if (package_types == PackageTypes::CondaOrElseTarBz2) { From ce1c4f22bd14d4595b6a99ea312e56ba56ad2290 Mon Sep 17 00:00:00 2001 From: Hind-M <70631848+Hind-M@users.noreply.github.com> Date: Thu, 25 Jul 2024 09:23:39 +0200 Subject: [PATCH 004/126] Allow leading lowercase letter in version (#3361) --- libmamba/src/specs/version_spec.cpp | 8 ++++- libmamba/tests/src/specs/test_match_spec.cpp | 37 ++++++++++++++++++++ 2 files changed, 44 insertions(+), 1 deletion(-) diff --git a/libmamba/src/specs/version_spec.cpp b/libmamba/src/specs/version_spec.cpp index 9126ef88eb..9180ee397c 100644 --- a/libmamba/src/specs/version_spec.cpp +++ b/libmamba/src/specs/version_spec.cpp @@ -423,7 +423,13 @@ namespace mamba::specs .transform([](specs::Version&& ver) { return VersionPredicate::make_starts_with(std::move(ver)); }); } - if (util::is_digit(str.front())) // All versions must start with a digit + // All versions must start with either a digit or a lowercase letter + // The version regex should comply with r"^[\*\.\+!_0-9a-z]+$" + // cf. https://github.com/conda/conda/blob/main/conda/models/version.py#L33 + // Note that we don't apply this condition when the version is given with an operator + // In that case, string literals are converted to lowercase in `version.cpp` through + // `Version::parse` + if (util::is_digit(str.front()) || util::is_lower(str.front())) { // Glob suffix does change meaning for 1.3.* and 1.3* if (util::ends_with(str, VersionSpec::glob_suffix_token)) diff --git a/libmamba/tests/src/specs/test_match_spec.cpp b/libmamba/tests/src/specs/test_match_spec.cpp index 6dee69e2dd..4a83d7a752 100644 --- a/libmamba/tests/src/specs/test_match_spec.cpp +++ b/libmamba/tests/src/specs/test_match_spec.cpp @@ -82,6 +82,43 @@ TEST_SUITE("specs::match_spec") CHECK(ms.version().is_explicitly_free()); } + SUBCASE("disperse=v0.9.24") + { + auto ms = MatchSpec::parse("disperse=v0.9.24").value(); + CHECK_EQ(ms.name().str(), "disperse"); + CHECK_EQ(ms.version().str(), "=0v0.9.24"); + CHECK(ms.build_string().is_explicitly_free()); + CHECK(ms.build_number().is_explicitly_free()); + CHECK_EQ(ms.str(), "disperse=0v0.9.24"); + } + + SUBCASE("disperse v0.9.24") + { + auto ms = MatchSpec::parse("disperse v0.9.24").value(); + CHECK_EQ(ms.name().str(), "disperse"); + CHECK_EQ(ms.version().str(), "==0v0.9.24"); + CHECK(ms.build_string().is_explicitly_free()); + CHECK(ms.build_number().is_explicitly_free()); + CHECK_EQ(ms.str(), "disperse==0v0.9.24"); + } + + SUBCASE("foo V0.9.24") + { + auto ms = MatchSpec::parse("foo V0.9.24"); + CHECK_FALSE(ms.has_value()); + CHECK_EQ(std::string(ms.error().what()), "Found invalid version predicate in \"V0.9.24\""); + } + + SUBCASE("foo=V0.9.24") + { + auto ms = MatchSpec::parse("foo=V0.9.24").value(); + CHECK_EQ(ms.name().str(), "foo"); + CHECK_EQ(ms.version().str(), "=0v0.9.24"); + CHECK(ms.build_string().is_explicitly_free()); + CHECK(ms.build_number().is_explicitly_free()); + CHECK_EQ(ms.str(), "foo=0v0.9.24"); + } + SUBCASE("numpy 1.7*") { auto ms = MatchSpec::parse("numpy 1.7*").value(); From 4cc78c87acebedce86985c04fc3187d0ac55a733 Mon Sep 17 00:00:00 2001 From: Andy Kipp Date: Thu, 25 Jul 2024 10:44:52 +0200 Subject: [PATCH 005/126] Update mamba.xsh: support xonsh >= 0.18.0 (#3355) Update mamba.xsh --- libmamba/data/mamba.xsh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/libmamba/data/mamba.xsh b/libmamba/data/mamba.xsh index 0320ee3301..31775802f6 100644 --- a/libmamba/data/mamba.xsh +++ b/libmamba/data/mamba.xsh @@ -3,7 +3,14 @@ # Much of this forked from https://github.com/gforsyth/xonda # Copyright (c) 2016, Gil Forsyth, All rights reserved. # Original code licensed under BSD-3-Clause. -from xonsh.lazyasd import lazyobject + +try: + # xonsh >= 0.18.0 + from xonsh.lib.lazyasd import lazyobject +except: + # xonsh < 0.18.0 + from xonsh.lazyasd import lazyobject + from xonsh.completers import completer from xonsh.completers.tools import complete_from_sub_proc, contextual_command_completer From 4b8cc14869fa542580d8fb9e98cbfa47c4c1dfb2 Mon Sep 17 00:00:00 2001 From: Cornelius Roemer Date: Thu, 25 Jul 2024 13:15:24 +0200 Subject: [PATCH 006/126] chore(ci): bump github action versions (#3350) * chore(ci): bump actions/checkout to v4 * chore(ci): bump actions/cache to v4 * chore(ci): bump upload-artifact to v4 * Update static_build.yml * No whitespace changes --- .github/actions/workspace/action.yml | 4 ++-- .github/workflows/label_check.yml | 2 +- .github/workflows/linters.yml | 2 +- .github/workflows/static_build.yml | 29 ++++++++++++++-------------- 4 files changed, 18 insertions(+), 19 deletions(-) diff --git a/.github/actions/workspace/action.yml b/.github/actions/workspace/action.yml index 9aa37949b7..0cfd129639 100644 --- a/.github/actions/workspace/action.yml +++ b/.github/actions/workspace/action.yml @@ -28,13 +28,13 @@ runs: steps: - name: Create workspace if: ${{ inputs.action == 'save' }} - uses: actions/cache/save@v3 + uses: actions/cache/save@v4 with: path: ${{ inputs.path }} key: ${{ inputs.key_prefix }}-${{ inputs.key_base }}-${{ inputs.key_suffix }} - name: Restore workspace if: ${{ inputs.action == 'restore' }} - uses: actions/cache/restore@v3 + uses: actions/cache/restore@v4 with: path: ${{ inputs.path }} key: ${{ inputs.key_prefix }}-${{ inputs.key_base }}-${{ inputs.key_suffix }} diff --git a/.github/workflows/label_check.yml b/.github/workflows/label_check.yml index e298da71a5..f07a4ac47d 100644 --- a/.github/workflows/label_check.yml +++ b/.github/workflows/label_check.yml @@ -14,7 +14,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Check labels run: | diff --git a/.github/workflows/linters.yml b/.github/workflows/linters.yml index 211312e31a..114bb42c33 100644 --- a/.github/workflows/linters.yml +++ b/.github/workflows/linters.yml @@ -20,7 +20,7 @@ jobs: env: PRE_COMMIT_USE_MICROMAMBA: 1 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Install pre-commit uses: mamba-org/setup-micromamba@v1 with: diff --git a/.github/workflows/static_build.yml b/.github/workflows/static_build.yml index dcb494668d..605ce1aafe 100644 --- a/.github/workflows/static_build.yml +++ b/.github/workflows/static_build.yml @@ -27,19 +27,19 @@ jobs: fail-fast: false matrix: include: - - { os: ubuntu-latest, platform: linux, arch: "64" } - - { os: ubuntu-latest, platform: linux, arch: aarch64 } - - { os: ubuntu-latest, platform: linux, arch: ppc64le } - - { os: macos-latest, platform: osx, arch: "64" } - - { os: macos-latest, platform: osx, arch: arm64 } + - {os: ubuntu-latest, platform: linux, arch: "64"} + - {os: ubuntu-latest, platform: linux, arch: aarch64} + - {os: ubuntu-latest, platform: linux, arch: ppc64le} + - {os: macos-latest, platform: osx, arch: "64"} + - {os: macos-latest, platform: osx, arch: arm64} steps: - name: Checkout micromamba-feedstock - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: repository: conda-forge/micromamba-feedstock path: micromamba-feedstock - name: Checkout mamba branch - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: path: mamba - name: Clear mamba git directory and link source @@ -54,7 +54,7 @@ jobs: with: environment-name: mambabuild create-args: python boa - post-cleanup: none # FIXME the cleanup fails on OSX + post-cleanup: none # FIXME the cleanup fails on OSX - name: Build conda package (Unix native) if: ${{ !(matrix.platform == 'linux' && matrix.arch != '64') }} shell: bash -l {0} @@ -98,25 +98,24 @@ jobs: if: failure() run: tar -czf ${{ github.workspace }}/micromamba-conda-build-failed-${{ matrix.platform }}-${{ matrix.arch }}.tar.gz $MAMBA_ROOT_PREFIX/envs/mambabuild/conda-bld/micromamba_* - name: Upload conda build artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: failure() with: name: micromamba-conda-build-failed-${{ matrix.platform }}-${{ matrix.arch }} path: ${{ github.workspace }}/micromamba-conda-build-failed-${{ matrix.platform }}-${{ matrix.arch }}.tar.gz retention-days: 7 - name: Upload micromamba - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 with: name: micromamba-${{ matrix.platform }}-${{ matrix.arch }} path: ${{ github.workspace }}/artifacts/micromamba - micromamba-static-win: name: "win-64" runs-on: windows-2022 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Cache vcpkg packages - uses: actions/cache@v3 + uses: actions/cache@v4 with: # The installed packages are in %VCPKG_INSTALLATION_ROOT%\installed\x64-windows-static # and the info which packages are installed is in %VCPKG_INSTALLATION_ROOT%\installed\vcpkg @@ -180,13 +179,13 @@ jobs: if: failure() run: tar -czf ${{ github.workspace }}/micromamba-build-failed-win-64.tar.gz ${{ github.workspace }}/build/ - name: Upload build artifacts - uses: actions/upload-artifact@v3 + uses: actions/upload-artifact@v4 if: failure() with: name: micromamba-build-failed-win-64 path: ${{ github.workspace }}/micromamba-build-failed-win-64.tar.gz retention-days: 7 - - uses: actions/upload-artifact@v3 + - uses: actions/upload-artifact@v4 with: name: micromamba-win-64 path: ${{ github.workspace }}/build/micromamba/micromamba.exe From bdae0a14056a7280dcd5eb2b21cc8e880f78347d Mon Sep 17 00:00:00 2001 From: Johan Mabille Date: Sat, 27 Jul 2024 01:08:20 +0200 Subject: [PATCH 007/126] release libmamba 2.0.0rc1, libmambapy 2.0.0rc1, micromamba 2.0.0rc1 --- CHANGELOG.md | 20 ++++++++++++++++++++ libmamba/CHANGELOG.md | 18 ++++++++++++++++++ libmambapy/CHANGELOG.md | 9 +++++++++ micromamba/CHANGELOG.md | 9 +++++++++ 4 files changed, 56 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 62c9d56023..89843cc6f8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,23 @@ +2024.07.26 +========== + +Releases: libmamba 2.0.0rc1, libmambapy 2.0.0rc1, micromamba 2.0.0rc1 + +Enhancements: + +- [libmamba] Update mamba.xsh: support xonsh >= 0.18.0 by @anki-code in https://github.com/mamba-org/mamba/pull/3355 +- [libmamba] Remove logs for every package by @Hind-M in https://github.com/mamba-org/mamba/pull/3335 + +Bug fixes: + +- [libmamba] Allow leading lowercase letter in version by @Hind-M in https://github.com/mamba-org/mamba/pull/3361 +- [libmamba] Allow spaces in version after operator by @Hind-M in https://github.com/mamba-org/mamba/pull/3358 + +CI fixes and doc: + +- [all] chore(ci): bump github action versions by @corneliusroemer in https://github.com/mamba-org/mamba/pull/3350 +- [all] doc(more_concepts.rst): improve clarity by @corneliusroemer in https://github.com/mamba-org/mamba/pull/3357 + 2024.07.08 ========== diff --git a/libmamba/CHANGELOG.md b/libmamba/CHANGELOG.md index cdf733f541..54db0b31dc 100644 --- a/libmamba/CHANGELOG.md +++ b/libmamba/CHANGELOG.md @@ -1,3 +1,21 @@ +libmamba 2.0.0rc1 (July 26, 2024) +================================= + +Enhancements: + +- Update mamba.xsh: support xonsh >= 0.18.0 by @anki-code in https://github.com/mamba-org/mamba/pull/3355 +- Remove logs for every package by @Hind-M in https://github.com/mamba-org/mamba/pull/3335 + +Bug fixes: + +- Allow leading lowercase letter in version by @Hind-M in https://github.com/mamba-org/mamba/pull/3361 +- Allow spaces in version after operator by @Hind-M in https://github.com/mamba-org/mamba/pull/3358 + +CI fixes and doc: + +- chore(ci): bump github action versions by @corneliusroemer in https://github.com/mamba-org/mamba/pull/3350 +- doc(more_concepts.rst): improve clarity by @corneliusroemer in https://github.com/mamba-org/mamba/pull/3357 + libmamba 2.0.0rc0 (July 08, 2024) ================================= diff --git a/libmambapy/CHANGELOG.md b/libmambapy/CHANGELOG.md index 495393f1b6..ac4c3f7f3d 100644 --- a/libmambapy/CHANGELOG.md +++ b/libmambapy/CHANGELOG.md @@ -1,3 +1,12 @@ +libmambapy 2.0.0rc1 (July 26, 2024) +=================================== + + +CI fixes and doc: + +- chore(ci): bump github action versions by @corneliusroemer in https://github.com/mamba-org/mamba/pull/3350 +- doc(more_concepts.rst): improve clarity by @corneliusroemer in https://github.com/mamba-org/mamba/pull/3357 + libmambapy 2.0.0rc0 (July 08, 2024) =================================== diff --git a/micromamba/CHANGELOG.md b/micromamba/CHANGELOG.md index 21b7f4e3ae..346174f3e0 100644 --- a/micromamba/CHANGELOG.md +++ b/micromamba/CHANGELOG.md @@ -1,3 +1,12 @@ +micromamba 2.0.0rc1 (July 26, 2024) +=================================== + + +CI fixes and doc: + +- chore(ci): bump github action versions by @corneliusroemer in https://github.com/mamba-org/mamba/pull/3350 +- doc(more_concepts.rst): improve clarity by @corneliusroemer in https://github.com/mamba-org/mamba/pull/3357 + micromamba 2.0.0rc0 (July 08, 2024) =================================== From 154012f256d32bee1ae64f5b11d694cb45d75cef Mon Sep 17 00:00:00 2001 From: Julien Jerphanion Date: Mon, 29 Jul 2024 10:59:27 +0200 Subject: [PATCH 008/126] Replace `Context` with `Context::platform` where possible (#3364) Signed-off-by: Julien Jerphanion --- .../include/mamba/core/virtual_packages.hpp | 5 ++--- libmamba/src/api/info.cpp | 2 +- libmamba/src/core/package_database_loader.cpp | 2 +- libmamba/src/core/virtual_packages.cpp | 9 ++++----- .../tests/src/core/test_virtual_packages.cpp | 18 +++++++----------- libmambapy/src/libmambapy/bindings/legacy.cpp | 5 ++++- 6 files changed, 19 insertions(+), 22 deletions(-) diff --git a/libmamba/include/mamba/core/virtual_packages.hpp b/libmamba/include/mamba/core/virtual_packages.hpp index 4a92c65320..6111e6a347 100644 --- a/libmamba/include/mamba/core/virtual_packages.hpp +++ b/libmamba/include/mamba/core/virtual_packages.hpp @@ -16,12 +16,11 @@ namespace mamba { class Context; - std::vector get_virtual_packages(const Context& context); + std::vector get_virtual_packages(const std::string& platform); namespace detail { std::string cuda_version(); - std::string get_arch(); auto make_virtual_package( std::string name, @@ -30,7 +29,7 @@ namespace mamba std::string build_string = "" ) -> specs::PackageInfo; - std::vector dist_packages(const Context& context); + std::vector dist_packages(const std::string& platform); } } diff --git a/libmamba/src/api/info.cpp b/libmamba/src/api/info.cpp index 3a321b8824..b663c7e632 100644 --- a/libmamba/src/api/info.cpp +++ b/libmamba/src/api/info.cpp @@ -156,7 +156,7 @@ namespace mamba items.push_back({ "populated config files", sources }); std::vector virtual_pkgs; - for (auto pkg : get_virtual_packages(ctx)) + for (auto pkg : get_virtual_packages(ctx.platform)) { virtual_pkgs.push_back(util::concat(pkg.name, "=", pkg.version, "=", pkg.build_string) ); diff --git a/libmamba/src/core/package_database_loader.cpp b/libmamba/src/core/package_database_loader.cpp index 4cdce150c3..221c81f39b 100644 --- a/libmamba/src/core/package_database_loader.cpp +++ b/libmamba/src/core/package_database_loader.cpp @@ -139,7 +139,7 @@ namespace mamba // TODO(C++20): We could do a PrefixData range that returns packages without storing thems. auto pkgs = prefix.sorted_records(); // TODO(C++20): We only need a range that concatenate both - for (auto&& pkg : get_virtual_packages(ctx)) + for (auto&& pkg : get_virtual_packages(ctx.platform)) { pkgs.push_back(std::move(pkg)); } diff --git a/libmamba/src/core/virtual_packages.cpp b/libmamba/src/core/virtual_packages.cpp index fde31ad41e..4b94201441 100644 --- a/libmamba/src/core/virtual_packages.cpp +++ b/libmamba/src/core/virtual_packages.cpp @@ -243,12 +243,11 @@ namespace mamba return util::windows_version(); } - std::vector dist_packages(const Context& context) + std::vector dist_packages(const std::string& platform) { LOG_DEBUG << "Loading distribution virtual packages"; std::vector res; - const auto platform = context.platform; const auto split_platform = util::split(platform, "-", 1); if (split_platform.size() != 2) @@ -342,15 +341,15 @@ namespace mamba } } - std::vector get_virtual_packages(const Context& context) + std::vector get_virtual_packages(const std::string& platform) { LOG_DEBUG << "Loading virtual packages"; - auto res = detail::dist_packages(context); + auto res = detail::dist_packages(platform); auto cuda_ver = detail::cuda_version(); if (!cuda_ver.empty()) { - res.push_back(detail::make_virtual_package("__cuda", context.platform, cuda_ver)); + res.push_back(detail::make_virtual_package("__cuda", platform, cuda_ver)); } return res; diff --git a/libmamba/tests/src/core/test_virtual_packages.cpp b/libmamba/tests/src/core/test_virtual_packages.cpp index c93bc2e6ae..a71108801d 100644 --- a/libmamba/tests/src/core/test_virtual_packages.cpp +++ b/libmamba/tests/src/core/test_virtual_packages.cpp @@ -52,7 +52,7 @@ namespace mamba using Version = specs::Version; auto& ctx = mambatests::context(); - auto pkgs = detail::dist_packages(ctx); + auto pkgs = detail::dist_packages(ctx.platform); if (util::on_win) { @@ -86,9 +86,8 @@ namespace mamba auto restore_ctx = [&ctx, old_plat = ctx.platform]() { ctx.platform = old_plat; }; auto finally = Finally{ restore_ctx }; - ctx.platform = "osx-arm"; util::set_env("CONDA_OVERRIDE_OSX", "12.1"); - pkgs = detail::dist_packages(ctx); + pkgs = detail::dist_packages("osx-arm"); REQUIRE_EQ(pkgs.size(), 3); CHECK_EQ(pkgs[0].name, "__unix"); CHECK_EQ(pkgs[1].name, "__osx"); @@ -97,10 +96,9 @@ namespace mamba CHECK_EQ(pkgs[2].build_string, "arm"); util::unset_env("CONDA_OVERRIDE_OSX"); - ctx.platform = "linux-32"; util::set_env("CONDA_OVERRIDE_LINUX", "5.7"); util::set_env("CONDA_OVERRIDE_GLIBC", "2.15"); - pkgs = detail::dist_packages(ctx); + pkgs = detail::dist_packages("linux-32"); REQUIRE_EQ(pkgs.size(), 4); CHECK_EQ(pkgs[0].name, "__unix"); CHECK_EQ(pkgs[1].name, "__linux"); @@ -112,15 +110,13 @@ namespace mamba util::unset_env("CONDA_OVERRIDE_GLIBC"); util::unset_env("CONDA_OVERRIDE_LINUX"); - ctx.platform = "lin-850"; - pkgs = detail::dist_packages(ctx); + pkgs = detail::dist_packages("lin-850"); REQUIRE_EQ(pkgs.size(), 1); CHECK_EQ(pkgs[0].name, "__archspec"); CHECK_EQ(pkgs[0].build_string, "850"); util::unset_env("CONDA_SUBDIR"); - ctx.platform = "linux"; - pkgs = detail::dist_packages(ctx); + pkgs = detail::dist_packages("linux"); REQUIRE_EQ(pkgs.size(), 0); ctx.platform = ctx.host_platform; @@ -130,7 +126,7 @@ namespace mamba { util::set_env("CONDA_OVERRIDE_CUDA", "9.0"); const auto& context = mambatests::context(); - auto pkgs = get_virtual_packages(context); + auto pkgs = get_virtual_packages(context.platform); int pkgs_count; if (util::on_win) @@ -152,7 +148,7 @@ namespace mamba CHECK_EQ(pkgs.back().version, "9.0"); util::unset_env("CONDA_OVERRIDE_CUDA"); - pkgs = get_virtual_packages(context); + pkgs = get_virtual_packages(context.platform); if (!detail::cuda_version().empty()) { diff --git a/libmambapy/src/libmambapy/bindings/legacy.cpp b/libmambapy/src/libmambapy/bindings/legacy.cpp index 82acce79b3..861de46ec0 100644 --- a/libmambapy/src/libmambapy/bindings/legacy.cpp +++ b/libmambapy/src/libmambapy/bindings/legacy.cpp @@ -1208,7 +1208,10 @@ bind_submodule_impl(pybind11::module_ m) // py::arg("out_package"), py::arg("compression_level"), py::arg("compression_threads") = 1); - m.def("get_virtual_packages", [](Context& context) { return get_virtual_packages(context); }); + m.def( + "get_virtual_packages", + [](Context& context) { return get_virtual_packages(context.platform); } + ); m.def("cancel_json_output", [](Context&) { mambapy::singletons().console().cancel_json_print(); }); From b09f1d162f045fd796ac215823a075dfb0518606 Mon Sep 17 00:00:00 2001 From: Julien Jerphanion Date: Mon, 29 Jul 2024 11:06:45 +0200 Subject: [PATCH 009/126] Make more classes hashable and comparable (#3363) Signed-off-by: Julien Jerphanion Co-authored-by: Klaim --- .../include/mamba/specs/build_number_spec.hpp | 21 +++++ .../mamba/specs/chimera_string_spec.hpp | 21 +++++ libmamba/include/mamba/specs/glob_spec.hpp | 20 +++++ libmamba/include/mamba/specs/match_spec.hpp | 82 +++++++++++++++++++ libmamba/include/mamba/specs/package_info.hpp | 44 ++++++++++ libmamba/include/mamba/specs/regex_spec.hpp | 12 +++ .../mamba/specs/unresolved_channel.hpp | 22 +++++ libmamba/include/mamba/specs/version_spec.hpp | 30 +++++++ .../include/mamba/util/flat_binary_tree.hpp | 24 ++++++ .../mamba/util/flat_bool_expr_tree.hpp | 11 +++ libmamba/include/mamba/util/flat_set.hpp | 12 +++ libmamba/include/mamba/util/heap_optional.hpp | 28 +++++++ 12 files changed, 327 insertions(+) diff --git a/libmamba/include/mamba/specs/build_number_spec.hpp b/libmamba/include/mamba/specs/build_number_spec.hpp index b9e0533e9d..695d3f196f 100644 --- a/libmamba/include/mamba/specs/build_number_spec.hpp +++ b/libmamba/include/mamba/specs/build_number_spec.hpp @@ -15,6 +15,7 @@ #include #include "mamba/specs/error.hpp" +#include "mamba/util/tuple_hash.hpp" namespace mamba::specs { @@ -124,6 +125,17 @@ namespace mamba::specs */ [[nodiscard]] auto contains(BuildNumber point) const -> bool; + // TODO(C++20): replace by the `= default` implementation of `operator==` + [[nodiscard]] auto operator==(const BuildNumberSpec& other) const -> bool + { + return m_predicate == other.m_predicate; + } + + [[nodiscard]] auto operator!=(const BuildNumberSpec& other) const -> bool + { + return !(*this == other); + } + private: BuildNumberPredicate m_predicate; @@ -155,4 +167,13 @@ struct fmt::formatter format(const ::mamba::specs::BuildNumberSpec& spec, format_context& ctx) -> decltype(ctx.out()); }; +template <> +struct std::hash +{ + auto operator()(const mamba::specs::BuildNumberSpec& spec) const -> std::size_t + { + return mamba::util::hash_vals(spec.str()); + } +}; + #endif diff --git a/libmamba/include/mamba/specs/chimera_string_spec.hpp b/libmamba/include/mamba/specs/chimera_string_spec.hpp index e1cfbb7e15..c2f3112dd7 100644 --- a/libmamba/include/mamba/specs/chimera_string_spec.hpp +++ b/libmamba/include/mamba/specs/chimera_string_spec.hpp @@ -15,6 +15,7 @@ #include "mamba/specs/error.hpp" #include "mamba/specs/glob_spec.hpp" #include "mamba/specs/regex_spec.hpp" +#include "mamba/util/tuple_hash.hpp" namespace mamba::specs { @@ -51,6 +52,17 @@ namespace mamba::specs [[nodiscard]] auto str() const -> const std::string&; + // TODO(C++20): replace by the `= default` implementation of `operator==` + [[nodiscard]] auto operator==(const ChimeraStringSpec& other) const -> bool + { + return m_spec == other.m_spec; + } + + [[nodiscard]] auto operator!=(const ChimeraStringSpec& other) const -> bool + { + return !(*this == other); + } + private: Chimera m_spec; @@ -66,4 +78,13 @@ struct fmt::formatter format(const ::mamba::specs::ChimeraStringSpec& spec, format_context& ctx) -> decltype(ctx.out()); }; +template <> +struct std::hash +{ + auto operator()(const mamba::specs::ChimeraStringSpec& spec) const -> std::size_t + { + return mamba::util::hash_vals(spec.str()); + } +}; + #endif diff --git a/libmamba/include/mamba/specs/glob_spec.hpp b/libmamba/include/mamba/specs/glob_spec.hpp index 71d8411453..f4090f779d 100644 --- a/libmamba/include/mamba/specs/glob_spec.hpp +++ b/libmamba/include/mamba/specs/glob_spec.hpp @@ -43,6 +43,17 @@ namespace mamba::specs [[nodiscard]] auto str() const -> const std::string&; + // TODO(C++20): replace by the `= default` implementation of `operator==` + [[nodiscard]] auto operator==(const GlobSpec& other) const -> bool + { + return m_pattern == other.m_pattern; + } + + [[nodiscard]] auto operator!=(const GlobSpec& other) const -> bool + { + return !(*this == other); + } + private: std::string m_pattern = std::string(free_pattern); @@ -57,4 +68,13 @@ struct fmt::formatter auto format(const ::mamba::specs::GlobSpec& spec, format_context& ctx) -> decltype(ctx.out()); }; +template <> +struct std::hash +{ + auto operator()(const mamba::specs::GlobSpec& spec) const -> std::size_t + { + return std::hash{}(spec.str()); + } +}; + #endif diff --git a/libmamba/include/mamba/specs/match_spec.hpp b/libmamba/include/mamba/specs/match_spec.hpp index 52108f295c..1d690bacb1 100644 --- a/libmamba/include/mamba/specs/match_spec.hpp +++ b/libmamba/include/mamba/specs/match_spec.hpp @@ -22,6 +22,7 @@ #include "mamba/specs/version_spec.hpp" #include "mamba/util/flat_set.hpp" #include "mamba/util/heap_optional.hpp" +#include "mamba/util/tuple_hash.hpp" namespace mamba::specs { @@ -135,6 +136,28 @@ namespace mamba::specs */ [[nodiscard]] auto contains_except_channel(const PackageInfo& pkg) const -> bool; + // TODO(C++20): replace by the `= default` implementation of `operator==` + [[nodiscard]] auto operator==(const MatchSpec& other) const -> bool + { + return m_channel == other.m_channel // + && m_version == other.m_version // + && m_name == other.m_name // + && m_build_string == other.m_build_string // + && m_name_space == other.m_name_space // + && m_build_number == other.m_build_number // + && m_extra == other.m_extra; + } + + [[nodiscard]] auto operator!=(const MatchSpec& other) const -> bool + { + return !(*this == other); + } + + auto extra_members_hash() const -> std::size_t + { + return mamba::util::hash_vals(m_extra); + } + private: struct ExtraMembers @@ -150,7 +173,29 @@ namespace mamba::specs std::string features = {}; string_set track_features = {}; bool optional = false; + + // TODO(C++20): replace by the `= default` implementation of `operator==` + [[nodiscard]] auto operator==(const ExtraMembers& other) const -> bool + { + return filename == other.filename // + && subdirs == other.subdirs // + && md5 == other.md5 // + && sha256 == other.sha256 // + && license == other.license // + && license_family == other.license_family // + && features == other.features // + && track_features == other.track_features // + && optional == other.optional; + } + + [[nodiscard]] auto operator!=(const ExtraMembers& other) const -> bool + { + return !(*this == other); + } + + friend struct std::hash; }; + friend struct std::hash; std::optional m_channel; VersionSpec m_version; @@ -255,4 +300,41 @@ namespace mamba::specs return true; } } + +template <> +struct std::hash +{ + auto operator()(const mamba::specs::MatchSpec& spec) const -> std::size_t + { + return mamba::util::hash_vals( + spec.channel(), + spec.version(), + spec.name(), + spec.build_string(), + spec.name_space(), + spec.build_number(), + spec.extra_members_hash() + ); + } +}; + +template <> +struct std::hash +{ + auto operator()(const mamba::specs::MatchSpec::ExtraMembers& extra) const -> std::size_t + { + return mamba::util::hash_vals( + extra.filename, + extra.subdirs, + extra.md5, + extra.sha256, + extra.license, + extra.license_family, + extra.features, + extra.track_features, + extra.optional + ); + } +}; + #endif diff --git a/libmamba/include/mamba/specs/package_info.hpp b/libmamba/include/mamba/specs/package_info.hpp index 4623c30baa..cdd8916d55 100644 --- a/libmamba/include/mamba/specs/package_info.hpp +++ b/libmamba/include/mamba/specs/package_info.hpp @@ -15,6 +15,7 @@ #include "mamba/specs/error.hpp" #include "mamba/specs/platform.hpp" +#include "mamba/util/tuple_hash.hpp" namespace mamba::specs { @@ -81,4 +82,47 @@ namespace mamba::specs void from_json(const nlohmann::json& j, PackageInfo& pkg); } + +template <> +struct std::hash +{ + auto operator()(const mamba::specs::PackageInfo& pkg) const -> std::size_t + { + auto seed = std::size_t(0); + seed = mamba::util::hash_vals( + seed, + pkg.name, + pkg.version, + pkg.build_string, + pkg.build_number, + pkg.channel, + pkg.package_url, + pkg.platform, + pkg.filename, + pkg.license, + pkg.md5, + pkg.sha256, + pkg.signatures + ); + seed = mamba::util::hash_combine_val_range( + seed, + pkg.track_features.begin(), + pkg.track_features.end() + ); + seed = mamba::util::hash_combine_val_range( + seed, + pkg.dependencies.begin(), + pkg.dependencies.end() + ); + seed = mamba::util::hash_combine_val_range(seed, pkg.constrains.begin(), pkg.constrains.end()); + seed = mamba::util::hash_combine_val_range( + seed, + pkg.defaulted_keys.begin(), + pkg.defaulted_keys.end() + ); + seed = mamba::util::hash_vals(seed, pkg.noarch, pkg.size, pkg.timestamp, pkg.package_type); + return seed; + } +}; + #endif diff --git a/libmamba/include/mamba/specs/regex_spec.hpp b/libmamba/include/mamba/specs/regex_spec.hpp index 28420a0b6c..78610549e1 100644 --- a/libmamba/include/mamba/specs/regex_spec.hpp +++ b/libmamba/include/mamba/specs/regex_spec.hpp @@ -47,6 +47,18 @@ namespace mamba::specs [[nodiscard]] auto str() const -> const std::string&; + // TODO(C++20): replace by the `= default` implementation of `operator==` + [[nodiscard]] auto operator==(const RegexSpec& other) const -> bool + { + return m_raw_pattern == other.m_raw_pattern + && m_pattern.flags() == other.m_pattern.flags(); + } + + [[nodiscard]] auto operator!=(const RegexSpec& other) const -> bool + { + return !(*this == other); + } + private: std::regex m_pattern; diff --git a/libmamba/include/mamba/specs/unresolved_channel.hpp b/libmamba/include/mamba/specs/unresolved_channel.hpp index ac8096be8a..120dcef805 100644 --- a/libmamba/include/mamba/specs/unresolved_channel.hpp +++ b/libmamba/include/mamba/specs/unresolved_channel.hpp @@ -17,6 +17,7 @@ #include "mamba/specs/error.hpp" #include "mamba/specs/platform.hpp" #include "mamba/util/flat_set.hpp" +#include "mamba/util/tuple_hash.hpp" namespace mamba::specs { @@ -111,6 +112,18 @@ namespace mamba::specs [[nodiscard]] auto str() const -> std::string; + [[nodiscard]] auto operator==(const UnresolvedChannel& other) const -> bool + { + return m_location == other.m_location // + && m_platform_filters == other.m_platform_filters // + && m_type == other.m_type; + } + + [[nodiscard]] auto operator!=(const UnresolvedChannel& other) const -> bool + { + return !(*this == other); + } + private: std::string m_location = std::string(unknown_channel); @@ -137,4 +150,13 @@ struct fmt::formatter auto format(const UnresolvedChannel& uc, format_context& ctx) const -> format_context::iterator; }; +template <> +struct std::hash +{ + auto operator()(const mamba::specs::UnresolvedChannel& uc) const -> std::size_t + { + return mamba::util::hash_vals(uc.location(), uc.platform_filters(), static_cast(uc.type())); + } +}; + #endif diff --git a/libmamba/include/mamba/specs/version_spec.hpp b/libmamba/include/mamba/specs/version_spec.hpp index 62228e163f..7ed08ae8cd 100644 --- a/libmamba/include/mamba/specs/version_spec.hpp +++ b/libmamba/include/mamba/specs/version_spec.hpp @@ -17,6 +17,7 @@ #include "mamba/specs/error.hpp" #include "mamba/specs/version.hpp" #include "mamba/util/flat_bool_expr_tree.hpp" +#include "mamba/util/tuple_hash.hpp" namespace mamba::specs { @@ -195,6 +196,16 @@ namespace mamba::specs */ [[nodiscard]] auto expression_size() const -> std::size_t; + [[nodiscard]] auto operator==(const VersionSpec& other) const -> bool + { + return m_tree == other.m_tree; + } + + [[nodiscard]] auto operator!=(const VersionSpec& other) const -> bool + { + return !(*this == other); + } + private: tree_type m_tree; @@ -234,4 +245,23 @@ struct fmt::formatter auto format(const ::mamba::specs::VersionSpec& spec, format_context& ctx) -> decltype(ctx.out()); }; + +template <> +struct std::hash +{ + auto operator()(const mamba::specs::VersionPredicate& pred) const -> std::size_t + { + return mamba::util::hash_vals(pred.str()); + } +}; + +template <> +struct std::hash +{ + auto operator()(const mamba::specs::VersionSpec& spec) const -> std::size_t + { + return mamba::util::hash_vals(spec.str()); + } +}; + #endif diff --git a/libmamba/include/mamba/util/flat_binary_tree.hpp b/libmamba/include/mamba/util/flat_binary_tree.hpp index 749ba9ad16..01c3b26813 100644 --- a/libmamba/include/mamba/util/flat_binary_tree.hpp +++ b/libmamba/include/mamba/util/flat_binary_tree.hpp @@ -38,6 +38,19 @@ namespace mamba::util branch_type data; std::size_t left_child = 0; std::size_t right_child = 0; + + // TODO(C++20): replace by the `= default` implementation of `operator==` + [[nodiscard]] auto operator==(const branch_node& other) const -> bool + { + return data == other.data // + && left_child == other.left_child // + && right_child == other.right_child; + } + + [[nodiscard]] auto operator!=(const branch_node& other) const -> bool + { + return !(*this == other); + } }; using leaf_node = leaf_type; @@ -90,6 +103,17 @@ namespace mamba::util [[nodiscard]] auto right(idx_type idx) const -> idx_type; [[nodiscard]] auto root() const -> idx_type; + // TODO(C++20): replace by the `= default` implementation of `operator==` + [[nodiscard]] auto operator==(const flat_binary_tree& other) const -> bool + { + return m_nodes == other.m_nodes && m_root == other.m_root; + } + + [[nodiscard]] auto operator!=(const flat_binary_tree& other) const -> bool + { + return !(*this == other); + } + template void dfs_raw(Visitor&& visitor, idx_type start) const; diff --git a/libmamba/include/mamba/util/flat_bool_expr_tree.hpp b/libmamba/include/mamba/util/flat_bool_expr_tree.hpp index 93f797b0fc..abab3921ae 100644 --- a/libmamba/include/mamba/util/flat_bool_expr_tree.hpp +++ b/libmamba/include/mamba/util/flat_bool_expr_tree.hpp @@ -173,6 +173,17 @@ namespace mamba::util template void infix_for_each(UnaryFunc&& func) const; + // TODO(C++20): replace by the `= default` implementation of `operator==` + [[nodiscard]] auto operator==(const self_type& other) const -> bool + { + return m_tree == other.m_tree; + } + + [[nodiscard]] auto operator!=(const self_type& other) const -> bool + { + return !(*this == other); + } + private: using idx_type = typename tree_type::idx_type; diff --git a/libmamba/include/mamba/util/flat_set.hpp b/libmamba/include/mamba/util/flat_set.hpp index 55c7a96256..8796edd902 100644 --- a/libmamba/include/mamba/util/flat_set.hpp +++ b/libmamba/include/mamba/util/flat_set.hpp @@ -12,6 +12,8 @@ #include #include +#include "mamba/util/tuple_hash.hpp" + namespace mamba::util { @@ -557,4 +559,14 @@ namespace mamba::util return out; } } + +template +struct std::hash> +{ + auto operator()(const mamba::util::flat_set& set) const -> std::size_t + { + return mamba::util::hash_vals(set); + } +}; + #endif diff --git a/libmamba/include/mamba/util/heap_optional.hpp b/libmamba/include/mamba/util/heap_optional.hpp index 123bae5c67..2ff7e06e91 100644 --- a/libmamba/include/mamba/util/heap_optional.hpp +++ b/libmamba/include/mamba/util/heap_optional.hpp @@ -68,6 +68,20 @@ namespace mamba::util void reset(); + [[nodiscard]] auto operator==(const heap_optional& other) const -> bool + { + if (has_value() && other.has_value()) + { + return *m_ptr == *other; + } + return !has_value() && !other.has_value(); + } + + [[nodiscard]] auto operator!=(const heap_optional& other) const -> bool + { + return !(*this == other); + } + private: std::unique_ptr m_ptr = nullptr; @@ -236,4 +250,18 @@ namespace mamba::util m_ptr = nullptr; } } + +template +struct std::hash> +{ + std::size_t operator()(const mamba::util::heap_optional& opt) const + { + if (opt.has_value()) + { + return std::hash{}(*opt); + } + return 0; + } +}; + #endif From 4fbd22a9c0e136cf59a4f73fe7c34019a4f86344 Mon Sep 17 00:00:00 2001 From: Julien Jerphanion Date: Mon, 29 Jul 2024 16:28:56 +0200 Subject: [PATCH 010/126] build: Support fmt 11 (#3368) * build: Support fmt 11 Signed-off-by: Julien Jerphanion * fixup! build: Support fmt 11 Required for Windows. See: https://github.com/mamba-org/mamba/actions/runs/10144210776/job/28047211432?pr=3368#step:8:955 --------- Signed-off-by: Julien Jerphanion --- libmamba/include/mamba/download/mirror.hpp | 1 + libmamba/include/mamba/fs/filesystem.hpp | 2 +- libmamba/include/mamba/specs/build_number_spec.hpp | 6 +++--- libmamba/include/mamba/specs/chimera_string_spec.hpp | 4 ++-- libmamba/include/mamba/specs/glob_spec.hpp | 3 ++- libmamba/include/mamba/specs/match_spec.hpp | 3 ++- libmamba/include/mamba/specs/regex_spec.hpp | 3 ++- libmamba/include/mamba/specs/version.hpp | 6 +++--- libmamba/include/mamba/specs/version_spec.hpp | 7 ++++--- libmamba/src/api/install.cpp | 1 + libmamba/src/core/context.cpp | 2 +- libmamba/src/core/query.cpp | 1 + libmamba/src/core/run.cpp | 1 + libmamba/src/solver/libsolv/unsolvable.cpp | 1 + libmamba/src/specs/build_number_spec.cpp | 4 ++-- libmamba/src/specs/chimera_string_spec.cpp | 2 +- libmamba/src/specs/glob_spec.cpp | 6 ++++-- libmamba/src/specs/match_spec.cpp | 3 ++- libmamba/src/specs/package_info.cpp | 1 + libmamba/src/specs/regex_spec.cpp | 2 +- libmamba/src/specs/unresolved_channel.cpp | 1 + libmamba/src/specs/version.cpp | 4 ++-- libmamba/src/specs/version_spec.cpp | 4 ++-- libmamba/src/util/os_win.cpp | 1 + micromamba/src/run.cpp | 1 + 25 files changed, 43 insertions(+), 27 deletions(-) diff --git a/libmamba/include/mamba/download/mirror.hpp b/libmamba/include/mamba/download/mirror.hpp index 68f9e6c36d..a53bc7e01c 100644 --- a/libmamba/include/mamba/download/mirror.hpp +++ b/libmamba/include/mamba/download/mirror.hpp @@ -8,6 +8,7 @@ #define MAMBA_DOWNLOAD_MIRROR_HPP #include +#include #include #include #include diff --git a/libmamba/include/mamba/fs/filesystem.hpp b/libmamba/include/mamba/fs/filesystem.hpp index 362c987ed6..4e49780b92 100644 --- a/libmamba/include/mamba/fs/filesystem.hpp +++ b/libmamba/include/mamba/fs/filesystem.hpp @@ -1371,7 +1371,7 @@ struct fmt::formatter<::mamba::fs::u8path> } template - auto format(const ::mamba::fs::u8path& path, FormatContext& ctx) + auto format(const ::mamba::fs::u8path& path, FormatContext& ctx) const { return fmt::format_to(ctx.out(), "'{}'", path.string()); } diff --git a/libmamba/include/mamba/specs/build_number_spec.hpp b/libmamba/include/mamba/specs/build_number_spec.hpp index 695d3f196f..ddb1e717ca 100644 --- a/libmamba/include/mamba/specs/build_number_spec.hpp +++ b/libmamba/include/mamba/specs/build_number_spec.hpp @@ -154,7 +154,7 @@ struct fmt::formatter { auto parse(format_parse_context& ctx) -> decltype(ctx.begin()); - auto format(const ::mamba::specs::BuildNumberPredicate& pred, format_context& ctx) + auto format(const ::mamba::specs::BuildNumberPredicate& pred, format_context& ctx) const -> decltype(ctx.out()); }; @@ -163,8 +163,8 @@ struct fmt::formatter { auto parse(format_parse_context& ctx) -> decltype(ctx.begin()); - auto - format(const ::mamba::specs::BuildNumberSpec& spec, format_context& ctx) -> decltype(ctx.out()); + auto format(const ::mamba::specs::BuildNumberSpec& spec, format_context& ctx) const + -> decltype(ctx.out()); }; template <> diff --git a/libmamba/include/mamba/specs/chimera_string_spec.hpp b/libmamba/include/mamba/specs/chimera_string_spec.hpp index c2f3112dd7..d675f547b7 100644 --- a/libmamba/include/mamba/specs/chimera_string_spec.hpp +++ b/libmamba/include/mamba/specs/chimera_string_spec.hpp @@ -74,8 +74,8 @@ struct fmt::formatter { auto parse(format_parse_context& ctx) -> decltype(ctx.begin()); - auto - format(const ::mamba::specs::ChimeraStringSpec& spec, format_context& ctx) -> decltype(ctx.out()); + auto format(const ::mamba::specs::ChimeraStringSpec& spec, format_context& ctx) const + -> decltype(ctx.out()); }; template <> diff --git a/libmamba/include/mamba/specs/glob_spec.hpp b/libmamba/include/mamba/specs/glob_spec.hpp index f4090f779d..706dd7591c 100644 --- a/libmamba/include/mamba/specs/glob_spec.hpp +++ b/libmamba/include/mamba/specs/glob_spec.hpp @@ -65,7 +65,8 @@ struct fmt::formatter { auto parse(format_parse_context& ctx) -> decltype(ctx.begin()); - auto format(const ::mamba::specs::GlobSpec& spec, format_context& ctx) -> decltype(ctx.out()); + auto + format(const ::mamba::specs::GlobSpec& spec, format_context& ctx) const -> decltype(ctx.out()); }; template <> diff --git a/libmamba/include/mamba/specs/match_spec.hpp b/libmamba/include/mamba/specs/match_spec.hpp index 1d690bacb1..2f08d43ddd 100644 --- a/libmamba/include/mamba/specs/match_spec.hpp +++ b/libmamba/include/mamba/specs/match_spec.hpp @@ -229,7 +229,8 @@ struct fmt::formatter<::mamba::specs::MatchSpec> { auto parse(format_parse_context& ctx) -> decltype(ctx.begin()); - auto format(const ::mamba::specs::MatchSpec& spec, format_context& ctx) -> decltype(ctx.out()); + auto + format(const ::mamba::specs::MatchSpec& spec, format_context& ctx) const -> decltype(ctx.out()); }; /********************************* diff --git a/libmamba/include/mamba/specs/regex_spec.hpp b/libmamba/include/mamba/specs/regex_spec.hpp index 78610549e1..3c8b41d0bd 100644 --- a/libmamba/include/mamba/specs/regex_spec.hpp +++ b/libmamba/include/mamba/specs/regex_spec.hpp @@ -71,7 +71,8 @@ struct fmt::formatter { auto parse(format_parse_context& ctx) -> decltype(ctx.begin()); - auto format(const ::mamba::specs::RegexSpec& spec, format_context& ctx) -> decltype(ctx.out()); + auto + format(const ::mamba::specs::RegexSpec& spec, format_context& ctx) const -> decltype(ctx.out()); }; #endif diff --git a/libmamba/include/mamba/specs/version.hpp b/libmamba/include/mamba/specs/version.hpp index 4cfd4b7cb4..ef4cb77feb 100644 --- a/libmamba/include/mamba/specs/version.hpp +++ b/libmamba/include/mamba/specs/version.hpp @@ -177,8 +177,8 @@ struct fmt::formatter { auto parse(format_parse_context& ctx) -> decltype(ctx.begin()); - auto - format(const ::mamba::specs::VersionPartAtom atom, format_context& ctx) -> decltype(ctx.out()); + auto format(const ::mamba::specs::VersionPartAtom atom, format_context& ctx) const + -> decltype(ctx.out()); }; template <> @@ -188,7 +188,7 @@ struct fmt::formatter auto parse(format_parse_context& ctx) -> decltype(ctx.begin()); - auto format(const ::mamba::specs::Version v, format_context& ctx) -> decltype(ctx.out()); + auto format(const ::mamba::specs::Version v, format_context& ctx) const -> decltype(ctx.out()); }; #endif diff --git a/libmamba/include/mamba/specs/version_spec.hpp b/libmamba/include/mamba/specs/version_spec.hpp index 7ed08ae8cd..50c1b746cf 100644 --- a/libmamba/include/mamba/specs/version_spec.hpp +++ b/libmamba/include/mamba/specs/version_spec.hpp @@ -229,8 +229,8 @@ struct fmt::formatter auto parse(format_parse_context& ctx) -> decltype(ctx.begin()); - auto - format(const ::mamba::specs::VersionPredicate& pred, format_context& ctx) -> decltype(ctx.out()); + auto format(const ::mamba::specs::VersionPredicate& pred, format_context& ctx) const + -> decltype(ctx.out()); }; template <> @@ -243,7 +243,8 @@ struct fmt::formatter auto parse(format_parse_context& ctx) -> decltype(ctx.begin()); - auto format(const ::mamba::specs::VersionSpec& spec, format_context& ctx) -> decltype(ctx.out()); + auto + format(const ::mamba::specs::VersionSpec& spec, format_context& ctx) const -> decltype(ctx.out()); }; template <> diff --git a/libmamba/src/api/install.cpp b/libmamba/src/api/install.cpp index 9a81292cba..abba952c53 100644 --- a/libmamba/src/api/install.cpp +++ b/libmamba/src/api/install.cpp @@ -9,6 +9,7 @@ #include #include #include +#include #include #include diff --git a/libmamba/src/core/context.cpp b/libmamba/src/core/context.cpp index e4acb04518..e58ad01b27 100644 --- a/libmamba/src/core/context.cpp +++ b/libmamba/src/core/context.cpp @@ -6,8 +6,8 @@ #include -#include #include +#include #include #include #include diff --git a/libmamba/src/core/query.cpp b/libmamba/src/core/query.cpp index 0861b544ae..3b5194cbf7 100644 --- a/libmamba/src/core/query.cpp +++ b/libmamba/src/core/query.cpp @@ -14,6 +14,7 @@ #include #include #include +#include #include "mamba/core/context.hpp" #include "mamba/core/output.hpp" diff --git a/libmamba/src/core/run.cpp b/libmamba/src/core/run.cpp index dadfe6724f..9644fcba48 100644 --- a/libmamba/src/core/run.cpp +++ b/libmamba/src/core/run.cpp @@ -26,6 +26,7 @@ extern "C" #include #include #include +#include #include #include #include diff --git a/libmamba/src/solver/libsolv/unsolvable.cpp b/libmamba/src/solver/libsolv/unsolvable.cpp index cfc14c79d5..cbbdcbbea7 100644 --- a/libmamba/src/solver/libsolv/unsolvable.cpp +++ b/libmamba/src/solver/libsolv/unsolvable.cpp @@ -8,6 +8,7 @@ #include #include +#include #include #include diff --git a/libmamba/src/specs/build_number_spec.cpp b/libmamba/src/specs/build_number_spec.cpp index 860c189883..90222da43c 100644 --- a/libmamba/src/specs/build_number_spec.cpp +++ b/libmamba/src/specs/build_number_spec.cpp @@ -113,7 +113,7 @@ auto fmt::formatter::format( const ::mamba::specs::BuildNumberPredicate& pred, format_context& ctx -) -> decltype(ctx.out()) +) const -> decltype(ctx.out()) { using BuildNumberPredicate = typename mamba::specs::BuildNumberPredicate; using BuildNumber = typename BuildNumberPredicate::BuildNumber; @@ -268,7 +268,7 @@ auto fmt::formatter::format( const ::mamba::specs::BuildNumberSpec& spec, format_context& ctx -) -> decltype(ctx.out()) +) const -> decltype(ctx.out()) { return fmt::format_to(ctx.out(), "{}", spec.m_predicate); } diff --git a/libmamba/src/specs/chimera_string_spec.cpp b/libmamba/src/specs/chimera_string_spec.cpp index 0260b063a7..01bc227264 100644 --- a/libmamba/src/specs/chimera_string_spec.cpp +++ b/libmamba/src/specs/chimera_string_spec.cpp @@ -140,7 +140,7 @@ auto fmt::formatter::format( const ::mamba::specs::ChimeraStringSpec& spec, format_context& ctx -) -> decltype(ctx.out()) +) const -> decltype(ctx.out()) { return fmt::format_to(ctx.out(), "{}", spec.str()); } diff --git a/libmamba/src/specs/glob_spec.cpp b/libmamba/src/specs/glob_spec.cpp index cbbe2aadf9..723ff13cbb 100644 --- a/libmamba/src/specs/glob_spec.cpp +++ b/libmamba/src/specs/glob_spec.cpp @@ -56,8 +56,10 @@ fmt::formatter::parse(format_parse_context& ctx) -> decl } auto -fmt::formatter::format(const ::mamba::specs::GlobSpec& spec, format_context& ctx) - -> decltype(ctx.out()) +fmt::formatter::format( + const ::mamba::specs::GlobSpec& spec, + format_context& ctx +) const -> decltype(ctx.out()) { return fmt::format_to(ctx.out(), "{}", spec.str()); } diff --git a/libmamba/src/specs/match_spec.cpp b/libmamba/src/specs/match_spec.cpp index d4fb4fbf98..0af970dbc4 100644 --- a/libmamba/src/specs/match_spec.cpp +++ b/libmamba/src/specs/match_spec.cpp @@ -9,6 +9,7 @@ #include #include +#include #include "mamba/specs/archive.hpp" #include "mamba/specs/match_spec.hpp" @@ -1069,7 +1070,7 @@ auto fmt::formatter<::mamba::specs::MatchSpec>::format( const ::mamba::specs::MatchSpec& spec, format_context& ctx -) -> decltype(ctx.out()) +) const -> decltype(ctx.out()) { using MatchSpec = ::mamba::specs::MatchSpec; diff --git a/libmamba/src/specs/package_info.cpp b/libmamba/src/specs/package_info.cpp index 28a192b4b9..dd4003bc33 100644 --- a/libmamba/src/specs/package_info.cpp +++ b/libmamba/src/specs/package_info.cpp @@ -11,6 +11,7 @@ #include #include +#include #include #include "mamba/specs/archive.hpp" diff --git a/libmamba/src/specs/regex_spec.cpp b/libmamba/src/specs/regex_spec.cpp index 4f5cca1fe0..2f970aa588 100644 --- a/libmamba/src/specs/regex_spec.cpp +++ b/libmamba/src/specs/regex_spec.cpp @@ -102,7 +102,7 @@ auto fmt::formatter::format( const ::mamba::specs::RegexSpec& spec, format_context& ctx -) -> decltype(ctx.out()) +) const -> decltype(ctx.out()) { return fmt::format_to(ctx.out(), "{}", spec.str()); } diff --git a/libmamba/src/specs/unresolved_channel.cpp b/libmamba/src/specs/unresolved_channel.cpp index ff7bb0942c..d59c028de0 100644 --- a/libmamba/src/specs/unresolved_channel.cpp +++ b/libmamba/src/specs/unresolved_channel.cpp @@ -13,6 +13,7 @@ #include #include +#include #include "mamba/fs/filesystem.hpp" #include "mamba/specs/archive.hpp" diff --git a/libmamba/src/specs/version.cpp b/libmamba/src/specs/version.cpp index d46115d95b..9a0bade8f9 100644 --- a/libmamba/src/specs/version.cpp +++ b/libmamba/src/specs/version.cpp @@ -191,7 +191,7 @@ auto fmt::formatter::format( const ::mamba::specs::VersionPartAtom atom, format_context& ctx -) -> decltype(ctx.out()) +) const -> decltype(ctx.out()) { return fmt::format_to(ctx.out(), "{}{}", atom.numeral(), atom.literal()); } @@ -792,7 +792,7 @@ fmt::formatter::parse(format_parse_context& ctx) -> declt auto fmt::formatter::format(const ::mamba::specs::Version v, format_context& ctx) - -> decltype(ctx.out()) + const -> decltype(ctx.out()) { auto out = ctx.out(); if (v.epoch() != 0) diff --git a/libmamba/src/specs/version_spec.cpp b/libmamba/src/specs/version_spec.cpp index 9180ee397c..c68058a68c 100644 --- a/libmamba/src/specs/version_spec.cpp +++ b/libmamba/src/specs/version_spec.cpp @@ -195,7 +195,7 @@ auto fmt::formatter::format( const ::mamba::specs::VersionPredicate& pred, format_context& ctx -) -> decltype(ctx.out()) +) const -> decltype(ctx.out()) { using VersionPredicate = typename mamba::specs::VersionPredicate; using VersionSpec = typename mamba::specs::VersionSpec; @@ -589,7 +589,7 @@ auto fmt::formatter::format( const ::mamba::specs::VersionSpec& spec, format_context& ctx -) -> decltype(ctx.out()) +) const -> decltype(ctx.out()) { using VersionSpec = typename mamba::specs::VersionSpec; diff --git a/libmamba/src/util/os_win.cpp b/libmamba/src/util/os_win.cpp index 49d6f8ab7b..2d10fdb06e 100644 --- a/libmamba/src/util/os_win.cpp +++ b/libmamba/src/util/os_win.cpp @@ -10,6 +10,7 @@ #include #include +#include #include #include "mamba/util/environment.hpp" diff --git a/micromamba/src/run.cpp b/micromamba/src/run.cpp index dbf1c1893d..1df4d9e877 100644 --- a/micromamba/src/run.cpp +++ b/micromamba/src/run.cpp @@ -10,6 +10,7 @@ #include #include +#include #include #include #include From de040eb225bba0db34c9514532f1795532157f66 Mon Sep 17 00:00:00 2001 From: Hind-M <70631848+Hind-M@users.noreply.github.com> Date: Tue, 30 Jul 2024 10:57:23 +0200 Subject: [PATCH 011/126] Restore previous behavior of `MAMBA_ROOT_PREFIX` (#3365) Restore previous behavior --- libmamba/src/api/configuration.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libmamba/src/api/configuration.cpp b/libmamba/src/api/configuration.cpp index 44e97af773..90219e3c8d 100644 --- a/libmamba/src/api/configuration.cpp +++ b/libmamba/src/api/configuration.cpp @@ -624,8 +624,8 @@ namespace mamba } if (!fs::exists(prefix / "pkgs") // - || !fs::exists(prefix / "conda-meta") // - || !fs::exists(prefix / "envs")) + && !fs::exists(prefix / "conda-meta") // + && !fs::exists(prefix / "envs")) { return make_unexpected( fmt::format(R"(Path "{}" is not an existing root prefix.)", prefix.string()), From d0d7eea49a9083c15aa73c58645abc93549f6ddd Mon Sep 17 00:00:00 2001 From: Julien Jerphanion Date: Tue, 30 Jul 2024 15:57:15 +0200 Subject: [PATCH 012/126] build: Support fmt 11 (follow-up) (#3371) * build: Support fmt 11 A few other elements were required, as observed in: https://github.com/mamba-org/mamba/pull/3352 Signed-off-by: Julien Jerphanion * Unpin python on 3.9 Signed-off-by: Julien Jerphanion * ci: use libcxx<18 for macOS Signed-off-by: Julien Jerphanion * Add TODO comment Co-authored-by: Hind-M Signed-off-by: Julien Jerphanion --------- Signed-off-by: Julien Jerphanion --- .github/workflows/unix_impl.yml | 6 ++++++ dev/environment-dev.yml | 2 +- libmamba/tests/src/doctest-printer/array.hpp | 1 + libmamba/tests/src/doctest-printer/flat_set.hpp | 1 + libmamba/tests/src/doctest-printer/vector.hpp | 1 + libmamba/tests/src/solver/test_problems_graph.cpp | 1 + 6 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.github/workflows/unix_impl.yml b/.github/workflows/unix_impl.yml index 7d04dde8e3..ceabf716b4 100644 --- a/.github/workflows/unix_impl.yml +++ b/.github/workflows/unix_impl.yml @@ -28,6 +28,12 @@ jobs: environment-file: ./dev/environment-dev.yml environment-name: build_env cache-environment: true + - name: Use libcxx <18 (see conda-forge/libcxx-feedstock#162) + # TODO: remove this step once the issue is fixed + # See: https://github.com/conda-forge/libcxx-feedstock/issues/162 + if: startsWith(inputs.os, 'macos') + run: | + micromamba install -n build_env -c conda-forge "libcxx<18" - uses: hendrikmuhs/ccache-action@main with: variant: sccache diff --git a/dev/environment-dev.yml b/dev/environment-dev.yml index 592784fcd3..de7c75d022 100644 --- a/dev/environment-dev.yml +++ b/dev/environment-dev.yml @@ -24,7 +24,7 @@ dependencies: # micromamba dependencies - cli11 >=2.2 # micromamba test dependencies - - python =3.9 # Some not too recent version + - python - mitmproxy - pytest >=7.3.0 - pytest-asyncio diff --git a/libmamba/tests/src/doctest-printer/array.hpp b/libmamba/tests/src/doctest-printer/array.hpp index 123ffff927..6b544689b0 100644 --- a/libmamba/tests/src/doctest-printer/array.hpp +++ b/libmamba/tests/src/doctest-printer/array.hpp @@ -8,6 +8,7 @@ #include #include +#include namespace doctest { diff --git a/libmamba/tests/src/doctest-printer/flat_set.hpp b/libmamba/tests/src/doctest-printer/flat_set.hpp index 4d028df987..3c19821ef1 100644 --- a/libmamba/tests/src/doctest-printer/flat_set.hpp +++ b/libmamba/tests/src/doctest-printer/flat_set.hpp @@ -6,6 +6,7 @@ #include #include +#include #include "mamba/util/flat_set.hpp" diff --git a/libmamba/tests/src/doctest-printer/vector.hpp b/libmamba/tests/src/doctest-printer/vector.hpp index cb06beb52c..f988257e6e 100644 --- a/libmamba/tests/src/doctest-printer/vector.hpp +++ b/libmamba/tests/src/doctest-printer/vector.hpp @@ -8,6 +8,7 @@ #include #include +#include namespace doctest { diff --git a/libmamba/tests/src/solver/test_problems_graph.cpp b/libmamba/tests/src/solver/test_problems_graph.cpp index 01a639c1c5..87223292b2 100644 --- a/libmamba/tests/src/solver/test_problems_graph.cpp +++ b/libmamba/tests/src/solver/test_problems_graph.cpp @@ -11,6 +11,7 @@ #include #include +#include #include #include "mamba/core/channel_context.hpp" From ca8cee50feb2a03816e3db2cfdae49d43b7143cb Mon Sep 17 00:00:00 2001 From: Julien Jerphanion Date: Tue, 30 Jul 2024 17:35:50 +0200 Subject: [PATCH 013/126] test: Comparability and hashability of `PackageInfo` and `MatchSpec` (#3369) test: Add test for comparability and hashability Signed-off-by: Julien Jerphanion --- libmamba/include/mamba/specs/match_spec.hpp | 5 +-- libmamba/include/mamba/specs/regex_spec.hpp | 9 +++++ libmamba/include/mamba/util/flat_set.hpp | 2 +- libmamba/include/mamba/util/heap_optional.hpp | 13 ------- libmamba/src/specs/match_spec.cpp | 5 +++ .../src/specs/test_build_number_spec.cpp | 18 ++++++++++ .../src/specs/test_chimera_string_spec.cpp | 14 ++++++++ libmamba/tests/src/specs/test_glob_spec.cpp | 14 ++++++++ libmamba/tests/src/specs/test_match_spec.cpp | 27 +++++++++++++++ .../tests/src/specs/test_package_info.cpp | 34 +++++++++++++++++++ libmamba/tests/src/specs/test_regex_spec.cpp | 14 ++++++++ .../src/specs/test_unresolved_channel.cpp | 14 ++++++++ .../tests/src/specs/test_version_spec.cpp | 15 ++++++++ 13 files changed, 166 insertions(+), 18 deletions(-) diff --git a/libmamba/include/mamba/specs/match_spec.hpp b/libmamba/include/mamba/specs/match_spec.hpp index 2f08d43ddd..1d4ceaa1e2 100644 --- a/libmamba/include/mamba/specs/match_spec.hpp +++ b/libmamba/include/mamba/specs/match_spec.hpp @@ -153,10 +153,7 @@ namespace mamba::specs return !(*this == other); } - auto extra_members_hash() const -> std::size_t - { - return mamba::util::hash_vals(m_extra); - } + auto extra_members_hash() const -> std::size_t; private: diff --git a/libmamba/include/mamba/specs/regex_spec.hpp b/libmamba/include/mamba/specs/regex_spec.hpp index 3c8b41d0bd..74edbbecc2 100644 --- a/libmamba/include/mamba/specs/regex_spec.hpp +++ b/libmamba/include/mamba/specs/regex_spec.hpp @@ -75,4 +75,13 @@ struct fmt::formatter format(const ::mamba::specs::RegexSpec& spec, format_context& ctx) const -> decltype(ctx.out()); }; +template <> +struct std::hash +{ + auto operator()(const mamba::specs::RegexSpec& spec) const -> std::size_t + { + return std::hash{}(spec.str()); + } +}; + #endif diff --git a/libmamba/include/mamba/util/flat_set.hpp b/libmamba/include/mamba/util/flat_set.hpp index 8796edd902..8275a3b3bd 100644 --- a/libmamba/include/mamba/util/flat_set.hpp +++ b/libmamba/include/mamba/util/flat_set.hpp @@ -565,7 +565,7 @@ struct std::hash> { auto operator()(const mamba::util::flat_set& set) const -> std::size_t { - return mamba::util::hash_vals(set); + return mamba::util::hash_range(set); } }; diff --git a/libmamba/include/mamba/util/heap_optional.hpp b/libmamba/include/mamba/util/heap_optional.hpp index 2ff7e06e91..ae53f82f1a 100644 --- a/libmamba/include/mamba/util/heap_optional.hpp +++ b/libmamba/include/mamba/util/heap_optional.hpp @@ -251,17 +251,4 @@ namespace mamba::util } } -template -struct std::hash> -{ - std::size_t operator()(const mamba::util::heap_optional& opt) const - { - if (opt.has_value()) - { - return std::hash{}(*opt); - } - return 0; - } -}; - #endif diff --git a/libmamba/src/specs/match_spec.cpp b/libmamba/src/specs/match_spec.cpp index 0af970dbc4..405eb447c5 100644 --- a/libmamba/src/specs/match_spec.cpp +++ b/libmamba/src/specs/match_spec.cpp @@ -1044,6 +1044,11 @@ namespace mamba::specs return *m_extra; } + auto MatchSpec::extra_members_hash() const -> std::size_t + { + return std::hash{}(m_extra.value_or(ExtraMembers())); + } + namespace match_spec_literals { auto operator""_ms(const char* str, std::size_t len) -> MatchSpec diff --git a/libmamba/tests/src/specs/test_build_number_spec.cpp b/libmamba/tests/src/specs/test_build_number_spec.cpp index 26295da717..98b8fa0112 100644 --- a/libmamba/tests/src/specs/test_build_number_spec.cpp +++ b/libmamba/tests/src/specs/test_build_number_spec.cpp @@ -137,4 +137,22 @@ TEST_SUITE("specs::build_number_spec") CHECK_FALSE(BuildNumberSpec::parse("=3").value().is_explicitly_free()); CHECK_FALSE(BuildNumberSpec::parse("<2").value().is_explicitly_free()); } + + TEST_CASE("Comparability and hashability") + { + auto bn1 = BuildNumberSpec::parse("=3").value(); + auto bn2 = BuildNumberSpec::parse("3").value(); + auto bn3 = BuildNumberSpec::parse("*").value(); + + CHECK_EQ(bn1, bn2); + CHECK_NE(bn1, bn3); + + auto hash_fn = std::hash{}; + auto bn1_hash = hash_fn(bn1); + auto bn2_hash = hash_fn(bn2); + auto bn3_hash = hash_fn(bn3); + + CHECK_EQ(bn1_hash, bn2_hash); + CHECK_NE(bn1_hash, bn3_hash); + } } diff --git a/libmamba/tests/src/specs/test_chimera_string_spec.cpp b/libmamba/tests/src/specs/test_chimera_string_spec.cpp index 4a91039cb3..caf437b1a9 100644 --- a/libmamba/tests/src/specs/test_chimera_string_spec.cpp +++ b/libmamba/tests/src/specs/test_chimera_string_spec.cpp @@ -70,4 +70,18 @@ TEST_SUITE("specs::chimera_string_spec") CHECK_FALSE(spec.is_exact()); CHECK_FALSE(spec.is_glob()); } + + TEST_CASE("Comparability and hashability") + { + auto spec1 = ChimeraStringSpec::parse("mkl").value(); + auto spec2 = ChimeraStringSpec::parse("mkl").value(); + auto spec3 = ChimeraStringSpec::parse("*").value(); + + CHECK_EQ(spec1, spec2); + CHECK_NE(spec1, spec3); + + std::hash hash_fn; + CHECK_EQ(hash_fn(spec1), hash_fn(spec2)); + CHECK_NE(hash_fn(spec1), hash_fn(spec3)); + } } diff --git a/libmamba/tests/src/specs/test_glob_spec.cpp b/libmamba/tests/src/specs/test_glob_spec.cpp index 461fb2a25b..0d99a8ae4c 100644 --- a/libmamba/tests/src/specs/test_glob_spec.cpp +++ b/libmamba/tests/src/specs/test_glob_spec.cpp @@ -55,4 +55,18 @@ TEST_SUITE("specs::glob_spec") CHECK_FALSE(spec.is_free()); CHECK_FALSE(spec.is_exact()); } + + TEST_CASE("Comparability and hashability") + { + auto spec1 = GlobSpec("py*"); + auto spec2 = GlobSpec("py*"); + auto spec3 = GlobSpec("pyth*"); + + CHECK_EQ(spec1, spec2); + CHECK_NE(spec1, spec3); + + auto hash_fn = std::hash(); + CHECK_EQ(hash_fn(spec1), hash_fn(spec2)); + CHECK_NE(hash_fn(spec1), hash_fn(spec3)); + } } diff --git a/libmamba/tests/src/specs/test_match_spec.cpp b/libmamba/tests/src/specs/test_match_spec.cpp index 4a83d7a752..63b76d36bf 100644 --- a/libmamba/tests/src/specs/test_match_spec.cpp +++ b/libmamba/tests/src/specs/test_match_spec.cpp @@ -812,4 +812,31 @@ TEST_SUITE("specs::match_spec") })); } } + + TEST_CASE("MatchSpec comparability and hashability") + { + using namespace specs::match_spec_literals; + using namespace specs::version_literals; + + const auto spec1 = "py*>=3.7=bld[build_number='<=2', md5=lemd5, track_features='mkl,openssl']"_ms; + + // Create an identical specification + const auto spec2 = "py*>=3.7=bld[build_number='<=2', md5=lemd5, track_features='mkl,openssl']"_ms; + + // Create a different specification + const auto spec3 = "py*>=3.7=bld[build_number='<=2', md5=lemd5, track_features='mkl']"_ms; + + // Check that the two copies are equal + CHECK_EQ(spec1, spec2); + // Check that the different specification is not equal to the first one + CHECK_NE(spec1, spec3); + + // Check that the hash of the two copies is the same + auto spec1_hash = std::hash{}(spec1); + auto spec2_hash = std::hash{}(spec2); + auto spec3_hash = std::hash{}(spec3); + + CHECK_EQ(spec1_hash, spec2_hash); + CHECK_NE(spec1_hash, spec3_hash); + } } diff --git a/libmamba/tests/src/specs/test_package_info.cpp b/libmamba/tests/src/specs/test_package_info.cpp index 87a306aab7..1a321709f4 100644 --- a/libmamba/tests/src/specs/test_package_info.cpp +++ b/libmamba/tests/src/specs/test_package_info.cpp @@ -190,5 +190,39 @@ TEST_SUITE("specs::package_info") CHECK_FALSE(j.get() != pkg); } } + + SUBCASE("PackageInfo comparability and hashability") + { + auto pkg2 = PackageInfo(); + pkg2.name = "foo"; + pkg2.version = "4.0"; + pkg2.build_string = "mybld"; + pkg2.build_number = 5; + pkg2.noarch = NoArchType::Generic; + pkg2.channel = "conda-forge"; + pkg2.package_url = "https://repo.mamba.pm/conda-forge/linux-64/foo-4.0-mybld.conda"; + pkg2.platform = "linux-64"; + pkg2.filename = "foo-4.0-mybld.conda"; + pkg2.license = "MIT"; + pkg2.size = 3200; + pkg2.timestamp = 4532; + pkg2.sha256 = "01ba4719c80b6fe911b091a7c05124b64eeece964e09c058ef8f9805daca546b"; + pkg2.signatures = R"("signatures": { "some_file.tar.bz2": { "a133184c9c7a651f55db194031a6c1240b798333923dc9319d1fe2c94a1242d": { "signature": "7a67a875d0454c14671d960a02858e059d154876dab6b3873304a27102063c9c25"}}})"; + pkg2.md5 = "68b329da9893e34099c7d8ad5cb9c940"; + pkg2.track_features = { "mkl", "blas" }; + pkg2.dependencies = { "python>=3.7", "requests" }; + pkg2.constrains = { "pip>=2.1" }; + + auto hash_fn = std::hash{}; + + CHECK_EQ(pkg, pkg2); + CHECK_EQ(hash_fn(pkg), hash_fn(pkg2)); + + + pkg2.md5[0] = '0'; + + CHECK_NE(pkg, pkg2); + CHECK_NE(hash_fn(pkg), hash_fn(pkg2)); + } } } diff --git a/libmamba/tests/src/specs/test_regex_spec.cpp b/libmamba/tests/src/specs/test_regex_spec.cpp index f6dec9944d..8785519211 100644 --- a/libmamba/tests/src/specs/test_regex_spec.cpp +++ b/libmamba/tests/src/specs/test_regex_spec.cpp @@ -66,4 +66,18 @@ TEST_SUITE("specs::regex_spec") CHECK_FALSE(spec.is_explicitly_free()); CHECK_FALSE(spec.is_exact()); } + + TEST_CASE("Comparability and hashability") + { + auto spec1 = RegexSpec::parse("pyth*").value(); + auto spec2 = RegexSpec::parse("pyth*").value(); + auto spec3 = RegexSpec::parse("python").value(); + + CHECK_EQ(spec1, spec2); + CHECK_NE(spec1, spec3); + + auto hash_fn = std::hash(); + CHECK_EQ(hash_fn(spec1), hash_fn(spec2)); + CHECK_NE(hash_fn(spec1), hash_fn(spec3)); + } } diff --git a/libmamba/tests/src/specs/test_unresolved_channel.cpp b/libmamba/tests/src/specs/test_unresolved_channel.cpp index b4b3bceb4a..1a88162efd 100644 --- a/libmamba/tests/src/specs/test_unresolved_channel.cpp +++ b/libmamba/tests/src/specs/test_unresolved_channel.cpp @@ -242,4 +242,18 @@ TEST_SUITE("specs::unresolved_channel") "location[linux-64,noarch]" ); } + + TEST_CASE("Comparability and hashability") + { + auto uc1 = UnresolvedChannel::parse("conda-forge").value(); + auto uc2 = UnresolvedChannel::parse("conda-forge").value(); + auto uc3 = UnresolvedChannel::parse("conda-forge/linux-64").value(); + + CHECK_EQ(uc1, uc2); + CHECK_NE(uc1, uc3); + + auto hash_fn = std::hash(); + CHECK_EQ(hash_fn(uc1), hash_fn(uc2)); + CHECK_NE(hash_fn(uc1), hash_fn(uc3)); + } } diff --git a/libmamba/tests/src/specs/test_version_spec.cpp b/libmamba/tests/src/specs/test_version_spec.cpp index fb5c097ef1..6b80fdaa79 100644 --- a/libmamba/tests/src/specs/test_version_spec.cpp +++ b/libmamba/tests/src/specs/test_version_spec.cpp @@ -444,4 +444,19 @@ TEST_SUITE("specs::version_spec") CHECK_FALSE(VersionSpec::parse("==2.3|!=2.3").value().is_explicitly_free()); CHECK_FALSE(VersionSpec::parse("=2.3,<3.0").value().is_explicitly_free()); } + + + TEST_CASE("Comparability and hashability") + { + auto spec1 = VersionSpec::parse("*").value(); + auto spec2 = VersionSpec::parse("*").value(); + auto spec3 = VersionSpec::parse("=2.4").value(); + + CHECK_EQ(spec1, spec2); + CHECK_NE(spec1, spec3); + + auto hash_fn = std::hash(); + CHECK_EQ(hash_fn(spec1), hash_fn(spec2)); + CHECK_NE(hash_fn(spec1), hash_fn(spec3)); + } } From 16fec215e9de533b0156ff262aa65530c3212408 Mon Sep 17 00:00:00 2001 From: Julien Jerphanion Date: Wed, 31 Jul 2024 18:39:50 +0200 Subject: [PATCH 014/126] test: Adapt test_explicit_export_topologically_sorted (#3377) As of pip 24.1.2 distribution on conda-forge, pip does not depend on wheel anymore: https://github.com/conda-forge/pip-feedstock/pull/121/files#diff-f3725a55bf339595bf865fec73bda8ac99f283b0810c205442021f29c06eea9aR21-R25 Hence wheel index being 0 causing the bug. Let's omit it entirely. Signed-off-by: Julien Jerphanion --- micromamba/tests/test_env.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/micromamba/tests/test_env.py b/micromamba/tests/test_env.py index 793595e653..29ce3bda5b 100644 --- a/micromamba/tests/test_env.py +++ b/micromamba/tests/test_env.py @@ -184,7 +184,6 @@ def test_explicit_export_topologically_sorted(tmp_home, tmp_prefix): indices = { "libzlib": 0, "python": 0, - "wheel": 0, "pip": 0, "jupyterlab": 0, } @@ -194,6 +193,5 @@ def test_explicit_export_topologically_sorted(tmp_home, tmp_prefix): indices[pkg] = i assert indices["libzlib"] < indices["python"] - assert indices["python"] < indices["wheel"] - assert indices["wheel"] < indices["pip"] + assert indices["python"] < indices["pip"] assert indices["python"] < indices["jupyterlab"] From bc89383ca726630deb258f9106caa3dfab804047 Mon Sep 17 00:00:00 2001 From: Julien Jerphanion Date: Thu, 1 Aug 2024 09:16:30 +0200 Subject: [PATCH 015/126] ci: Unpin libcxx <18 (#3375) Signed-off-by: Julien Jerphanion --- .github/workflows/unix_impl.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/unix_impl.yml b/.github/workflows/unix_impl.yml index ceabf716b4..7d04dde8e3 100644 --- a/.github/workflows/unix_impl.yml +++ b/.github/workflows/unix_impl.yml @@ -28,12 +28,6 @@ jobs: environment-file: ./dev/environment-dev.yml environment-name: build_env cache-environment: true - - name: Use libcxx <18 (see conda-forge/libcxx-feedstock#162) - # TODO: remove this step once the issue is fixed - # See: https://github.com/conda-forge/libcxx-feedstock/issues/162 - if: startsWith(inputs.os, 'macos') - run: | - micromamba install -n build_env -c conda-forge "libcxx<18" - uses: hendrikmuhs/ccache-action@main with: variant: sccache From d6629217150c7f2f145e7335e72202ef7bad337f Mon Sep 17 00:00:00 2001 From: jaimergp Date: Thu, 1 Aug 2024 14:27:42 +0200 Subject: [PATCH 016/126] Unpin cryptography, python, and add make to environment-dev.yml (#3352) --- dev/environment-dev.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/dev/environment-dev.yml b/dev/environment-dev.yml index de7c75d022..9f8283d326 100644 --- a/dev/environment-dev.yml +++ b/dev/environment-dev.yml @@ -6,6 +6,7 @@ dependencies: - cmake >=3.16 - pkg-config # Used by some CMake dependencies - ninja + - make # not always present # libmamba dependencies - cpp-expected - fmt @@ -34,7 +35,7 @@ dependencies: - sel(win): menuinst - conda-content-trust - conda-package-handling - - cryptography<40.0 # Or breaks conda-content-trust + - cryptography - securesystemslib # libmambapy build dependencies - scikit-build From 9663cbfdacea14c95797de3f3df4f7a272a3a171 Mon Sep 17 00:00:00 2001 From: Hind-M <70631848+Hind-M@users.noreply.github.com> Date: Fri, 2 Aug 2024 14:52:17 +0200 Subject: [PATCH 017/126] Add missing header (#3389) --- libmamba/include/mamba/download/mirror_map.hpp | 1 + 1 file changed, 1 insertion(+) diff --git a/libmamba/include/mamba/download/mirror_map.hpp b/libmamba/include/mamba/download/mirror_map.hpp index 5fdae26ebc..adc4548d38 100644 --- a/libmamba/include/mamba/download/mirror_map.hpp +++ b/libmamba/include/mamba/download/mirror_map.hpp @@ -7,6 +7,7 @@ #ifndef MAMBA_DOWNLOAD_MIRROR_MAP_HPP #define MAMBA_DOWNLOAD_MIRROR_MAP_HPP +#include #include #include #include From c7563b8617d88415f2badce58f5a561c673cd91c Mon Sep 17 00:00:00 2001 From: Casper van Elteren Date: Tue, 6 Aug 2024 10:54:34 +0200 Subject: [PATCH 018/126] Reset the prompt back to default (#3392) --- libmamba/src/core/shell_init.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libmamba/src/core/shell_init.cpp b/libmamba/src/core/shell_init.cpp index e2d413b8da..bffe508eb7 100644 --- a/libmamba/src/core/shell_init.cpp +++ b/libmamba/src/core/shell_init.cpp @@ -464,8 +464,8 @@ namespace mamba load-env {$keyValue.0.key: $keyValue.0.value} } } - # update prompt - $env.PROMPT_COMMAND = $env.PROMPT_COMMAND + # reset prompt + $env.PROMPT_COMMAND = $env.PROMPT_COMMAND_BK } })###" << "\n"; content << "# <<< mamba initialize <<<\n"; From d17ebc52cc70894576df4299fe2426f943071347 Mon Sep 17 00:00:00 2001 From: Hind-M <70631848+Hind-M@users.noreply.github.com> Date: Thu, 8 Aug 2024 12:00:45 +0200 Subject: [PATCH 019/126] [micromamba] Fix behavior of `env update` (to mimick conda) (#3396) * Fix behavior of env update (to mimick conda) * Code review: Use struct and enum class for update parameters --- libmamba/include/mamba/api/update.hpp | 39 ++++++++-- libmamba/src/api/c_api.cpp | 4 +- libmamba/src/api/update.cpp | 100 +++++++++++++++++--------- micromamba/src/env.cpp | 11 ++- micromamba/src/update.cpp | 13 +++- micromamba/tests/test_env.py | 21 +++--- 6 files changed, 136 insertions(+), 52 deletions(-) diff --git a/libmamba/include/mamba/api/update.hpp b/libmamba/include/mamba/api/update.hpp index e976362382..59695aba54 100644 --- a/libmamba/include/mamba/api/update.hpp +++ b/libmamba/include/mamba/api/update.hpp @@ -11,12 +11,39 @@ namespace mamba { class Configuration; - void update( - Configuration& config, - bool update_all = false, - bool prune_deps = false, - bool remove_not_specified = false - ); + enum class UpdateAll : bool + { + No = false, + Yes = true, + }; + + enum class PruneDeps : bool + { + No = false, + Yes = true, + }; + + enum class EnvUpdate : bool // Specific to `env update` command + { + No = false, + Yes = true, + }; + + enum class RemoveNotSpecified : bool // Specific to `env update` command + { + No = false, + Yes = true, + }; + + struct UpdateParams + { + UpdateAll update_all = UpdateAll::No; + PruneDeps prune_deps = PruneDeps::No; + EnvUpdate env_update = EnvUpdate::No; + RemoveNotSpecified remove_not_specified = RemoveNotSpecified::No; + }; + + void update(Configuration& config, const UpdateParams& update_params = {}); } #endif diff --git a/libmamba/src/api/c_api.cpp b/libmamba/src/api/c_api.cpp index 3c6b859a64..7947b3b048 100644 --- a/libmamba/src/api/c_api.cpp +++ b/libmamba/src/api/c_api.cpp @@ -101,7 +101,9 @@ mamba_update(mamba::Configuration* config, int update_all) assert(config != nullptr); try { - update(*config, update_all); + mamba::UpdateParams update_params{}; + update_params.update_all = update_all ? mamba::UpdateAll::Yes : mamba::UpdateAll::No; + update(*config, update_params); return 0; } catch (...) diff --git a/libmamba/src/api/update.cpp b/libmamba/src/api/update.cpp index ecfb7dfda1..ea79d5149f 100644 --- a/libmamba/src/api/update.cpp +++ b/libmamba/src/api/update.cpp @@ -25,18 +25,16 @@ namespace mamba auto create_update_request( PrefixData& prefix_data, std::vector specs, - bool update_all, - bool prune_deps, - bool remove_not_specified + const UpdateParams& update_params ) -> solver::Request { using Request = solver::Request; auto request = Request(); - if (update_all) + if (update_params.update_all == UpdateAll::Yes) { - if (prune_deps) + if (update_params.prune_deps == PruneDeps::Yes) { auto hist_map = prefix_data.history().get_requested_specs_map(); request.jobs.reserve(hist_map.size() + 1); @@ -55,31 +53,69 @@ namespace mamba else { request.jobs.reserve(specs.size()); - if (remove_not_specified) + if (update_params.env_update == EnvUpdate::Yes) { - auto hist_map = prefix_data.history().get_requested_specs_map(); - for (auto& it : hist_map) + if (update_params.remove_not_specified == RemoveNotSpecified::Yes) { - if (std::find(specs.begin(), specs.end(), it.second.name().str()) - == specs.end()) + auto hist_map = prefix_data.history().get_requested_specs_map(); + for (auto& it : hist_map) { - request.jobs.emplace_back(Request::Remove{ - specs::MatchSpec::parse(it.second.name().str()) - .or_else([](specs::ParseError&& err) { throw std::move(err); }) - .value(), - /* .clean_dependencies= */ true, - }); + // We use `spec_names` here because `specs` contain more info than just + // the spec name. + // Therefore, the search later and comparison (using `specs`) with + // MatchSpec.name().str() in `hist_map` second elements wouldn't be + // relevant + std::vector spec_names; + spec_names.reserve(specs.size()); + std::transform( + specs.begin(), + specs.end(), + std::back_inserter(spec_names), + [](const std::string& spec) + { + return specs::MatchSpec::parse(spec) + .or_else([](specs::ParseError&& err) + { throw std::move(err); }) + .value() + .name() + .str(); + } + ); + + if (std::find(spec_names.begin(), spec_names.end(), it.second.name().str()) + == spec_names.end()) + { + request.jobs.emplace_back(Request::Remove{ + specs::MatchSpec::parse(it.second.name().str()) + .or_else([](specs::ParseError&& err) + { throw std::move(err); }) + .value(), + /* .clean_dependencies= */ true, + }); + } } } - } - for (const auto& raw_ms : specs) + // Install/update everything in specs + for (const auto& raw_ms : specs) + { + request.jobs.emplace_back(Request::Install{ + specs::MatchSpec::parse(raw_ms) + .or_else([](specs::ParseError&& err) { throw std::move(err); }) + .value(), + }); + } + } + else { - request.jobs.emplace_back(Request::Update{ - specs::MatchSpec::parse(raw_ms) - .or_else([](specs::ParseError&& err) { throw std::move(err); }) - .value(), - }); + for (const auto& raw_ms : specs) + { + request.jobs.emplace_back(Request::Update{ + specs::MatchSpec::parse(raw_ms) + .or_else([](specs::ParseError&& err) { throw std::move(err); }) + .value(), + }); + } } } @@ -87,7 +123,7 @@ namespace mamba } } - void update(Configuration& config, bool update_all, bool prune_deps, bool remove_not_specified) + void update(Configuration& config, const UpdateParams& update_params) { auto& ctx = config.context(); @@ -139,13 +175,7 @@ namespace mamba load_installed_packages_in_database(ctx, db, prefix_data); - auto request = create_update_request( - prefix_data, - raw_update_specs, - /* update_all= */ update_all, - /* prune_deps= */ prune_deps, - /* remove_not_specified= */ remove_not_specified - ); + auto request = create_update_request(prefix_data, raw_update_specs, update_params); add_pins_to_request( request, ctx, @@ -187,17 +217,17 @@ namespace mamba ); - auto execute_transaction = [&](MTransaction& transaction) + auto execute_transaction = [&](MTransaction& trans) { if (ctx.output_params.json) { - transaction.log_json(); + trans.log_json(); } - bool yes = transaction.prompt(ctx, channel_context); + bool yes = trans.prompt(ctx, channel_context); if (yes) { - transaction.execute(ctx, channel_context, prefix_data); + trans.execute(ctx, channel_context, prefix_data); } }; diff --git a/micromamba/src/env.cpp b/micromamba/src/env.cpp index f50d8aedb5..6967f51136 100644 --- a/micromamba/src/env.cpp +++ b/micromamba/src/env.cpp @@ -284,6 +284,15 @@ set_env_command(CLI::App* com, Configuration& config) update_subcom->callback( [&config] - { update(config, /*update_all*/ false, /*prune_deps*/ false, remove_not_specified); } + { + auto update_params = UpdateParams{ + UpdateAll::No, + PruneDeps::Yes, + EnvUpdate::Yes, + remove_not_specified ? RemoveNotSpecified::Yes : RemoveNotSpecified::No, + }; + + update(config, update_params); + } ); } diff --git a/micromamba/src/update.cpp b/micromamba/src/update.cpp index 4429e17230..185f19aeca 100644 --- a/micromamba/src/update.cpp +++ b/micromamba/src/update.cpp @@ -209,7 +209,18 @@ set_update_command(CLI::App* subcom, Configuration& config) subcom->get_option("specs")->description("Specs to update in the environment"); subcom->add_flag("-a,--all", update_all, "Update all packages in the environment"); - subcom->callback([&] { return update(config, update_all, prune_deps); }); + subcom->callback( + [&] + { + auto update_params = UpdateParams{ + update_all ? UpdateAll::Yes : UpdateAll::No, + prune_deps ? PruneDeps::Yes : PruneDeps::No, + EnvUpdate::No, + RemoveNotSpecified::No, + }; + return update(config, update_params); + } + ); } void diff --git a/micromamba/tests/test_env.py b/micromamba/tests/test_env.py index 29ce3bda5b..dd543a3b43 100644 --- a/micromamba/tests/test_env.py +++ b/micromamba/tests/test_env.py @@ -125,11 +125,12 @@ def test_env_remove(tmp_home, tmp_root_prefix): assert str(env_fp) not in lines -env_yaml_content = """ +env_yaml_content_with_version_and_new_pkg = """ channels: - conda-forge dependencies: -- python +- python 3.11.* +- ipython """ @@ -138,22 +139,23 @@ def test_env_remove(tmp_home, tmp_root_prefix): def test_env_update(tmp_home, tmp_root_prefix, tmp_path, prune): env_name = "env-create-update" - # Create env with python=3.11.0 and xtensor=0.25.0 - helpers.create("python=3.11.0", "xtensor=0.25.0", "-n", env_name, "--json", no_dry_run=True) + # Create env with python=3.10.0 and xtensor=0.25.0 + helpers.create("python=3.10.0", "xtensor=0.25.0", "-n", env_name, "--json", no_dry_run=True) packages = helpers.umamba_list("-n", env_name, "--json") assert any( - package["name"] == "python" and package["version"] == "3.11.0" for package in packages + package["name"] == "python" and package["version"] == "3.10.0" for package in packages ) assert any( package["name"] == "xtensor" and package["version"] == "0.25.0" for package in packages ) assert any(package["name"] == "xtl" for package in packages) + assert not any(package["name"] == "ipython" for package in packages) # Update python from packaging.version import Version env_file_yml = tmp_path / "test_env.yaml" - env_file_yml.write_text(env_yaml_content) + env_file_yml.write_text(env_yaml_content_with_version_and_new_pkg) cmd = ["update", "-n", env_name, f"--file={env_file_yml}", "-y"] if prune: @@ -161,12 +163,15 @@ def test_env_update(tmp_home, tmp_root_prefix, tmp_path, prune): helpers.run_env(*cmd) packages = helpers.umamba_list("-n", env_name, "--json") assert any( - package["name"] == "python" and Version(package["version"]) > Version("3.11.0") + package["name"] == "python" and Version(package["version"]) >= Version("3.11.0") for package in packages ) + assert any(package["name"] == "ipython" for package in packages) if prune: assert not any(package["name"] == "xtensor" for package in packages) - # Make sure dependencies of removed pkgs are removed as well (xtl is a dep of xtensor) + # Make sure dependencies of removed pkgs are removed as well + # since `prune_deps` is always set to true in the case of `env update` command + # (xtl is a dep of xtensor) assert not any(package["name"] == "xtl" for package in packages) else: assert any( From 83fdeae46572a05a1657395cccccbab74e8710d3 Mon Sep 17 00:00:00 2001 From: Hind-M <70631848+Hind-M@users.noreply.github.com> Date: Mon, 12 Aug 2024 17:02:23 +0200 Subject: [PATCH 020/126] [win-64] Add constraint on fmt (#3400) Add constraint on fmt (until next release) --- .github/workflows/static_build.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/static_build.yml b/.github/workflows/static_build.yml index 605ce1aafe..7f3327f209 100644 --- a/.github/workflows/static_build.yml +++ b/.github/workflows/static_build.yml @@ -136,13 +136,15 @@ jobs: with: environment-name: mambabuild init-shell: bash cmd.exe + # Constraint on fmt is due to an issue with 11.0.2 (to be fixed in next version) + # cf. https://github.com/fmtlib/fmt/issues/4091 create-args: >- cli11>=2.2,<3 cpp-expected nlohmann_json simdjson-static>=3.3.0 spdlog - fmt + fmt<=11.0.1 yaml-cpp-static>=0.8.0 libsolv-static>=0.7.24 reproc-cpp-static>=14.2.4.post0 From aec5390597ea4236a2b84668b6d43502858036cc Mon Sep 17 00:00:00 2001 From: Hind-M <70631848+Hind-M@users.noreply.github.com> Date: Mon, 12 Aug 2024 18:02:08 +0200 Subject: [PATCH 021/126] [win-64] Remove workaround (#3398) Remove workaround (issue now fixed) --- .github/workflows/static_build.yml | 4 ---- 1 file changed, 4 deletions(-) diff --git a/.github/workflows/static_build.yml b/.github/workflows/static_build.yml index 7f3327f209..ac798d4a8e 100644 --- a/.github/workflows/static_build.yml +++ b/.github/workflows/static_build.yml @@ -150,9 +150,6 @@ jobs: reproc-cpp-static>=14.2.4.post0 - name: build micromamba shell: cmd /C call {0} - # Using D_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR is a workaround to fix CI failure on win-64 - # after updating runners to 20240603.1 image - # (cf. https://github.com/actions/runner-images/issues/10004#issuecomment-2153445161) run: | set CMAKE_PREFIX_PATH=.\vcpkg_installed\x64-windows-static-md;%CONDA_PREFIX%\Library cmake -S . ^ @@ -160,7 +157,6 @@ jobs: -D CMAKE_CXX_COMPILER_LAUNCHER=sccache ^ -D CMAKE_C_COMPILER_LAUNCHER=sccache ^ -D CMAKE_MSVC_RUNTIME_LIBRARY="MultiThreadedDLL" ^ - -D CMAKE_CXX_FLAGS=" /D_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR" ^ -D CMAKE_BUILD_TYPE="Release" ^ -D BUILD_LIBMAMBA=ON ^ -D BUILD_STATIC=ON ^ From f4ab0b237700053ab71d068d60c9751cd5bf593d Mon Sep 17 00:00:00 2001 From: Hind Montassif Date: Mon, 19 Aug 2024 09:16:57 +0200 Subject: [PATCH 022/126] release libmamba 2.0.0rc2, libmambapy 2.0.0rc2, micromamba 2.0.0rc2 --- CHANGELOG.md | 28 ++++++++++++++++++++++++++++ libmamba/CHANGELOG.md | 25 +++++++++++++++++++++++++ libmambapy/CHANGELOG.md | 14 ++++++++++++++ micromamba/CHANGELOG.md | 19 +++++++++++++++++++ 4 files changed, 86 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 89843cc6f8..519e509948 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,31 @@ +2024.08.19 +========== + +Releases: libmamba 2.0.0rc2, libmambapy 2.0.0rc2, micromamba 2.0.0rc2 + +Enhancements: + +- [micromamba] test: Adapt test_explicit_export_topologically_sorted by @jjerphan in https://github.com/mamba-org/mamba/pull/3377 +- [libmamba] test: Comparability and hashability of `PackageInfo` and `MatchSpec` by @jjerphan in https://github.com/mamba-org/mamba/pull/3369 +- [libmamba] build: Support fmt 11 (follow-up) by @jjerphan in https://github.com/mamba-org/mamba/pull/3371 +- [libmamba, micromamba] build: Support fmt 11 by @jjerphan in https://github.com/mamba-org/mamba/pull/3368 +- [libmamba] Make more classes hashable and comparable by @jjerphan in https://github.com/mamba-org/mamba/pull/3363 +- [libmambapy, libmamba] Replace `Context` with `Context::platform` where possible by @jjerphan in https://github.com/mamba-org/mamba/pull/3364 + +Bug fixes: + +- [libmamba, micromamba] [micromamba] Fix behavior of `env update` (to mimick conda) by @Hind-M in https://github.com/mamba-org/mamba/pull/3396 +- [libmamba] Reset the prompt back to default by @cvanelteren in https://github.com/mamba-org/mamba/pull/3392 +- [libmamba] Add missing header by @Hind-M in https://github.com/mamba-org/mamba/pull/3389 +- [libmamba] Restore previous behavior of `MAMBA_ROOT_PREFIX` by @Hind-M in https://github.com/mamba-org/mamba/pull/3365 + +CI fixes and doc: + +- [all] [win-64] Remove workaround by @Hind-M in https://github.com/mamba-org/mamba/pull/3398 +- [all] [win-64] Add constraint on fmt by @Hind-M in https://github.com/mamba-org/mamba/pull/3400 +- [all] Unpin cryptography, python, and add make to environment-dev.yml by @jaimergp in https://github.com/mamba-org/mamba/pull/3352 +- [all] ci: Unpin libcxx <18 by @jjerphan in https://github.com/mamba-org/mamba/pull/3375 + 2024.07.26 ========== diff --git a/libmamba/CHANGELOG.md b/libmamba/CHANGELOG.md index 54db0b31dc..c13d805870 100644 --- a/libmamba/CHANGELOG.md +++ b/libmamba/CHANGELOG.md @@ -1,3 +1,28 @@ +libmamba 2.0.0rc2 (August 19, 2024) +=================================== + +Enhancements: + +- test: Comparability and hashability of `PackageInfo` and `MatchSpec` by @jjerphan in https://github.com/mamba-org/mamba/pull/3369 +- build: Support fmt 11 (follow-up) by @jjerphan in https://github.com/mamba-org/mamba/pull/3371 +- build: Support fmt 11 by @jjerphan in https://github.com/mamba-org/mamba/pull/3368 +- Make more classes hashable and comparable by @jjerphan in https://github.com/mamba-org/mamba/pull/3363 +- Replace `Context` with `Context::platform` where possible by @jjerphan in https://github.com/mamba-org/mamba/pull/3364 + +Bug fixes: + +- [micromamba] Fix behavior of `env update` (to mimick conda) by @Hind-M in https://github.com/mamba-org/mamba/pull/3396 +- Reset the prompt back to default by @cvanelteren in https://github.com/mamba-org/mamba/pull/3392 +- Add missing header by @Hind-M in https://github.com/mamba-org/mamba/pull/3389 +- Restore previous behavior of `MAMBA_ROOT_PREFIX` by @Hind-M in https://github.com/mamba-org/mamba/pull/3365 + +CI fixes and doc: + +- [win-64] Remove workaround by @Hind-M in https://github.com/mamba-org/mamba/pull/3398 +- [win-64] Add constraint on fmt by @Hind-M in https://github.com/mamba-org/mamba/pull/3400 +- Unpin cryptography, python, and add make to environment-dev.yml by @jaimergp in https://github.com/mamba-org/mamba/pull/3352 +- ci: Unpin libcxx <18 by @jjerphan in https://github.com/mamba-org/mamba/pull/3375 + libmamba 2.0.0rc1 (July 26, 2024) ================================= diff --git a/libmambapy/CHANGELOG.md b/libmambapy/CHANGELOG.md index ac4c3f7f3d..dde6488de3 100644 --- a/libmambapy/CHANGELOG.md +++ b/libmambapy/CHANGELOG.md @@ -1,3 +1,17 @@ +libmambapy 2.0.0rc2 (August 19, 2024) +===================================== + +Enhancements: + +- Replace `Context` with `Context::platform` where possible by @jjerphan in https://github.com/mamba-org/mamba/pull/3364 + +CI fixes and doc: + +- [win-64] Remove workaround by @Hind-M in https://github.com/mamba-org/mamba/pull/3398 +- [win-64] Add constraint on fmt by @Hind-M in https://github.com/mamba-org/mamba/pull/3400 +- Unpin cryptography, python, and add make to environment-dev.yml by @jaimergp in https://github.com/mamba-org/mamba/pull/3352 +- ci: Unpin libcxx <18 by @jjerphan in https://github.com/mamba-org/mamba/pull/3375 + libmambapy 2.0.0rc1 (July 26, 2024) =================================== diff --git a/micromamba/CHANGELOG.md b/micromamba/CHANGELOG.md index 346174f3e0..9a71008c2b 100644 --- a/micromamba/CHANGELOG.md +++ b/micromamba/CHANGELOG.md @@ -1,3 +1,22 @@ +micromamba 2.0.0rc2 (August 19, 2024) +===================================== + +Enhancements: + +- test: Adapt test_explicit_export_topologically_sorted by @jjerphan in https://github.com/mamba-org/mamba/pull/3377 +- build: Support fmt 11 by @jjerphan in https://github.com/mamba-org/mamba/pull/3368 + +Bug fixes: + +- [micromamba] Fix behavior of `env update` (to mimick conda) by @Hind-M in https://github.com/mamba-org/mamba/pull/3396 + +CI fixes and doc: + +- [win-64] Remove workaround by @Hind-M in https://github.com/mamba-org/mamba/pull/3398 +- [win-64] Add constraint on fmt by @Hind-M in https://github.com/mamba-org/mamba/pull/3400 +- Unpin cryptography, python, and add make to environment-dev.yml by @jaimergp in https://github.com/mamba-org/mamba/pull/3352 +- ci: Unpin libcxx <18 by @jjerphan in https://github.com/mamba-org/mamba/pull/3375 + micromamba 2.0.0rc1 (July 26, 2024) =================================== From 227034872711b85f1e9403ae337fafd240692109 Mon Sep 17 00:00:00 2001 From: Julien Jerphanion Date: Wed, 21 Aug 2024 05:14:20 -0400 Subject: [PATCH 023/126] docs: Adapt "Solving Package Environments" section (#3326) Signed-off-by: Julien Jerphanion --- docs/source/usage/solver.rst | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/source/usage/solver.rst b/docs/source/usage/solver.rst index 1cfc269132..91a045655e 100644 --- a/docs/source/usage/solver.rst +++ b/docs/source/usage/solver.rst @@ -13,12 +13,11 @@ Solving Package Environments The :any:`libmambapy.solver ` submodule contains a generic API for solving requirements (|MatchSpec|) into a list of packages (|PackageInfo|) with no conflicting dependencies. -This problem is hard to solve (`NP-complete `_) which -is why Mamba uses a `SAT solver `_ to do so. .. note:: - There is currently only one solver available in Mamba: + Solving Package Environments can be cast as a Boolean satisfiability problem (SAT). + Mamba currently only uses one `SAT solver `_: `LibSolv `_. For this reason, the generic interface has not been fully completed and users need to access the submodule :any:`libmambapy.solver.libsolv ` for certain types. @@ -57,15 +56,16 @@ The first way to add a repository is from a list of |PackageInfo| using The second way of loading packages is through Conda's repository index format ``repodata.json`` using -:cpp:func:`DataBase.add_repo_from_repodata `. +:cpp:func:`DataBase.add_repo_from_repodata_json `. This is meant for convenience, and is not a performant alternative to the former method, since these files grow large. .. code:: python - repo2 = db.add_repo_from_repodata( + repo2 = db.add_repo_from_repodata_json( path="path/to/repodata.json", url="htts://conda.anaconda.org/conda-forge/linux-64", + channel_id="conda-forge", ) One of the repositories can be set to have a special meaning of "installed repository". From a33950261b650e5f2cf76d7a71def90a4554c633 Mon Sep 17 00:00:00 2001 From: Sylvain Corlay Date: Fri, 23 Aug 2024 10:45:23 +0200 Subject: [PATCH 024/126] Replaces instances of -p with --root-prefix in documentation (#3411) --- docs/source/installation/micromamba-installation.rst | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/source/installation/micromamba-installation.rst b/docs/source/installation/micromamba-installation.rst index 78c084fde7..e7c55ec66f 100644 --- a/docs/source/installation/micromamba-installation.rst +++ b/docs/source/installation/micromamba-installation.rst @@ -115,13 +115,13 @@ This also allows you to choose a custom MAMBA_ROOT_ENVIRONMENT, which is where t .. code:: sh # Linux/bash: - ./bin/micromamba shell init -s bash -p ~/micromamba # this writes to your .bashrc file + ./bin/micromamba shell init -s bash -r ~/micromamba # this writes to your .bashrc file # sourcing the bashrc file incorporates the changes into the running session. # better yet, restart your terminal! source ~/.bashrc # macOS/zsh: - ./micromamba shell init -s zsh -p ~/micromamba + ./micromamba shell init -s zsh -r ~/micromamba source ~/.zshrc Now you can activate the base environment and install new packages, or create other environments. @@ -164,7 +164,7 @@ Windows .\micromamba.exe shell hook -s powershell | Out-String | Invoke-Expression # ... or initialize the shell - .\micromamba.exe shell init -s powershell -p C:\Your\Root\Prefix + .\micromamba.exe shell init -s powershell -r C:\Your\Root\Prefix # and use micromamba directly micromamba create -f ./test/env_win.yaml -y micromamba activate yourenv From ae84962dcfb1bc2470443d83ac8a0a8266179f63 Mon Sep 17 00:00:00 2001 From: Julien Jerphanion Date: Fri, 23 Aug 2024 04:46:02 -0400 Subject: [PATCH 025/126] Add posix to supported shells (#3412) Signed-off-by: Julien Jerphanion --- micromamba/src/activate.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/micromamba/src/activate.cpp b/micromamba/src/activate.cpp index 0f1d9e4af9..269be3b6ba 100644 --- a/micromamba/src/activate.cpp +++ b/micromamba/src/activate.cpp @@ -78,7 +78,7 @@ set_activate_command(CLI::App* subcom) "Otherwise, this may be an issue. In the meantime you can run commands. See:\n" " $ {exe} run --help\n" "\n" - "Supported shells are {{bash, zsh, csh, xonsh, cmd.exe, powershell, fish, nu}}.\n", + "Supported shells are {{bash, zsh, csh, posix, xonsh, cmd.exe, powershell, fish, nu}}.\n", get_shell_hook(guessed_shell), guessed_shell, fmt::arg("exe", get_self_exe_path().stem().string()) From 0bd2ee6ecf5f17160cfbb7d1c584b3d248f38d12 Mon Sep 17 00:00:00 2001 From: Julien Jerphanion Date: Mon, 26 Aug 2024 14:14:55 +0200 Subject: [PATCH 026/126] Define `etc/profile.d/mamba.sh` and install it (#3413) * Install profile.d directory * Format Signed-off-by: Julien Jerphanion * Package etc/profile.d/mamba.sh Signed-off-by: Julien Jerphanion * Just install mamba.sh directly Signed-off-by: Julien Jerphanion * Modify env specification to invalidate its cache FYI, the "build" package has been yanked: https://prefix.dev/channels/conda-forge/packages/build Signed-off-by: Julien Jerphanion * Empty commit to retrigger CI Signed-off-by: Julien Jerphanion * Change output path of the script Signed-off-by: Julien Jerphanion * Revert uneeded changes Signed-off-by: Julien Jerphanion --------- Signed-off-by: Julien Jerphanion Co-authored-by: Sylvain Corlay --- dev/environment-dev.yml | 1 - mamba_package/CMakeLists.txt | 18 +++++++++++++++++- mamba_package/etc/profile.d/mamba.sh.in | 7 +++++++ 3 files changed, 24 insertions(+), 2 deletions(-) create mode 100644 mamba_package/etc/profile.d/mamba.sh.in diff --git a/dev/environment-dev.yml b/dev/environment-dev.yml index 9f8283d326..6511f9582a 100644 --- a/dev/environment-dev.yml +++ b/dev/environment-dev.yml @@ -39,7 +39,6 @@ dependencies: - securesystemslib # libmambapy build dependencies - scikit-build - - build - pybind11-stubgen <1.0 # libmambapy dependencies - python diff --git a/mamba_package/CMakeLists.txt b/mamba_package/CMakeLists.txt index 2ad10df6b5..23a23e95ab 100644 --- a/mamba_package/CMakeLists.txt +++ b/mamba_package/CMakeLists.txt @@ -9,6 +9,7 @@ cmake_policy(SET CMP0025 NEW) # Introduced in cmake 3.0 cmake_policy(SET CMP0077 NEW) # Introduced in cmake 3.13 project(mamba-package) +include(GNUInstallDirs) # Source files # ============ @@ -37,4 +38,19 @@ target_link_libraries(mamba-package PRIVATE mamba::libmamba) set_target_properties(mamba-package PROPERTIES CXX_STANDARD 17) -install(TARGETS mamba-package) +configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/etc/profile.d/mamba.sh.in" + "${CMAKE_CURRENT_BINARY_DIR}/etc/profile.d/mamba.sh" +) + +install( + FILES ${CMAKE_CURRENT_BINARY_DIR}/etc/profile.d/mamba.sh + DESTINATION ${CMAKE_INSTALL_PREFIX}/etc/profile.d/ +) + +install( + TARGETS mamba-package + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} +) diff --git a/mamba_package/etc/profile.d/mamba.sh.in b/mamba_package/etc/profile.d/mamba.sh.in new file mode 100644 index 0000000000..9cbe6d1369 --- /dev/null +++ b/mamba_package/etc/profile.d/mamba.sh.in @@ -0,0 +1,7 @@ +__mamba_setup="$("@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_BINDIR@/mamba" shell hook --shell zsh --root-prefix "@CMAKE_INSTALL_PREFIX@" 2> /dev/null)" +if [ $? -eq 0 ]; then + eval "$__mamba_setup" +else + alias micromamba="@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_BINDIR@/mamba" # Fallback on help from mamba activate +fi +unset __mamba_setup From aaf8d206aeaebd2636f392a415863e6d44164f4c Mon Sep 17 00:00:00 2001 From: Hind Montassif Date: Mon, 26 Aug 2024 15:44:46 +0200 Subject: [PATCH 027/126] release libmamba 2.0.0rc3, libmambapy 2.0.0rc3, micromamba 2.0.0rc3 --- CHANGELOG.md | 15 +++++++++++++++ libmamba/CHANGELOG.md | 12 ++++++++++++ libmambapy/CHANGELOG.md | 12 ++++++++++++ micromamba/CHANGELOG.md | 13 +++++++++++++ 4 files changed, 52 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 519e509948..24d970b2bb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,18 @@ +2024.08.26 +========== + +Releases: libmamba 2.0.0rc3, libmambapy 2.0.0rc3, micromamba 2.0.0rc3 + +Bug fixes: + +- [all] Define `etc/profile.d/mamba.sh` and install it by @jjerphan in https://github.com/mamba-org/mamba/pull/3413 +- [micromamba] Add posix to supported shells by @jjerphan in https://github.com/mamba-org/mamba/pull/3412 +- [all] Replaces instances of -p with --root-prefix in documentation by @SylvainCorlay in https://github.com/mamba-org/mamba/pull/3411 + +CI fixes and doc: + +- [all] docs: Adapt "Solving Package Environments" section by @jjerphan in https://github.com/mamba-org/mamba/pull/3326 + 2024.08.19 ========== diff --git a/libmamba/CHANGELOG.md b/libmamba/CHANGELOG.md index c13d805870..1c271fc91f 100644 --- a/libmamba/CHANGELOG.md +++ b/libmamba/CHANGELOG.md @@ -1,3 +1,15 @@ +libmamba 2.0.0rc3 (August 26, 2024) +=================================== + +Bug fixes: + +- Define `etc/profile.d/mamba.sh` and install it by @jjerphan in https://github.com/mamba-org/mamba/pull/3413 +- Replaces instances of -p with --root-prefix in documentation by @SylvainCorlay in https://github.com/mamba-org/mamba/pull/3411 + +CI fixes and doc: + +- docs: Adapt "Solving Package Environments" section by @jjerphan in https://github.com/mamba-org/mamba/pull/3326 + libmamba 2.0.0rc2 (August 19, 2024) =================================== diff --git a/libmambapy/CHANGELOG.md b/libmambapy/CHANGELOG.md index dde6488de3..61f7ad35b3 100644 --- a/libmambapy/CHANGELOG.md +++ b/libmambapy/CHANGELOG.md @@ -1,3 +1,15 @@ +libmambapy 2.0.0rc3 (August 26, 2024) +===================================== + +Bug fixes: + +- Define `etc/profile.d/mamba.sh` and install it by @jjerphan in https://github.com/mamba-org/mamba/pull/3413 +- Replaces instances of -p with --root-prefix in documentation by @SylvainCorlay in https://github.com/mamba-org/mamba/pull/3411 + +CI fixes and doc: + +- docs: Adapt "Solving Package Environments" section by @jjerphan in https://github.com/mamba-org/mamba/pull/3326 + libmambapy 2.0.0rc2 (August 19, 2024) ===================================== diff --git a/micromamba/CHANGELOG.md b/micromamba/CHANGELOG.md index 9a71008c2b..e4ac6a9f36 100644 --- a/micromamba/CHANGELOG.md +++ b/micromamba/CHANGELOG.md @@ -1,3 +1,16 @@ +micromamba 2.0.0rc3 (August 26, 2024) +===================================== + +Bug fixes: + +- Define `etc/profile.d/mamba.sh` and install it by @jjerphan in https://github.com/mamba-org/mamba/pull/3413 +- Add posix to supported shells by @jjerphan in https://github.com/mamba-org/mamba/pull/3412 +- Replaces instances of -p with --root-prefix in documentation by @SylvainCorlay in https://github.com/mamba-org/mamba/pull/3411 + +CI fixes and doc: + +- docs: Adapt "Solving Package Environments" section by @jjerphan in https://github.com/mamba-org/mamba/pull/3326 + micromamba 2.0.0rc2 (August 19, 2024) ===================================== From 0a01ecfc9dde5bc0d582ff88e7ac9d73e08220f7 Mon Sep 17 00:00:00 2001 From: Julien Jerphanion Date: Thu, 29 Aug 2024 14:03:18 +0200 Subject: [PATCH 028/126] fix: Reduce logging system overhead (#3416) * test: Non-regression test Signed-off-by: Julien Jerphanion * fix: Use penultimate libsolv's log level Signed-off-by: Julien Jerphanion * Only run `test_env_spdlog_overhead_regression` on Linux Signed-off-by: Julien Jerphanion Co-authored-by: Johan Mabille * Add time-out on test and rename conda env Signed-off-by: Julien Jerphanion Co-authored-by: Hind Montassif * Decrease timout to 15 seconds and use dry-run A dry run takes slightly less than 10 seconds. Signed-off-by: Julien Jerphanion * Use bounded value of `output_params.verbosity` as in 1.x See: https://github.com/mamba-org/mamba/blob/1.x/libmamba/src/core/pool.cpp#L72 Signed-off-by: Julien Jerphanion * Instead define and use and alternative `set_level` I was hesitating between the previous solution and this one (which is not really ideal either) but which at least does not leak the `Context`. Friend function could be used but we get this kind of issue, but I am currently meeting this problem: https://www.open-std.org/jtc1/sc22/wg21/docs/cwg_defects.html#2174 Signed-off-by: Julien Jerphanion * Revert "Instead define and use and alternative `set_level`" This reverts commit f1f41b71d0f90c49a8f00635150a8b78b3372e8d. * Simply hardcode the verbosity level to 3 Signed-off-by: Julien Jerphanion Co-authored-by: Hind Montassif * Increase timeout from 15 to 30 seconds 15 seconds is not sufficient as shown on the CI. Signed-off-by: Julien Jerphanion * From 30 sec to 60 sec Signed-off-by: Julien Jerphanion * DEBUG No timeout Signed-off-by: Julien Jerphanion * test: Remove edge-case for unlinks Signed-off-by: Julien Jerphanion * test: Adapt number of unlinks on Linux Signed-off-by: Julien Jerphanion * Assert success Signed-off-by: Julien Jerphanion Co-authored-by: Hind Montassif * docs: Update comments Signed-off-by: Julien Jerphanion * `const`-qualify `level` * Use 100 seconds for the timeout Signed-off-by: Julien Jerphanion Co-authored-by: Hind Montassif * Use 200 seconds for the timeout Signed-off-by: Julien Jerphanion * Adapt according to `1.x`'s behavior Signed-off-by: Julien Jerphanion * fixup! Adapt according to `1.x`'s behavior * Revert changes to handle CI failures This is handled by another PR. See: https://github.com/mamba-org/mamba/pull/3417 Signed-off-by: Julien Jerphanion --------- Signed-off-by: Julien Jerphanion Co-authored-by: Johan Mabille Co-authored-by: Hind Montassif --- dev/environment-dev.yml | 1 + libmamba/src/solver/libsolv/database.cpp | 13 ++++++++++++- .../tests/env-logging-overhead-regression.yaml | 17 +++++++++++++++++ micromamba/tests/test_create.py | 18 ++++++++++++++++++ 4 files changed, 48 insertions(+), 1 deletion(-) create mode 100644 micromamba/tests/env-logging-overhead-regression.yaml diff --git a/dev/environment-dev.yml b/dev/environment-dev.yml index 6511f9582a..f4827b683e 100644 --- a/dev/environment-dev.yml +++ b/dev/environment-dev.yml @@ -29,6 +29,7 @@ dependencies: - mitmproxy - pytest >=7.3.0 - pytest-asyncio + - pytest-timeout - pytest-xprocess - requests - sel(win): pywin32 diff --git a/libmamba/src/solver/libsolv/database.cpp b/libmamba/src/solver/libsolv/database.cpp index 552b65c6cf..c59b82eb3b 100644 --- a/libmamba/src/solver/libsolv/database.cpp +++ b/libmamba/src/solver/libsolv/database.cpp @@ -109,7 +109,18 @@ namespace mamba::solver::libsolv void Database::set_logger(logger_type callback) { - ::pool_setdebuglevel(pool().raw(), std::numeric_limits::max()); // All + // We must not use more than the penultimate level of verbosity of libsolv (which is 3) to + // avoid the most verbose messages (of type SOLV_DEBUG_RULE_CREATION | SOLV_DEBUG_WATCHES), + // which might spam the output and make mamba hang. See: + // https://github.com/openSUSE/libsolv/blob/27aa6a72c7db73d78aa711ae412231768e77c9e0/src/pool.c#L1623-L1637 + // TODO: Make `level` configurable once the semantics and UX for verbosity are clarified. + // Currently, we use the behavior of `1.x` whose default value for the verbosity level was + // `0` in which case `::pool_setdebuglevel` was not called. See: + // https://github.com/mamba-org/mamba/blob/4f269258b4237a342da3e9891045cdd51debb27c/libmamba/include/mamba/core/context.hpp#L88 + // See: https://github.com/mamba-org/mamba/blob/1.x/libmamba/src/core/pool.cpp#L72 + // Instead use something like: + // const int level = Context().output_params.verbosity - 1; + // ::pool_setdebuglevel(pool().raw(), level); pool().set_debug_callback( [logger = std::move(callback)](const solv::ObjPoolView&, int type, std::string_view msg) noexcept { diff --git a/micromamba/tests/env-logging-overhead-regression.yaml b/micromamba/tests/env-logging-overhead-regression.yaml new file mode 100644 index 0000000000..49264b1302 --- /dev/null +++ b/micromamba/tests/env-logging-overhead-regression.yaml @@ -0,0 +1,17 @@ +# This environment was observed to have the spdlog-based logging system make +# mamba hang when environments are created with: +# +# {micromamba,mamba} env create -n repro-create -f ./env-logging-overhead-regression.yaml +# +# or updated with: +# +# {micromamba,mamba} env update -n repro-create -f ./env-logging-overhead-regression.yaml +# +channels: + - conda-forge +dependencies: + - python=3.9 + - xeus-cling=0.6.0 + - xtensor=0.20.8 + - xtensor-blas=0.16.1 + - notebook diff --git a/micromamba/tests/test_create.py b/micromamba/tests/test_create.py index 7771198bd5..69afc24477 100644 --- a/micromamba/tests/test_create.py +++ b/micromamba/tests/test_create.py @@ -143,6 +143,24 @@ def test_env_lockfile_different_install_after_create(tmp_home, tmp_root_prefix, helpers.install("-p", env_prefix, "-f", install_spec_file, "-y", "--json") +# Only run this test on Linux, as it is the only platform where xeus-cling +# (which is part of the environment) is available. +@pytest.mark.timeout(20) +@pytest.mark.skipif(platform.system() != "Linux", reason="Test only available on Linux") +@pytest.mark.parametrize("shared_pkgs_dirs", [True], indirect=True) +def test_env_logging_overhead_regression(tmp_home, tmp_root_prefix, tmp_path): + # Non-regression test https://github.com/mamba-org/mamba/issues/3415. + + env_prefix = tmp_path / "myenv" + create_spec_file = tmp_path / "env-logging-overhead-regression.yaml" + + shutil.copyfile(__this_dir__ / "env-logging-overhead-regression.yaml", create_spec_file) + + # Must not hang + res = helpers.create("-p", env_prefix, "-f", create_spec_file, "-y", "--json", "--dry-run") + assert res["success"] + + @pytest.mark.parametrize("shared_pkgs_dirs", [True], indirect=True) @pytest.mark.parametrize("root_prefix_type", (None, "env_var", "cli")) @pytest.mark.parametrize("target_is_root", (False, True)) From 5251abaad0ef1b9ca7be189d1aac33197d755882 Mon Sep 17 00:00:00 2001 From: Julien Jerphanion Date: Thu, 29 Aug 2024 14:22:35 +0200 Subject: [PATCH 029/126] test: Adapt `test_remove_orphaned` unlinks (#3417) * test: Adapt `test_remove_orphaned` unlinks Signed-off-by: Julien Jerphanion * Relax test by only checking for at least two unlinks' presence. Co-authored-by: Hind-M <70631848+Hind-M@users.noreply.github.com> * Revert to the commented and previously used value Signed-off-by: Julien Jerphanion Co-authored-by: Hind Montassif * Revert "Revert to the commented and previously used value" This reverts commit 009f982c54b2ab04c74e6e58c683366a6d4ac379. --------- Signed-off-by: Julien Jerphanion Co-authored-by: Hind-M <70631848+Hind-M@users.noreply.github.com> Co-authored-by: Hind Montassif --- micromamba/tests/test_remove.py | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/micromamba/tests/test_remove.py b/micromamba/tests/test_remove.py index 9e981af950..f149c4b397 100644 --- a/micromamba/tests/test_remove.py +++ b/micromamba/tests/test_remove.py @@ -47,10 +47,7 @@ def test_remove_orphaned(tmp_home, tmp_root_prefix, tmp_xtensor_env, tmp_env_nam assert keys.issubset(set(res.keys())) assert res["success"] - if sys.platform == "darwin" and platform.machine() == "arm64": - assert len(res["actions"]["UNLINK"]) == 12 - else: - assert len(res["actions"]["UNLINK"]) == 11 + assert len(res["actions"]["UNLINK"]) > 1 assert res["actions"]["UNLINK"][0]["name"] == "xtensor-python" assert res["actions"]["PREFIX"] == str(tmp_xtensor_env) @@ -64,7 +61,7 @@ def test_remove_orphaned(tmp_home, tmp_root_prefix, tmp_xtensor_env, tmp_env_nam # assert len(res["actions"]["UNLINK"]) == len(env_pkgs) + ( assert len(res["actions"]["UNLINK"]) == 3 + ( 1 if helpers.dry_run_tests == helpers.DryRun.DRY else 0 - ) + ) + (platform.system() == "Linux") # xtl is not removed on Linux for p in res["actions"]["UNLINK"]: assert p["name"] in env_pkgs assert res["actions"]["PREFIX"] == str(tmp_xtensor_env) From 3bc31adbf0e2da0d7f13043c32844e8043cf2853 Mon Sep 17 00:00:00 2001 From: Hind Montassif Date: Thu, 29 Aug 2024 15:35:30 +0200 Subject: [PATCH 030/126] release libmamba 2.0.0rc4, libmambapy 2.0.0rc4, micromamba 2.0.0rc4 --- CHANGELOG.md | 10 ++++++++++ libmamba/CHANGELOG.md | 7 +++++++ libmambapy/CHANGELOG.md | 4 ++++ micromamba/CHANGELOG.md | 8 ++++++++ 4 files changed, 29 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 24d970b2bb..29d84f4879 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ +2024.08.29 +========== + +Releases: libmamba 2.0.0rc4, libmambapy 2.0.0rc4, micromamba 2.0.0rc4 + +Bug fixes: + +- [micromamba] test: Adapt `test_remove_orphaned` unlinks by @jjerphan in https://github.com/mamba-org/mamba/pull/3417 +- [micromamba, libmamba] fix: Reduce logging system overhead by @jjerphan in https://github.com/mamba-org/mamba/pull/3416 + 2024.08.26 ========== diff --git a/libmamba/CHANGELOG.md b/libmamba/CHANGELOG.md index 1c271fc91f..0ee1ef1c06 100644 --- a/libmamba/CHANGELOG.md +++ b/libmamba/CHANGELOG.md @@ -1,3 +1,10 @@ +libmamba 2.0.0rc4 (August 29, 2024) +=================================== + +Bug fixes: + +- fix: Reduce logging system overhead by @jjerphan in https://github.com/mamba-org/mamba/pull/3416 + libmamba 2.0.0rc3 (August 26, 2024) =================================== diff --git a/libmambapy/CHANGELOG.md b/libmambapy/CHANGELOG.md index 61f7ad35b3..c59583e307 100644 --- a/libmambapy/CHANGELOG.md +++ b/libmambapy/CHANGELOG.md @@ -1,3 +1,7 @@ +libmambapy 2.0.0rc4 (August 29, 2024) +===================================== + + libmambapy 2.0.0rc3 (August 26, 2024) ===================================== diff --git a/micromamba/CHANGELOG.md b/micromamba/CHANGELOG.md index e4ac6a9f36..4aaba00256 100644 --- a/micromamba/CHANGELOG.md +++ b/micromamba/CHANGELOG.md @@ -1,3 +1,11 @@ +micromamba 2.0.0rc4 (August 29, 2024) +===================================== + +Bug fixes: + +- test: Adapt `test_remove_orphaned` unlinks by @jjerphan in https://github.com/mamba-org/mamba/pull/3417 +- fix: Reduce logging system overhead by @jjerphan in https://github.com/mamba-org/mamba/pull/3416 + micromamba 2.0.0rc3 (August 26, 2024) ===================================== From d51cd0e451faaf6c7803303607f16178e1eb31ec Mon Sep 17 00:00:00 2001 From: Sylvain Corlay Date: Sat, 31 Aug 2024 00:30:24 +0200 Subject: [PATCH 031/126] Execute remove action before install actions (#3424) --- libmamba/src/core/transaction.cpp | 68 +++++++++++-------------------- 1 file changed, 23 insertions(+), 45 deletions(-) diff --git a/libmamba/src/core/transaction.cpp b/libmamba/src/core/transaction.cpp index 762123cf8f..29e16a7cfe 100644 --- a/libmamba/src/core/transaction.cpp +++ b/libmamba/src/core/transaction.cpp @@ -398,59 +398,37 @@ namespace mamba TransactionRollback rollback; - const auto execute_action = [&](const auto& act) + const auto link = [&](const specs::PackageInfo& pkg) { - using Action = std::decay_t; - - const auto link = [&](const specs::PackageInfo& pkg) - { - const fs::u8path cache_path(m_multi_cache.get_extracted_dir_path(pkg, false)); - LinkPackage lp(pkg, cache_path, &m_transaction_context); - lp.execute(); - rollback.record(lp); - m_history_entry.link_dists.push_back(pkg.long_str()); - }; - const auto unlink = [&](const specs::PackageInfo& pkg) - { - const fs::u8path cache_path(m_multi_cache.get_extracted_dir_path(pkg)); - UnlinkPackage up(pkg, cache_path, &m_transaction_context); - up.execute(); - rollback.record(up); - m_history_entry.unlink_dists.push_back(pkg.long_str()); - }; - - if constexpr (std::is_same_v) - { - Console::stream() << "Reinstalling " << act.what.str(); - unlink(act.what); - link(act.what); - } - else if constexpr (Solution::has_remove_v && Solution::has_install_v) - { - Console::stream() << "Changing " << act.remove.str() << " ==> " << act.install.str(); - unlink(act.remove); - link(act.install); - } - else if constexpr (Solution::has_remove_v) - { - Console::stream() << "Unlinking " << act.remove.str(); - unlink(act.remove); - } - else if constexpr (Solution::has_install_v) + if (is_sig_interrupted()) { - Console::stream() << "Linking " << act.install.str(); - link(act.install); + return util::LoopControl::Break; } + Console::stream() << "Linking " << pkg.str(); + const fs::u8path cache_path(m_multi_cache.get_extracted_dir_path(pkg, false)); + LinkPackage lp(pkg, cache_path, &m_transaction_context); + lp.execute(); + rollback.record(lp); + m_history_entry.link_dists.push_back(pkg.long_str()); + return util::LoopControl::Continue; }; - - for (const auto& action : m_solution.actions) + const auto unlink = [&](const specs::PackageInfo& pkg) { if (is_sig_interrupted()) { - break; + return util::LoopControl::Break; } - std::visit(execute_action, action); - } + Console::stream() << "Unlinking " << pkg.str(); + const fs::u8path cache_path(m_multi_cache.get_extracted_dir_path(pkg)); + UnlinkPackage up(pkg, cache_path, &m_transaction_context); + up.execute(); + rollback.record(up); + m_history_entry.unlink_dists.push_back(pkg.long_str()); + return util::LoopControl::Continue; + }; + + for_each_to_remove(m_solution.actions, unlink); + for_each_to_install(m_solution.actions, link); if (is_sig_interrupted()) { From 4f73c92713085d9dd9a83e4f13d9cece22f113d4 Mon Sep 17 00:00:00 2001 From: Sylvain Corlay Date: Sat, 31 Aug 2024 00:31:20 +0200 Subject: [PATCH 032/126] Update mamba.sh.in script (#3422) * Update mamba.sh.in script * Set root prefix * Update mamba_package/etc/profile.d/mamba.sh.in Co-authored-by: Julien Jerphanion --------- Co-authored-by: Julien Jerphanion --- mamba_package/etc/profile.d/mamba.sh.in | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mamba_package/etc/profile.d/mamba.sh.in b/mamba_package/etc/profile.d/mamba.sh.in index 9cbe6d1369..4fdcfde932 100644 --- a/mamba_package/etc/profile.d/mamba.sh.in +++ b/mamba_package/etc/profile.d/mamba.sh.in @@ -1,7 +1,8 @@ -__mamba_setup="$("@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_BINDIR@/mamba" shell hook --shell zsh --root-prefix "@CMAKE_INSTALL_PREFIX@" 2> /dev/null)" +export MAMBA_ROOT_PREFIX="@CMAKE_INSTALL_PREFIX@" +__mamba_setup="$("@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_BINDIR@/mamba" shell hook --shell posix 2> /dev/null)" if [ $? -eq 0 ]; then eval "$__mamba_setup" else - alias micromamba="@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_BINDIR@/mamba" # Fallback on help from mamba activate + alias mamba="@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_BINDIR@/mamba" # Fallback on help from mamba activate fi unset __mamba_setup From 1bdf6f174857587dbd16b2481c33ecbf6e918c5c Mon Sep 17 00:00:00 2001 From: Hind-M <70631848+Hind-M@users.noreply.github.com> Date: Mon, 2 Sep 2024 14:25:20 +0200 Subject: [PATCH 033/126] Fix output (#3428) Only print activation message when target prefix is not active --- libmamba/src/core/transaction.cpp | 35 +++++++++++++++++++------------ 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/libmamba/src/core/transaction.cpp b/libmamba/src/core/transaction.cpp index 29e16a7cfe..cf89256f7f 100644 --- a/libmamba/src/core/transaction.cpp +++ b/libmamba/src/core/transaction.cpp @@ -30,6 +30,7 @@ #include "mamba/core/util_os.hpp" #include "mamba/solver/libsolv/database.hpp" #include "mamba/specs/match_spec.hpp" +#include "mamba/util/environment.hpp" #include "mamba/util/variant_cmp.hpp" #include "solver/helpers.hpp" @@ -445,19 +446,27 @@ namespace mamba // Get the name of the environment const auto environment = env_name(ctx); - Console::stream() << "\nTransaction finished\n\n" - "To activate this environment, use:\n\n" - " " - << executable << " activate " << environment - << "\n\n" - "Or to execute a single command in this environment, use:\n\n" - " " - << executable - << " run " - // Use -n or -p depending on if the env_name is a full prefix or just - // a name. - << (environment == ctx.prefix_params.target_prefix ? "-p " : "-n ") - << environment << " mycommand\n"; + // Check if the target prefix is active + if (util::get_env("CONDA_PREFIX") == ctx.prefix_params.target_prefix) + { + Console::stream() << "\nTransaction finished\n"; + } + else + { + Console::stream() << "\nTransaction finished\n\n" + "To activate this environment, use:\n\n" + " " + << executable << " activate " << environment + << "\n\n" + "Or to execute a single command in this environment, use:\n\n" + " " + << executable + << " run " + // Use -n or -p depending on if the env_name is a full prefix or just + // a name. + << (environment == ctx.prefix_params.target_prefix ? "-p " : "-n ") + << environment << " mycommand\n"; + } prefix.history().add_entry(m_history_entry); return true; From c4a6e78a7820e24b250e723b466bef9186b4dad5 Mon Sep 17 00:00:00 2001 From: Julien Jerphanion Date: Thu, 5 Sep 2024 15:41:39 +0200 Subject: [PATCH 034/126] fix: PyPI support for `env update` (#3419) * Simple fix Signed-off-by: Julien Jerphanion * Factor elements in `pip_utils.{hpp,cpp}` Signed-off-by: Julien Jerphanion * docs: Add TODO Signed-off-by: Julien Jerphanion * test: Creation and update of env with pip sections Signed-off-by: Julien Jerphanion * Use quiet mode for pip Signed-off-by: Julien Jerphanion * Address review comments Signed-off-by: Julien Jerphanion Co-authored-by: Johan Mabille * Invert headers' inclusion Signed-off-by: Julien Jerphanion * Address review comments Signed-off-by: Julien Jerphanion Co-authored-by: Hind Montassif * Add more tests * Use enum instead of bool * Adapt tests * Add warning * Clean up --------- Signed-off-by: Julien Jerphanion Co-authored-by: Johan Mabille Co-authored-by: Hind Montassif --- libmamba/CMakeLists.txt | 2 + libmamba/src/api/install.cpp | 144 +----------------- libmamba/src/api/pip_utils.cpp | 187 ++++++++++++++++++++++++ libmamba/src/api/pip_utils.hpp | 44 ++++++ libmamba/src/api/update.cpp | 9 ++ micromamba/tests/env-pypi-pkg-test.yaml | 4 + micromamba/tests/test_env.py | 163 +++++++++++++++++++++ 7 files changed, 413 insertions(+), 140 deletions(-) create mode 100644 libmamba/src/api/pip_utils.cpp create mode 100644 libmamba/src/api/pip_utils.hpp create mode 100644 micromamba/tests/env-pypi-pkg-test.yaml diff --git a/libmamba/CMakeLists.txt b/libmamba/CMakeLists.txt index 5e8ae976b1..3ea77f912a 100644 --- a/libmamba/CMakeLists.txt +++ b/libmamba/CMakeLists.txt @@ -257,6 +257,8 @@ set( ${LIBMAMBA_SOURCE_DIR}/api/info.cpp ${LIBMAMBA_SOURCE_DIR}/api/install.cpp ${LIBMAMBA_SOURCE_DIR}/api/list.cpp + ${LIBMAMBA_SOURCE_DIR}/api/pip_utils.cpp + ${LIBMAMBA_SOURCE_DIR}/api/pip_utils.hpp ${LIBMAMBA_SOURCE_DIR}/api/remove.cpp ${LIBMAMBA_SOURCE_DIR}/api/repoquery.cpp ${LIBMAMBA_SOURCE_DIR}/api/shell.cpp diff --git a/libmamba/src/api/install.cpp b/libmamba/src/api/install.cpp index abba952c53..4e33fe7ab1 100644 --- a/libmamba/src/api/install.cpp +++ b/libmamba/src/api/install.cpp @@ -6,13 +6,6 @@ #include -#include -#include -#include -#include -#include -#include - #include "mamba/api/channel_loader.hpp" #include "mamba/api/configuration.hpp" #include "mamba/api/install.hpp" @@ -33,139 +26,10 @@ #include "mamba/util/path_manip.hpp" #include "mamba/util/string.hpp" +#include "pip_utils.hpp" + namespace mamba { - namespace - { - using command_args = std::vector; - - tl::expected get_other_pkg_mgr_install_instructions( - const std::string& name, - const std::string& target_prefix, - const fs::u8path& spec_file - ) - { - const auto get_python_path = [&] - { return util::which_in("python", get_path_dirs(target_prefix)).string(); }; - - const std::unordered_map other_pkg_mgr_install_instructions{ - { "pip", - { get_python_path(), "-m", "pip", "install", "-r", spec_file, "--no-input" } }, - { "pip --no-deps", - { get_python_path(), "-m", "pip", "install", "--no-deps", "-r", spec_file, "--no-input" } } - }; - - auto found_it = other_pkg_mgr_install_instructions.find(name); - if (found_it != other_pkg_mgr_install_instructions.end()) - { - return found_it->second; - } - else - { - return tl::unexpected(std::runtime_error( - fmt::format("no install instruction found for package manager '{}'", name) - )); - } - } - - } - - bool reproc_killed(int status) - { - return status == REPROC_SIGKILL; - } - - bool reproc_terminated(int status) - { - return status == REPROC_SIGTERM; - } - - void assert_reproc_success(const reproc::options& options, int status, std::error_code ec) - { - bool killed_not_an_err = (options.stop.first.action == reproc::stop::kill) - || (options.stop.second.action == reproc::stop::kill) - || (options.stop.third.action == reproc::stop::kill); - - bool terminated_not_an_err = (options.stop.first.action == reproc::stop::terminate) - || (options.stop.second.action == reproc::stop::terminate) - || (options.stop.third.action == reproc::stop::terminate); - - if (ec || (!killed_not_an_err && reproc_killed(status)) - || (!terminated_not_an_err && reproc_terminated(status))) - { - if (ec) - { - LOG_ERROR << "Subprocess call failed: " << ec.message(); - } - else if (reproc_killed(status)) - { - LOG_ERROR << "Subprocess call failed (killed)"; - } - else - { - LOG_ERROR << "Subprocess call failed (terminated)"; - } - throw std::runtime_error("Subprocess call failed. Aborting."); - } - } - - auto install_for_other_pkgmgr(const Context& ctx, const detail::other_pkg_mgr_spec& other_spec) - { - const auto& pkg_mgr = other_spec.pkg_mgr; - const auto& deps = other_spec.deps; - const auto& cwd = other_spec.cwd; - - TemporaryFile specs("mambaf", "", cwd); - { - std::ofstream specs_f = open_ofstream(specs.path()); - for (auto& d : deps) - { - specs_f << d.c_str() << '\n'; - } - } - - command_args install_instructions = [&] - { - const auto maybe_instructions = get_other_pkg_mgr_install_instructions( - pkg_mgr, - ctx.prefix_params.target_prefix.string(), - specs.path() - ); - if (maybe_instructions) - { - return maybe_instructions.value(); - } - else - { - throw maybe_instructions.error(); - } - }(); - - auto [wrapped_command, tmpfile] = prepare_wrapped_call( - ctx, - ctx.prefix_params.target_prefix, - install_instructions - ); - - reproc::options options; - options.redirect.parent = true; - options.working_directory = cwd.c_str(); - - Console::stream() << fmt::format( - ctx.graphics_params.palette.external, - "\nInstalling {} packages: {}", - pkg_mgr, - fmt::join(deps, ", ") - ); - fmt::print(LOG_INFO, "Calling: {}", fmt::join(install_instructions, " ")); - - auto [status, ec] = reproc::run(wrapped_command, options); - assert_reproc_success(options, status, ec); - if (status != 0) - { - throw std::runtime_error("pip failed to install packages"); - } - } const auto& truthy_values(const std::string platform) { @@ -675,7 +539,7 @@ namespace mamba for (auto other_spec : config.at("others_pkg_mgrs_specs") .value>()) { - install_for_other_pkgmgr(ctx, other_spec); + install_for_other_pkgmgr(ctx, other_spec, pip::Update::No); } } else @@ -773,7 +637,7 @@ namespace mamba for (auto other_spec : others) { - install_for_other_pkgmgr(ctx, other_spec); + install_for_other_pkgmgr(ctx, other_spec, pip::Update::No); } } else diff --git a/libmamba/src/api/pip_utils.cpp b/libmamba/src/api/pip_utils.cpp new file mode 100644 index 0000000000..f8a2a6e15b --- /dev/null +++ b/libmamba/src/api/pip_utils.cpp @@ -0,0 +1,187 @@ +// Copyright (c) 2024, QuantStack and Mamba Contributors +// +// Distributed under the terms of the BSD 3-Clause License. +// +// The full license is in the file LICENSE, distributed with this software. + +#include +#include +#include +#include +#include +#include + +// TODO includes to be removed after moving some functions/structs around +#include "mamba/api/install.hpp" // other_pkg_mgr_spec +#include "mamba/core/activation.hpp" // get_path_dirs +#include "mamba/core/context.hpp" +#include "mamba/core/util.hpp" +#include "mamba/fs/filesystem.hpp" +#include "mamba/util/environment.hpp" + +#include "pip_utils.hpp" + +namespace mamba +{ + namespace + { + tl::expected get_pip_install_command( + const std::string& name, + const std::string& target_prefix, + const fs::u8path& spec_file, + pip::Update update + ) + { + const auto get_python_path = [&] + { return util::which_in("python", get_path_dirs(target_prefix)).string(); }; + + command_args cmd = { get_python_path(), "-m", "pip", "install" }; + command_args cmd_extension = { "-r", spec_file, "--no-input", "--quiet" }; + + if (update == pip::Update::Yes) + { + cmd.push_back("-U"); + } + + if (name == "pip --no-deps") + { + cmd.push_back("--no-deps"); + } + + cmd.insert(cmd.end(), cmd_extension.begin(), cmd_extension.end()); + const std::unordered_map pip_install_command{ + { "pip", cmd }, + { "pip --no-deps", cmd } + }; + + auto found_it = pip_install_command.find(name); + if (found_it != pip_install_command.end()) + { + return found_it->second; + } + else + { + return tl::unexpected(std::runtime_error(fmt::format( + "no {} instruction found for package manager '{}'", + (update == pip::Update::Yes) ? "update" : "install", + name + ))); + } + } + } + + bool reproc_killed(int status) + { + return status == REPROC_SIGKILL; + } + + bool reproc_terminated(int status) + { + return status == REPROC_SIGTERM; + } + + void assert_reproc_success(const reproc::options& options, int status, std::error_code ec) + { + bool killed_not_an_err = (options.stop.first.action == reproc::stop::kill) + || (options.stop.second.action == reproc::stop::kill) + || (options.stop.third.action == reproc::stop::kill); + + bool terminated_not_an_err = (options.stop.first.action == reproc::stop::terminate) + || (options.stop.second.action == reproc::stop::terminate) + || (options.stop.third.action == reproc::stop::terminate); + + if (ec || (!killed_not_an_err && reproc_killed(status)) + || (!terminated_not_an_err && reproc_terminated(status))) + { + if (ec) + { + LOG_ERROR << "Subprocess call failed: " << ec.message(); + } + else if (reproc_killed(status)) + { + LOG_ERROR << "Subprocess call failed (killed)"; + } + else + { + LOG_ERROR << "Subprocess call failed (terminated)"; + } + throw std::runtime_error("Subprocess call failed. Aborting."); + } + } + + tl::expected install_for_other_pkgmgr( + const Context& ctx, + const detail::other_pkg_mgr_spec& other_spec, + pip::Update update + ) + { + const auto& pkg_mgr = other_spec.pkg_mgr; + const auto& deps = other_spec.deps; + const auto& cwd = other_spec.cwd; + + LOG_WARNING << fmt::format( + "You are using '{}' as an additional package manager.\nBe aware that packages installed with '{}' are managed independently from 'conda-forge' channel.", + pkg_mgr, + pkg_mgr + ); + + TemporaryFile specs("mambaf", "", cwd); + { + std::ofstream specs_f = open_ofstream(specs.path()); + for (auto& d : deps) + { + specs_f << d.c_str() << '\n'; + } + } + + command_args command = [&] + { + const auto maybe_command = get_pip_install_command( + pkg_mgr, + ctx.prefix_params.target_prefix.string(), + specs.path(), + update + ); + if (maybe_command) + { + return maybe_command.value(); + } + else + { + throw maybe_command.error(); + } + }(); + + auto [wrapped_command, tmpfile] = prepare_wrapped_call( + ctx, + ctx.prefix_params.target_prefix, + command + ); + + reproc::options options; + options.redirect.parent = true; + options.working_directory = cwd.c_str(); + + Console::stream() << fmt::format( + ctx.graphics_params.palette.external, + "\n{} {} packages: {}", + (update == pip::Update::Yes) ? "Updating" : "Installing", + pkg_mgr, + fmt::join(deps, ", ") + ); + + fmt::print(LOG_INFO, "Calling: {}", fmt::join(command, " ")); + + auto [status, ec] = reproc::run(wrapped_command, options); + assert_reproc_success(options, status, ec); + if (status != 0) + { + throw std::runtime_error(fmt::format( + "pip failed to {} packages", + (update == pip::Update::Yes) ? "update" : "install" + )); + } + + return command; + } +} diff --git a/libmamba/src/api/pip_utils.hpp b/libmamba/src/api/pip_utils.hpp new file mode 100644 index 0000000000..5e5e5861f9 --- /dev/null +++ b/libmamba/src/api/pip_utils.hpp @@ -0,0 +1,44 @@ +// Copyright (c) 2024, QuantStack and Mamba Contributors +// +// Distributed under the terms of the BSD 3-Clause License. +// +// The full license is in the file LICENSE, distributed with this software. + +#ifndef MAMBA_PIP_UTILS_HPP +#define MAMBA_PIP_UTILS_HPP + +#include +#include +#include + +#include "tl/expected.hpp" + +namespace mamba +{ + class Context; + + namespace detail + { + struct other_pkg_mgr_spec; + } + + namespace pip + { + enum class Update : bool + { + No = false, + Yes = true, + }; + } + + using command_args = std::vector; + + tl::expected install_for_other_pkgmgr( + const Context& ctx, + const detail::other_pkg_mgr_spec& other_spec, + pip::Update update + ); + +} + +#endif // MAMBA_PIP_UTILS_HPP diff --git a/libmamba/src/api/update.cpp b/libmamba/src/api/update.cpp index ea79d5149f..38957b09f1 100644 --- a/libmamba/src/api/update.cpp +++ b/libmamba/src/api/update.cpp @@ -18,10 +18,14 @@ #include "mamba/solver/libsolv/solver.hpp" #include "mamba/solver/request.hpp" +#include "pip_utils.hpp" + namespace mamba { namespace { + using command_args = std::vector; + auto create_update_request( PrefixData& prefix_data, std::vector specs, @@ -232,5 +236,10 @@ namespace mamba }; execute_transaction(transaction); + for (auto other_spec : + config.at("others_pkg_mgrs_specs").value>()) + { + install_for_other_pkgmgr(ctx, other_spec, pip::Update::Yes); + } } } diff --git a/micromamba/tests/env-pypi-pkg-test.yaml b/micromamba/tests/env-pypi-pkg-test.yaml new file mode 100644 index 0000000000..c12dfc4755 --- /dev/null +++ b/micromamba/tests/env-pypi-pkg-test.yaml @@ -0,0 +1,4 @@ +dependencies: + - pip + - pip: + - pypi-pkg-test diff --git a/micromamba/tests/test_env.py b/micromamba/tests/test_env.py index dd543a3b43..2c202189e0 100644 --- a/micromamba/tests/test_env.py +++ b/micromamba/tests/test_env.py @@ -200,3 +200,166 @@ def test_explicit_export_topologically_sorted(tmp_home, tmp_prefix): assert indices["libzlib"] < indices["python"] assert indices["python"] < indices["pip"] assert indices["python"] < indices["jupyterlab"] + + +@pytest.mark.parametrize("shared_pkgs_dirs", [True], indirect=True) +def test_env_create_pypi(tmp_home, tmp_root_prefix, tmp_path): + env_prefix = tmp_path / "env-create-pypi" + + create_spec_file = tmp_path / "env-pypi-pkg-test.yaml" + + shutil.copyfile(__this_dir__ / "env-pypi-pkg-test.yaml", create_spec_file) + + res = helpers.run_env("create", "-p", env_prefix, "-f", create_spec_file, "-y", "--json") + assert res["success"] + + # Check that pypi-pkg-test is installed using pip list for now + # See: https://github.com/mamba-org/mamba/issues/2059 + pip_list_output = helpers.umamba_run("-p", env_prefix, "pip", "list", "--format=json") + pip_packages_list = yaml.safe_load(pip_list_output) + assert any(pkg["name"] == "pypi-pkg-test" for pkg in pip_packages_list) + + +@pytest.mark.parametrize("shared_pkgs_dirs", [True], indirect=True) +def test_env_create_update_pypi(tmp_home, tmp_root_prefix, tmp_path): + env_prefix = tmp_path / "env-create-update-pypi" + + create_spec_file = tmp_path / "env-requires-pip-install.yaml" + update_spec_file = tmp_path / "env-pypi-pkg-test.yaml" + + shutil.copyfile(__this_dir__ / "env-requires-pip-install.yaml", create_spec_file) + shutil.copyfile(__this_dir__ / "env-pypi-pkg-test.yaml", update_spec_file) + + res = helpers.run_env("create", "-p", env_prefix, "-f", create_spec_file, "-y", "--json") + assert res["success"] + + # Check pip packages using pip list for now + # See: https://github.com/mamba-org/mamba/issues/2059 + pip_list_output = helpers.umamba_run("-p", env_prefix, "pip", "list", "--format=json") + pip_packages_list = yaml.safe_load(pip_list_output) + + assert any(pkg["name"] == "pydantic" for pkg in pip_packages_list) + # Check that pypi-pkg-test is not installed before the update + assert all(pkg["name"] != "pypi-pkg-test" for pkg in pip_packages_list) + + res = helpers.run_env("update", "-p", env_prefix, "-f", update_spec_file, "-y", "--json") + assert res["success"] + + ## Check that pypi-pkg-test is installed after the update + # (using pip list for now) + # See: https://github.com/mamba-org/mamba/issues/2059 + pip_list_output = helpers.umamba_run("-p", env_prefix, "pip", "list", "--format=json") + pip_packages_list = yaml.safe_load(pip_list_output) + assert any(pkg["name"] == "pypi-pkg-test" for pkg in pip_packages_list) + assert any(pkg["name"] == "pydantic" for pkg in pip_packages_list) + + +env_yaml_content_to_update_pip_pkg_version = """ +channels: +- conda-forge +dependencies: +- pip +- pip: + - numpy==1.24.3 +""" + + +@pytest.mark.parametrize("shared_pkgs_dirs", [True], indirect=True) +def test_env_update_conda_forge_with_pypi(tmp_home, tmp_root_prefix, tmp_path): + env_prefix = tmp_path / "env-update-conda-forge-with-pypi" + + # Create env with numpy=1.24.2 + helpers.create("numpy=1.24.2", "-p", env_prefix, "--json", no_dry_run=True) + packages = helpers.umamba_list("-p", env_prefix, "--json") + assert any( + package["name"] == "numpy" + and package["version"] == "1.24.2" + and package["channel"].startswith("conda-forge") + for package in packages + ) + + env_file_yml = tmp_path / "test_env_update_pip_pkg_version.yaml" + env_file_yml.write_text(env_yaml_content_to_update_pip_pkg_version) + + res = helpers.run_env("update", "-p", env_prefix, "-f", env_file_yml, "-y", "--json") + assert res["success"] + + # Note that conda's behavior is different: + # numpy 1.24.2 is uninstalled to be replaced with 1.24.3 from PyPI + # (micro)mamba keeps both + packages = helpers.umamba_list("-p", env_prefix, "--json") + assert any( + pkg["name"] == "numpy" + and pkg["version"] == "1.24.2" + and pkg["channel"].startswith("conda-forge") + for pkg in packages + ) + + ## Check pip packages using pip list for now + ## See: https://github.com/mamba-org/mamba/issues/2059 + pip_list_output = helpers.umamba_run("-p", env_prefix, "pip", "list", "--format=json") + pip_packages_list = yaml.safe_load(pip_list_output) + + assert any(pkg["name"] == "numpy" and pkg["version"] == "1.24.3" for pkg in pip_packages_list) + + +env_yaml_content_create_pip_pkg_with_version = """ +channels: +- conda-forge +dependencies: +- pip +- pip: + - numpy==1.26.4 +""" + + +env_yaml_content_to_update_pip_pkg_version_from_conda_forge = """ +channels: +- conda-forge +dependencies: +- numpy==2.0.0 +""" + + +@pytest.mark.parametrize("shared_pkgs_dirs", [True], indirect=True) +def test_env_update_pypi_with_conda_forge(tmp_home, tmp_root_prefix, tmp_path): + env_prefix = tmp_path / "env-update-pypi-with-conda-forge" + + env_file_yml = tmp_path / "test_env_create_pip_pkg_with_version.yaml" + env_file_yml.write_text(env_yaml_content_create_pip_pkg_with_version) + + # Create env with numpy=1.26.4 + res = helpers.run_env("create", "-p", env_prefix, "-f", env_file_yml, "-y", "--json") + assert res["success"] + + ## Check pip packages using pip list for now + ## See: https://github.com/mamba-org/mamba/issues/2059 + pip_list_output = helpers.umamba_run("-p", env_prefix, "pip", "list", "--format=json") + pip_packages_list = yaml.safe_load(pip_list_output) + + assert any(pkg["name"] == "numpy" and pkg["version"] == "1.26.4" for pkg in pip_packages_list) + + env_file_yml = tmp_path / "test_env_update_pip_pkg_version_with_conda_forge.yaml" + env_file_yml.write_text(env_yaml_content_to_update_pip_pkg_version_from_conda_forge) + + # Update numpy from conda-forge is not suppposed to be done + res = helpers.run_env("update", "-p", env_prefix, "-f", env_file_yml, "-y", "--json") + assert res["success"] + + # Note that conda's behavior is different: + # numpy 2.0.0 is not installed and numpy 1.26.4 from PyPI is kept + # (micro)mamba keeps both + packages = helpers.umamba_list("-p", env_prefix, "--json") + assert any( + pkg["name"] == "numpy" + and pkg["version"] == "2.0.0" + and pkg["channel"].startswith("conda-forge") + for pkg in packages + ) + + ## Check pip packages using pip list for now + ## See: https://github.com/mamba-org/mamba/issues/2059 + pip_list_output = helpers.umamba_run("-p", env_prefix, "pip", "list", "--format=json") + pip_packages_list = yaml.safe_load(pip_list_output) + + assert any(pkg["name"] == "numpy" and pkg["version"] == "1.26.4" for pkg in pip_packages_list) From f8bb11c8539d96b502a34d2d6001e5474b76b431 Mon Sep 17 00:00:00 2001 From: Johan Mabille Date: Mon, 9 Sep 2024 16:53:28 +0200 Subject: [PATCH 035/126] =?UTF-8?q?Fixed=20micromamba=20static=20build=20a?= =?UTF-8?q?fter=20cctools=20and=20ld64=20upgrade=20on=20conda=E2=80=A6=20(?= =?UTF-8?q?#3436)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixed micromamba static build after cctools and ld64 upgrade on conda-forge --- libmamba/CMakeLists.txt | 2 +- micromamba/CMakeLists.txt | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/libmamba/CMakeLists.txt b/libmamba/CMakeLists.txt index 3ea77f912a..8bd51b591f 100644 --- a/libmamba/CMakeLists.txt +++ b/libmamba/CMakeLists.txt @@ -526,7 +526,7 @@ macro(libmamba_create_target target_name linkage output_name) if(APPLE) set(MAMBA_FORCE_DYNAMIC_LIBS resolv c++abi) - target_link_options(${target_name} PRIVATE -static-libstdc++) + target_link_options(${target_name} PRIVATE -nostdlib++) elseif(UNIX) set(MAMBA_FORCE_DYNAMIC_LIBS rt dl resolv) target_link_options(${target_name} PUBLIC -static-libstdc++ -static-libgcc) diff --git a/micromamba/CMakeLists.txt b/micromamba/CMakeLists.txt index e394e1e84e..7414429c4f 100644 --- a/micromamba/CMakeLists.txt +++ b/micromamba/CMakeLists.txt @@ -79,6 +79,9 @@ macro(mambaexe_create_target target_name linkage output_name) find_package(libmamba REQUIRED) endif() target_link_libraries(${target_name} PRIVATE mamba::libmamba-static) + if(APPLE) + target_link_options(${target_name} PRIVATE -nostdlib++) + endif() # Dynamic build # ============= else() From 841b272cef8d26a091153bfd3493777924eb50d4 Mon Sep 17 00:00:00 2001 From: Silvio Traversaro Date: Tue, 10 Sep 2024 11:39:25 +0300 Subject: [PATCH 036/126] Fix x86_64 to use underscore instead of dash (#3433) See https://github.com/mamba-org/mamba/issues/3222#issuecomment-2284324975 . Co-authored-by: Julien Jerphanion --- libmamba/src/core/virtual_packages.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libmamba/src/core/virtual_packages.cpp b/libmamba/src/core/virtual_packages.cpp index 4b94201441..f95c89cd8c 100644 --- a/libmamba/src/core/virtual_packages.cpp +++ b/libmamba/src/core/virtual_packages.cpp @@ -174,21 +174,21 @@ namespace mamba && __builtin_cpu_supports("avx512cd") && __builtin_cpu_supports("avx512dq") && __builtin_cpu_supports("avx512vl")) { - return "x86_64-v4"; + return "x86_64_v4"; } /* if (__builtin_cpu_supports ("x86-64-v3")) */ if (__builtin_cpu_supports("avx") && __builtin_cpu_supports("avx2") && __builtin_cpu_supports("bmi") && __builtin_cpu_supports("bmi2") && __builtin_cpu_supports("fma")) { - return "x86_64-v3"; + return "x86_64_v3"; } /* if (__builtin_cpu_supports ("x86-64-v2")) */ if (__builtin_cpu_supports("popcnt") && __builtin_cpu_supports("sse3") && __builtin_cpu_supports("ssse3") && __builtin_cpu_supports("sse4.1") && __builtin_cpu_supports("sse4.2")) { - return "x86_64-v2"; + return "x86_64_v2"; } #endif return "x86_64"; From 71f0ed38fba12f832cae6ca81447f0dfa8d9d29f Mon Sep 17 00:00:00 2001 From: Julien Jerphanion Date: Tue, 10 Sep 2024 13:51:42 +0200 Subject: [PATCH 037/126] docs: Specify `CMAKE_INSTALL_PREFIX` (#3438) docs: Specify CMAKE_INSTALL_PREFIX Signed-off-by: Julien Jerphanion --- docs/source/installation/micromamba-installation.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/source/installation/micromamba-installation.rst b/docs/source/installation/micromamba-installation.rst index e7c55ec66f..5019083921 100644 --- a/docs/source/installation/micromamba-installation.rst +++ b/docs/source/installation/micromamba-installation.rst @@ -212,6 +212,7 @@ Use CMake from this environment to drive the build: cmake -B build/ \ -G Ninja \ ${CMAKE_ARGS} \ + -D CMAKE_INSTALL_PREFIX="${CONDA_PREFIX}" \ -D CMAKE_BUILD_TYPE="Release" \ -D BUILD_LIBMAMBA=ON \ -D BUILD_STATIC=ON \ From 12fef58c3742bcdcff04eb40ee627ac09ca49118 Mon Sep 17 00:00:00 2001 From: Hind-M <70631848+Hind-M@users.noreply.github.com> Date: Tue, 10 Sep 2024 15:10:21 +0200 Subject: [PATCH 038/126] Add fallback to root prefix (#3435) * Add fallback to root prefix * Fix test_not_env * Fix tests * Add tests with no env var --- libmamba/src/api/clean.cpp | 1 + libmamba/src/api/config.cpp | 3 ++ libmamba/src/api/configuration.cpp | 18 +++++++-- libmamba/src/api/create.cpp | 1 + libmamba/src/api/info.cpp | 1 + libmamba/src/api/install.cpp | 1 + libmamba/src/api/list.cpp | 1 + libmamba/src/api/remove.cpp | 1 + libmamba/src/api/repoquery.cpp | 1 + libmamba/src/api/update.cpp | 1 + micromamba/src/config.cpp | 5 +++ micromamba/src/constructor.cpp | 1 + micromamba/src/shell.cpp | 1 + micromamba/tests/test_create.py | 7 ++-- micromamba/tests/test_info.py | 5 ++- micromamba/tests/test_install.py | 64 +++++++++++++++++++++++++----- micromamba/tests/test_remove.py | 11 +++-- micromamba/tests/test_shell.py | 1 + micromamba/tests/test_update.py | 62 +++++++++++++++++++++++++---- 19 files changed, 157 insertions(+), 29 deletions(-) diff --git a/libmamba/src/api/clean.cpp b/libmamba/src/api/clean.cpp index 785f339f8a..a0982b6757 100644 --- a/libmamba/src/api/clean.cpp +++ b/libmamba/src/api/clean.cpp @@ -23,6 +23,7 @@ namespace mamba auto& ctx = config.context(); config.at("use_target_prefix_fallback").set_value(true); + config.at("use_root_prefix_fallback").set_value(true); config.load(); bool clean_all = options & MAMBA_CLEAN_ALL; diff --git a/libmamba/src/api/config.cpp b/libmamba/src/api/config.cpp index fb63b512df..19a1008cc8 100644 --- a/libmamba/src/api/config.cpp +++ b/libmamba/src/api/config.cpp @@ -14,6 +14,7 @@ namespace mamba void config_describe(Configuration& config) { config.at("use_target_prefix_fallback").set_value(true); + config.at("use_root_prefix_fallback").set_value(true); config.at("target_prefix_checks") .set_value( MAMBA_ALLOW_EXISTING_PREFIX | MAMBA_ALLOW_MISSING_PREFIX @@ -37,6 +38,7 @@ namespace mamba void config_list(Configuration& config) { config.at("use_target_prefix_fallback").set_value(true); + config.at("use_root_prefix_fallback").set_value(true); config.at("target_prefix_checks") .set_value( MAMBA_ALLOW_EXISTING_PREFIX | MAMBA_ALLOW_MISSING_PREFIX @@ -68,6 +70,7 @@ namespace mamba void config_sources(Configuration& config) { config.at("use_target_prefix_fallback").set_value(true); + config.at("use_root_prefix_fallback").set_value(true); config.at("target_prefix_checks") .set_value( MAMBA_ALLOW_EXISTING_PREFIX | MAMBA_ALLOW_MISSING_PREFIX diff --git a/libmamba/src/api/configuration.cpp b/libmamba/src/api/configuration.cpp index 90219e3c8d..6cf68a3e0a 100644 --- a/libmamba/src/api/configuration.cpp +++ b/libmamba/src/api/configuration.cpp @@ -588,11 +588,17 @@ namespace mamba } else { - bool use_fallback = config.at("use_target_prefix_fallback").value(); - if (use_fallback) + bool use_target_prefix_fallback = config.at("use_target_prefix_fallback").value(); + if (use_target_prefix_fallback) { prefix = util::get_env("CONDA_PREFIX").value_or(""); } + + bool use_root_prefix_fallback = config.at("use_root_prefix_fallback").value(); + if (use_root_prefix_fallback && prefix.empty()) + { + prefix = root_prefix; + } } #ifdef _WIN32 @@ -1194,7 +1200,8 @@ namespace mamba "envs_dirs", "env_name", "spec_file_env_name", - "use_target_prefix_fallback" }) + "use_target_prefix_fallback", + "use_root_prefix_fallback" }) .set_single_op_lifetime() .description("Path to the target prefix") .set_post_merge_hook( @@ -1215,6 +1222,11 @@ namespace mamba .set_single_op_lifetime() .description("Fallback to the current target prefix or not")); + insert(Configurable("use_root_prefix_fallback", true) + .group("Basic") + .set_single_op_lifetime() + .description("Fallback to the root prefix or not")); + insert(Configurable("target_prefix_checks", MAMBA_NO_PREFIX_CHECK) .group("Basic") .needs({ "target_prefix", "rc_files" }) diff --git a/libmamba/src/api/create.cpp b/libmamba/src/api/create.cpp index 7fd44f9f56..7549a079f3 100644 --- a/libmamba/src/api/create.cpp +++ b/libmamba/src/api/create.cpp @@ -18,6 +18,7 @@ namespace mamba auto& ctx = config.context(); config.at("use_target_prefix_fallback").set_value(false); + config.at("use_root_prefix_fallback").set_value(false); config.at("target_prefix_checks") .set_value( MAMBA_ALLOW_EXISTING_PREFIX | MAMBA_ALLOW_NOT_ENV_PREFIX diff --git a/libmamba/src/api/info.cpp b/libmamba/src/api/info.cpp index b663c7e632..0b7e5b21f6 100644 --- a/libmamba/src/api/info.cpp +++ b/libmamba/src/api/info.cpp @@ -26,6 +26,7 @@ namespace mamba void info(Configuration& config) { config.at("use_target_prefix_fallback").set_value(true); + config.at("use_root_prefix_fallback").set_value(true); config.at("target_prefix_checks") .set_value( MAMBA_ALLOW_EXISTING_PREFIX | MAMBA_ALLOW_MISSING_PREFIX | MAMBA_ALLOW_NOT_ENV_PREFIX diff --git a/libmamba/src/api/install.cpp b/libmamba/src/api/install.cpp index 4e33fe7ab1..a722989bd8 100644 --- a/libmamba/src/api/install.cpp +++ b/libmamba/src/api/install.cpp @@ -220,6 +220,7 @@ namespace mamba config.at("create_base").set_value(true); config.at("use_target_prefix_fallback").set_value(true); + config.at("use_root_prefix_fallback").set_value(true); config.at("target_prefix_checks") .set_value( MAMBA_ALLOW_EXISTING_PREFIX | MAMBA_NOT_ALLOW_MISSING_PREFIX diff --git a/libmamba/src/api/list.cpp b/libmamba/src/api/list.cpp index 262dc7d9f7..99b489ebdc 100644 --- a/libmamba/src/api/list.cpp +++ b/libmamba/src/api/list.cpp @@ -18,6 +18,7 @@ namespace mamba void list(Configuration& config, const std::string& regex) { config.at("use_target_prefix_fallback").set_value(true); + config.at("use_root_prefix_fallback").set_value(true); config.at("target_prefix_checks") .set_value( MAMBA_ALLOW_EXISTING_PREFIX | MAMBA_ALLOW_MISSING_PREFIX diff --git a/libmamba/src/api/remove.cpp b/libmamba/src/api/remove.cpp index ff5eb66e39..3a30990529 100644 --- a/libmamba/src/api/remove.cpp +++ b/libmamba/src/api/remove.cpp @@ -27,6 +27,7 @@ namespace mamba bool remove_all = flags & MAMBA_REMOVE_ALL; config.at("use_target_prefix_fallback").set_value(true); + config.at("use_root_prefix_fallback").set_value(false); config.at("target_prefix_checks") .set_value( MAMBA_ALLOW_EXISTING_PREFIX | MAMBA_NOT_ALLOW_MISSING_PREFIX diff --git a/libmamba/src/api/repoquery.cpp b/libmamba/src/api/repoquery.cpp index f147047c97..fe38a6a064 100644 --- a/libmamba/src/api/repoquery.cpp +++ b/libmamba/src/api/repoquery.cpp @@ -25,6 +25,7 @@ namespace mamba repoquery_init(Context& ctx, Configuration& config, QueryResultFormat format, bool use_local) { config.at("use_target_prefix_fallback").set_value(true); + config.at("use_root_prefix_fallback").set_value(true); config.at("target_prefix_checks") .set_value(MAMBA_ALLOW_EXISTING_PREFIX | MAMBA_ALLOW_MISSING_PREFIX); config.load(); diff --git a/libmamba/src/api/update.cpp b/libmamba/src/api/update.cpp index 38957b09f1..64744f411f 100644 --- a/libmamba/src/api/update.cpp +++ b/libmamba/src/api/update.cpp @@ -132,6 +132,7 @@ namespace mamba auto& ctx = config.context(); config.at("use_target_prefix_fallback").set_value(true); + config.at("use_root_prefix_fallback").set_value(true); config.at("target_prefix_checks") .set_value( MAMBA_ALLOW_EXISTING_PREFIX | MAMBA_NOT_ALLOW_MISSING_PREFIX diff --git a/micromamba/src/config.cpp b/micromamba/src/config.cpp index aa0cbd4374..27618e1b63 100644 --- a/micromamba/src/config.cpp +++ b/micromamba/src/config.cpp @@ -302,6 +302,7 @@ void set_sequence_to_rc(mamba::Configuration& config, const SequenceAddType& opt) { config.at("use_target_prefix_fallback").set_value(true); + config.at("use_root_prefix_fallback").set_value(true); config.at("target_prefix_checks") .set_value( MAMBA_ALLOW_EXISTING_PREFIX | MAMBA_ALLOW_MISSING_PREFIX | MAMBA_ALLOW_NOT_ENV_PREFIX @@ -356,6 +357,7 @@ set_config_remove_key_command(CLI::App* subcom, mamba::Configuration& config) [&]() { config.at("use_target_prefix_fallback").set_value(true); + config.at("use_root_prefix_fallback").set_value(true); config.at("target_prefix_checks") .set_value( MAMBA_ALLOW_EXISTING_PREFIX | MAMBA_ALLOW_MISSING_PREFIX @@ -419,6 +421,7 @@ set_config_remove_command(CLI::App* subcom, mamba::Configuration& config) [&] { config.at("use_target_prefix_fallback").set_value(true); + config.at("use_root_prefix_fallback").set_value(true); config.at("target_prefix_checks") .set_value( MAMBA_ALLOW_EXISTING_PREFIX | MAMBA_ALLOW_MISSING_PREFIX @@ -496,6 +499,7 @@ set_config_set_command(CLI::App* subcom, mamba::Configuration& config) [&] { config.at("use_target_prefix_fallback").set_value(true); + config.at("use_root_prefix_fallback").set_value(true); config.at("target_prefix_checks") .set_value( MAMBA_ALLOW_EXISTING_PREFIX | MAMBA_ALLOW_MISSING_PREFIX @@ -541,6 +545,7 @@ set_config_get_command(CLI::App* subcom, mamba::Configuration& config) [&] { config.at("use_target_prefix_fallback").set_value(true); + config.at("use_root_prefix_fallback").set_value(true); config.at("target_prefix_checks") .set_value( MAMBA_ALLOW_EXISTING_PREFIX | MAMBA_ALLOW_MISSING_PREFIX diff --git a/micromamba/src/constructor.cpp b/micromamba/src/constructor.cpp index 05a228ece7..b70264785c 100644 --- a/micromamba/src/constructor.cpp +++ b/micromamba/src/constructor.cpp @@ -68,6 +68,7 @@ void construct(Configuration& config, const fs::u8path& prefix, bool extract_conda_pkgs, bool extract_tarball) { config.at("use_target_prefix_fallback").set_value(true); + config.at("use_root_prefix_fallback").set_value(true); config.at("target_prefix_checks") .set_value( MAMBA_ALLOW_EXISTING_PREFIX | MAMBA_ALLOW_MISSING_PREFIX | MAMBA_ALLOW_NOT_ENV_PREFIX diff --git a/micromamba/src/shell.cpp b/micromamba/src/shell.cpp index 5990a5ae67..e80544f5da 100644 --- a/micromamba/src/shell.cpp +++ b/micromamba/src/shell.cpp @@ -104,6 +104,7 @@ namespace void set_default_config_options(Configuration& config) { config.at("use_target_prefix_fallback").set_value(false); + config.at("use_root_prefix_fallback").set_value(false); config.at("target_prefix_checks").set_value(MAMBA_NO_PREFIX_CHECK); } diff --git a/micromamba/tests/test_create.py b/micromamba/tests/test_create.py index 69afc24477..f49ecb18e8 100644 --- a/micromamba/tests/test_create.py +++ b/micromamba/tests/test_create.py @@ -30,6 +30,7 @@ def check_create_result(res, root_prefix, target_prefix): assert res["root_prefix"] == str(root_prefix) assert res["target_prefix"] == str(target_prefix) assert not res["use_target_prefix_fallback"] + assert not res["use_root_prefix_fallback"] checks = ( helpers.MAMBA_ALLOW_EXISTING_PREFIX | helpers.MAMBA_NOT_ALLOW_MISSING_PREFIX @@ -168,7 +169,7 @@ def test_env_logging_overhead_regression(tmp_home, tmp_root_prefix, tmp_path): @pytest.mark.parametrize("cli_env_name", (False, True)) @pytest.mark.parametrize("yaml_name", (False, True, "prefix")) @pytest.mark.parametrize("env_var", (False, True)) -@pytest.mark.parametrize("fallback", (False, True)) +@pytest.mark.parametrize("current_target_prefix_fallback", (False, True)) @pytest.mark.parametrize( "similar_non_canonical,non_canonical_position", ((False, None), (True, "append"), (True, "prepend")), @@ -183,7 +184,7 @@ def test_target_prefix( cli_env_name, yaml_name, env_var, - fallback, + current_target_prefix_fallback, similar_non_canonical, non_canonical_position, ): @@ -243,7 +244,7 @@ def test_target_prefix( if env_var: os.environ["MAMBA_TARGET_PREFIX"] = str(p) - if not fallback: + if not current_target_prefix_fallback: os.environ.pop("CONDA_PREFIX", None) else: os.environ["CONDA_PREFIX"] = str(p) diff --git a/micromamba/tests/test_info.py b/micromamba/tests/test_info.py index d334fd960e..7d0e432c2d 100644 --- a/micromamba/tests/test_info.py +++ b/micromamba/tests/test_info.py @@ -58,8 +58,9 @@ def test_not_env(tmp_home, tmp_root_prefix, prefix_selection, existing_prefix): infos = helpers.info() if prefix_selection is None: - expected_name = "None" - location = "-" + # Fallback on root prefix + expected_name = "base" + location = tmp_root_prefix elif prefix_selection == "env_var": expected_name = name + " (active)" location = prefix diff --git a/micromamba/tests/test_install.py b/micromamba/tests/test_install.py index 7a11b1ab9d..f105473339 100644 --- a/micromamba/tests/test_install.py +++ b/micromamba/tests/test_install.py @@ -1,8 +1,8 @@ import os +import platform import shutil import subprocess import sys -import platform from pathlib import Path import pytest @@ -51,6 +51,7 @@ def config_tests(cls, res, root_prefix=root_prefix, target_prefix=prefix): assert res["root_prefix"] == root_prefix assert res["target_prefix"] == target_prefix assert res["use_target_prefix_fallback"] + assert res["use_root_prefix_fallback"] checks = ( helpers.MAMBA_ALLOW_EXISTING_PREFIX | helpers.MAMBA_NOT_ALLOW_MISSING_PREFIX @@ -116,7 +117,7 @@ def test_specs(self, source, file_type, existing_cache): @pytest.mark.parametrize("cli_env_name", (False, True)) @pytest.mark.parametrize("yaml_name", (False, True, "prefix")) @pytest.mark.parametrize("env_var", (False, True)) - @pytest.mark.parametrize("fallback", (False, True)) + @pytest.mark.parametrize("current_target_prefix_fallback", (False, True)) def test_target_prefix( self, root_prefix, @@ -125,7 +126,7 @@ def test_target_prefix( cli_env_name, yaml_name, env_var, - fallback, + current_target_prefix_fallback, existing_cache, ): cmd = [] @@ -176,22 +177,67 @@ def test_target_prefix( if env_var: os.environ["MAMBA_TARGET_PREFIX"] = p - if not fallback: + if not current_target_prefix_fallback: os.environ.pop("CONDA_PREFIX") else: os.environ["CONDA_PREFIX"] = p - if ( - (cli_prefix and cli_env_name) - or (yaml_name == "prefix") - or not (cli_prefix or cli_env_name or yaml_name or env_var or fallback) - ): + if (cli_prefix and cli_env_name) or (yaml_name == "prefix"): with pytest.raises(subprocess.CalledProcessError): helpers.install(*cmd, "--print-config-only") + elif not ( + cli_prefix or cli_env_name or yaml_name or env_var or current_target_prefix_fallback + ): + # Fallback on root prefix + res = helpers.install(*cmd, "--print-config-only") + TestInstall.config_tests(res, root_prefix=r, target_prefix=r) else: res = helpers.install(*cmd, "--print-config-only") TestInstall.config_tests(res, root_prefix=r, target_prefix=expected_p) + def test_target_prefix_with_no_settings( + self, + existing_cache, + ): + # Specify no arg + cmd = [] + + # Get the actual set MAMBA_ROOT_PREFIX when setting up `TestInstall` class + os.environ["MAMBA_DEFAULT_ROOT_PREFIX"] = os.environ.pop("MAMBA_ROOT_PREFIX") + os.environ.pop("CONDA_PREFIX") + + # Fallback on root prefix + res = helpers.install(*cmd, "--print-config-only") + + TestInstall.config_tests( + res, + root_prefix=TestInstall.root_prefix, + target_prefix=TestInstall.root_prefix, + ) + + @pytest.mark.skipif( + sys.platform == "win32", + reason="MAMBA_ROOT_PREFIX is set in windows GH workflow", + ) + def test_target_prefix_with_no_settings_and_no_env_var( + self, + existing_cache, + ): + # Specify no arg + cmd = [] + + os.environ.pop("MAMBA_ROOT_PREFIX") + os.environ.pop("CONDA_PREFIX") + + # Fallback on root prefix + res = helpers.install(*cmd, "--print-config-only") + + TestInstall.config_tests( + res, + root_prefix=TestInstall.current_root_prefix, + target_prefix=TestInstall.current_root_prefix, + ) + @pytest.mark.parametrize("cli", (False, True)) @pytest.mark.parametrize("yaml", (False, True)) @pytest.mark.parametrize("env_var", (False, True)) diff --git a/micromamba/tests/test_remove.py b/micromamba/tests/test_remove.py index f149c4b397..aa20e71335 100644 --- a/micromamba/tests/test_remove.py +++ b/micromamba/tests/test_remove.py @@ -180,6 +180,7 @@ def remove_config_common_assertions(res, root_prefix, target_prefix): assert res["root_prefix"] == str(root_prefix) assert res["target_prefix"] == str(target_prefix) assert res["use_target_prefix_fallback"] + assert not res["use_root_prefix_fallback"] checks = ( helpers.MAMBA_ALLOW_EXISTING_PREFIX | helpers.MAMBA_NOT_ALLOW_MISSING_PREFIX @@ -205,7 +206,7 @@ def test_remove_config_specs(tmp_home, tmp_root_prefix, tmp_prefix): @pytest.mark.parametrize("cli_prefix", (False, True)) @pytest.mark.parametrize("cli_env_name", (False, True)) @pytest.mark.parametrize("env_var", (False, True)) -@pytest.mark.parametrize("fallback", (False, True)) +@pytest.mark.parametrize("current_target_prefix_fallback", (False, True)) def test_remove_config_target_prefix( tmp_home, tmp_root_prefix, @@ -216,7 +217,7 @@ def test_remove_config_target_prefix( cli_prefix, cli_env_name, env_var, - fallback, + current_target_prefix_fallback, ): (tmp_root_prefix / "conda-meta").mkdir(parents=True, exist_ok=True) @@ -246,12 +247,14 @@ def test_remove_config_target_prefix( if env_var: os.environ["MAMBA_TARGET_PREFIX"] = p - if not fallback: + if not current_target_prefix_fallback: os.environ.pop("CONDA_PREFIX") else: os.environ["CONDA_PREFIX"] = p - if (cli_prefix and cli_env_name) or not (cli_prefix or cli_env_name or env_var or fallback): + if (cli_prefix and cli_env_name) or not ( + cli_prefix or cli_env_name or env_var or current_target_prefix_fallback + ): with pytest.raises(subprocess.CalledProcessError): helpers.remove(*cmd, "--print-config-only") else: diff --git a/micromamba/tests/test_shell.py b/micromamba/tests/test_shell.py index 4eff0d233f..50c1a77eb7 100644 --- a/micromamba/tests/test_shell.py +++ b/micromamba/tests/test_shell.py @@ -190,6 +190,7 @@ def test_activate_target_prefix_checks(tmp_home, tmp_root_prefix): res = helpers.shell("activate", "-p", tmp_root_prefix, "--print-config-only") assert res["target_prefix_checks"] == helpers.MAMBA_NO_PREFIX_CHECK assert not res["use_target_prefix_fallback"] + assert not res["use_root_prefix_fallback"] @pytest.mark.parametrize("shell_type", ["bash", "powershell", "cmd.exe"]) diff --git a/micromamba/tests/test_update.py b/micromamba/tests/test_update.py index a79c8a3430..ea1ad3e187 100644 --- a/micromamba/tests/test_update.py +++ b/micromamba/tests/test_update.py @@ -1,6 +1,7 @@ import os import platform import shutil +import sys from pathlib import Path import pytest @@ -244,6 +245,7 @@ def config_tests(cls, res, root_prefix=root_prefix, target_prefix=prefix): assert res["root_prefix"] == root_prefix assert res["target_prefix"] == target_prefix assert res["use_target_prefix_fallback"] + assert res["use_root_prefix_fallback"] checks = ( helpers.MAMBA_ALLOW_EXISTING_PREFIX | helpers.MAMBA_NOT_ALLOW_MISSING_PREFIX @@ -308,7 +310,7 @@ def test_specs(self, source, file_type, env_created): @pytest.mark.parametrize("cli_env_name", (False, True)) @pytest.mark.parametrize("yaml_name", (False, True, "prefix")) @pytest.mark.parametrize("env_var", (False, True)) - @pytest.mark.parametrize("fallback", (False, True)) + @pytest.mark.parametrize("current_target_prefix_fallback", (False, True)) def test_target_prefix( self, root_prefix, @@ -317,7 +319,7 @@ def test_target_prefix( cli_env_name, yaml_name, env_var, - fallback, + current_target_prefix_fallback, env_created, ): cmd = [] @@ -368,22 +370,66 @@ def test_target_prefix( if env_var: os.environ["MAMBA_TARGET_PREFIX"] = p - if not fallback: + if not current_target_prefix_fallback: os.environ.pop("CONDA_PREFIX") else: os.environ["CONDA_PREFIX"] = p - if ( - (cli_prefix and cli_env_name) - or (yaml_name == "prefix") - or not (cli_prefix or cli_env_name or yaml_name or env_var or fallback) - ): + if (cli_prefix and cli_env_name) or (yaml_name == "prefix"): with pytest.raises(helpers.subprocess.CalledProcessError): helpers.install(*cmd, "--print-config-only") + elif not ( + cli_prefix or cli_env_name or yaml_name or env_var or current_target_prefix_fallback + ): + # Fallback on root prefix + res = helpers.install(*cmd, "--print-config-only") + TestUpdateConfig.config_tests(res, root_prefix=r, target_prefix=r) else: res = helpers.install(*cmd, "--print-config-only") TestUpdateConfig.config_tests(res, root_prefix=r, target_prefix=expected_p) + def test_target_prefix_with_no_settings( + self, + existing_cache, + ): + # Specify no arg + cmd = [] + + # Get the actual set MAMBA_ROOT_PREFIX when setting up `TestUpdateConfig` class + os.environ["MAMBA_DEFAULT_ROOT_PREFIX"] = os.environ.pop("MAMBA_ROOT_PREFIX") + os.environ.pop("CONDA_PREFIX") + + # Fallback on root prefix + res = helpers.install(*cmd, "--print-config-only") + TestUpdateConfig.config_tests( + res, + root_prefix=TestUpdateConfig.root_prefix, + target_prefix=TestUpdateConfig.root_prefix, + ) + + @pytest.mark.skipif( + sys.platform == "win32", + reason="MAMBA_ROOT_PREFIX is set in windows GH workflow", + ) + def test_target_prefix_with_no_settings_and_no_env_var( + self, + existing_cache, + ): + # Specify no arg + cmd = [] + + os.environ.pop("MAMBA_ROOT_PREFIX") + os.environ.pop("CONDA_PREFIX") + + # Fallback on root prefix + res = helpers.install(*cmd, "--print-config-only") + + TestUpdateConfig.config_tests( + res, + root_prefix=TestUpdateConfig.current_root_prefix, + target_prefix=TestUpdateConfig.current_root_prefix, + ) + @pytest.mark.parametrize("cli", (False, True)) @pytest.mark.parametrize("yaml", (False, True)) @pytest.mark.parametrize("env_var", (False, True)) From a261cd461d186552115925efad2cc714543e8774 Mon Sep 17 00:00:00 2001 From: Wolf Vollprecht Date: Thu, 12 Sep 2024 19:28:40 +0200 Subject: [PATCH 039/126] fix: add warning when using defaults (#3434) Signed-off-by: Julien Jerphanion Co-authored-by: Julien Jerphanion Co-authored-by: Hind Montassif Co-authored-by: Johan Mabille Co-authored-by: Sylvain Corlay --- .github/workflows/static_build.yml | 17 +++++++++++++++++ dev/environment-dev.yml | 2 +- dev/environment-micromamba-static.yml | 4 ++-- libmamba/include/mamba/core/context.hpp | 2 ++ libmamba/src/api/channel_loader.cpp | 10 ++++++++++ libmamba/src/api/configuration.cpp | 6 ++++++ libmambapy/src/libmambapy/bindings/legacy.cpp | 1 + 7 files changed, 39 insertions(+), 3 deletions(-) diff --git a/.github/workflows/static_build.yml b/.github/workflows/static_build.yml index ac798d4a8e..e3c8a989bd 100644 --- a/.github/workflows/static_build.yml +++ b/.github/workflows/static_build.yml @@ -38,6 +38,23 @@ jobs: with: repository: conda-forge/micromamba-feedstock path: micromamba-feedstock + - name: Disable output validation + if: ${{ matrix.platform == 'osx' }} + run: | + cd micromamba-feedstock/ + sed -i '' '/conda_forge_output_validation/d' conda-forge.yml + - name: Pin libcurl + if: ${{ matrix.platform == 'osx' }} + run: | + cd micromamba-feedstock/ + sed -i '' 's/libcurl >=8.4.0/libcurl >=8.4.0,<8.10/g' recipe/meta.yaml + sed -i '' 's/libcurl-static >=8.4.0/libcurl-static >=8.4.0,<8.10/g' recipe/meta.yaml + - name: Pin libcurl + if: ${{ matrix.platform == 'linux' }} + run: | + cd micromamba-feedstock/ + sed -i 's/libcurl >=8.4.0/libcurl >=8.4.0,<8.10/g' recipe/meta.yaml + sed -i 's/libcurl-static >=8.4.0/libcurl-static >=8.4.0,<8.10/g' recipe/meta.yaml - name: Checkout mamba branch uses: actions/checkout@v4 with: diff --git a/dev/environment-dev.yml b/dev/environment-dev.yml index f4827b683e..ae90134024 100644 --- a/dev/environment-dev.yml +++ b/dev/environment-dev.yml @@ -11,7 +11,7 @@ dependencies: - cpp-expected - fmt - libarchive - - libcurl >=7.86 + - libcurl >=7.86,<8.10 - libsodium - libsolv >=0.7.18 - nlohmann_json diff --git a/dev/environment-micromamba-static.yml b/dev/environment-micromamba-static.yml index c404dd6186..4cc7196e24 100644 --- a/dev/environment-micromamba-static.yml +++ b/dev/environment-micromamba-static.yml @@ -17,8 +17,8 @@ dependencies: - yaml-cpp-static >=0.8.0 - reproc-static >=14.2.4.post0 - reproc-cpp-static >=14.2.4.post0 - - libcurl >=8.4.0 - - libcurl-static >=8.4.0 + - libcurl >=8.4.0,<8.10 + - libcurl-static >=8.4.0,<8.10 - xz-static - libssh2-static - libarchive-minimal-static diff --git a/libmamba/include/mamba/core/context.hpp b/libmamba/include/mamba/core/context.hpp index 378882eda2..dc04cad23c 100644 --- a/libmamba/include/mamba/core/context.hpp +++ b/libmamba/include/mamba/core/context.hpp @@ -173,6 +173,8 @@ namespace mamba bool always_softlink = false; bool register_envs = true; + bool show_anaconda_channel_warnings = true; + // solver options solver::Request::Flags solver_flags = {}; diff --git a/libmamba/src/api/channel_loader.cpp b/libmamba/src/api/channel_loader.cpp index 299780a509..b80c89450b 100644 --- a/libmamba/src/api/channel_loader.cpp +++ b/libmamba/src/api/channel_loader.cpp @@ -63,6 +63,16 @@ namespace mamba { for (const auto& platform : channel.platforms()) { + auto show_warning = ctx.show_anaconda_channel_warnings; + auto channel_name = channel.platform_url(platform).host(); + if (channel_name == "repo.anaconda.com" && show_warning) + { + LOG_WARNING << "'" << channel_name + << "', a commercial channel hosted by Anaconda.com, is used.\n"; + LOG_WARNING << "Please make sure you understand Anaconda Terms of Services.\n"; + LOG_WARNING << "See: https://legal.anaconda.com/policies/en/"; + } + auto sdires = SubdirData::create( ctx, channel_context, diff --git a/libmamba/src/api/configuration.cpp b/libmamba/src/api/configuration.cpp index 6cf68a3e0a..9f21dd7afd 100644 --- a/libmamba/src/api/configuration.cpp +++ b/libmamba/src/api/configuration.cpp @@ -1660,6 +1660,12 @@ namespace mamba !WARNING: Using this option can result in corruption of long-lived environments due to broken links (deleted cache).)"))); + insert(Configurable("show_anaconda_channel_warnings", &m_context.show_anaconda_channel_warnings) + .group("Extract, Link & Install") + .set_rc_configurable() + .set_env_var_names({ "MAMBA_SHOW_ANACONDA_CHANNEL_WARNINGS" }) + .description("Show the warning when the Anaconda official channels are used")); + insert(Configurable("shortcuts", &m_context.shortcuts) .group("Extract, Link & Install") .set_rc_configurable() diff --git a/libmambapy/src/libmambapy/bindings/legacy.cpp b/libmambapy/src/libmambapy/bindings/legacy.cpp index 861de46ec0..17c48894e3 100644 --- a/libmambapy/src/libmambapy/bindings/legacy.cpp +++ b/libmambapy/src/libmambapy/bindings/legacy.cpp @@ -694,6 +694,7 @@ bind_submodule_impl(pybind11::module_ m) .def_readwrite("local_repodata_ttl", &Context::local_repodata_ttl) .def_readwrite("use_index_cache", &Context::use_index_cache) .def_readwrite("always_yes", &Context::always_yes) + .def_readwrite("show_anaconda_channel_warnings", &Context::show_anaconda_channel_warnings) .def_readwrite("dry_run", &Context::dry_run) .def_readwrite("download_only", &Context::download_only) .def_readwrite("add_pip_as_python_dependency", &Context::add_pip_as_python_dependency) From 5810eb8c0b4d3db9695458e7ef6c1e6363575f99 Mon Sep 17 00:00:00 2001 From: Johan Mabille Date: Thu, 12 Sep 2024 21:26:43 +0200 Subject: [PATCH 040/126] Remove cctools patch from feedstock in CI (#3442) --- .github/workflows/static_build.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/static_build.yml b/.github/workflows/static_build.yml index e3c8a989bd..3776f32351 100644 --- a/.github/workflows/static_build.yml +++ b/.github/workflows/static_build.yml @@ -49,12 +49,22 @@ jobs: cd micromamba-feedstock/ sed -i '' 's/libcurl >=8.4.0/libcurl >=8.4.0,<8.10/g' recipe/meta.yaml sed -i '' 's/libcurl-static >=8.4.0/libcurl-static >=8.4.0,<8.10/g' recipe/meta.yaml + - name: remove cctools patch + if: ${{ matrix.platform == 'osx' }} + run: | + cd micromamba-feedstock/ + sed -i '' '/cctools-and-ld64.patch/d' recipe/meta.yaml - name: Pin libcurl if: ${{ matrix.platform == 'linux' }} run: | cd micromamba-feedstock/ sed -i 's/libcurl >=8.4.0/libcurl >=8.4.0,<8.10/g' recipe/meta.yaml sed -i 's/libcurl-static >=8.4.0/libcurl-static >=8.4.0,<8.10/g' recipe/meta.yaml + - name: remove cctools patch + if: ${{ matrix.platform == 'linux' }} + run: | + cd micromamba-feedstock/ + sed -i '/cctools-and-ld64.patch/d' recipe/meta.yaml - name: Checkout mamba branch uses: actions/checkout@v4 with: From f1f0827e08b1a79df267ea0f17671eccc234d053 Mon Sep 17 00:00:00 2001 From: Hind Montassif Date: Fri, 13 Sep 2024 10:55:58 +0200 Subject: [PATCH 041/126] release libmamba 2.0.0rc5, libmambapy 2.0.0rc5, micromamba 2.0.0rc5 --- CHANGELOG.md | 24 ++++++++++++++++++++++++ libmamba/CHANGELOG.md | 22 ++++++++++++++++++++++ libmambapy/CHANGELOG.md | 16 ++++++++++++++++ micromamba/CHANGELOG.md | 18 ++++++++++++++++++ 4 files changed, 80 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 29d84f4879..9807699c37 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,27 @@ +2024.09.13 +========== + +Releases: libmamba 2.0.0rc5, libmambapy 2.0.0rc5, micromamba 2.0.0rc5 + +Enhancements: + +- [all] Remove cctools patch from feedstock in CI by @JohanMabille in https://github.com/mamba-org/mamba/pull/3442 + +Bug fixes: + +- [libmamba, libmambapy] fix: add warning when using defaults by @wolfv in https://github.com/mamba-org/mamba/pull/3434 +- [libmamba, micromamba] Add fallback to root prefix by @Hind-M in https://github.com/mamba-org/mamba/pull/3435 +- [libmamba] Fix x86_64 to use underscore instead of dash by @traversaro in https://github.com/mamba-org/mamba/pull/3433 +- [libmamba, micromamba] Fixed micromamba static build after cctools and ld64 upgrade on conda… by @JohanMabille in https://github.com/mamba-org/mamba/pull/3436 +- [libmamba, micromamba] fix: PyPI support for `env update` by @jjerphan in https://github.com/mamba-org/mamba/pull/3419 +- [libmamba] Fix output by @Hind-M in https://github.com/mamba-org/mamba/pull/3428 +- [all] Update mamba.sh.in script by @SylvainCorlay in https://github.com/mamba-org/mamba/pull/3422 +- [libmamba] Execute remove action before install actions by @SylvainCorlay in https://github.com/mamba-org/mamba/pull/3424 + +CI fixes and doc: + +- [all] docs: Specify `CMAKE_INSTALL_PREFIX` by @jjerphan in https://github.com/mamba-org/mamba/pull/3438 + 2024.08.29 ========== diff --git a/libmamba/CHANGELOG.md b/libmamba/CHANGELOG.md index 0ee1ef1c06..b8871f37f7 100644 --- a/libmamba/CHANGELOG.md +++ b/libmamba/CHANGELOG.md @@ -1,3 +1,25 @@ +libmamba 2.0.0rc5 (September 13, 2024) +====================================== + +Enhancements: + +- Remove cctools patch from feedstock in CI by @JohanMabille in https://github.com/mamba-org/mamba/pull/3442 + +Bug fixes: + +- fix: add warning when using defaults by @wolfv in https://github.com/mamba-org/mamba/pull/3434 +- Add fallback to root prefix by @Hind-M in https://github.com/mamba-org/mamba/pull/3435 +- Fix x86_64 to use underscore instead of dash by @traversaro in https://github.com/mamba-org/mamba/pull/3433 +- Fixed micromamba static build after cctools and ld64 upgrade on conda… by @JohanMabille in https://github.com/mamba-org/mamba/pull/3436 +- fix: PyPI support for `env update` by @jjerphan in https://github.com/mamba-org/mamba/pull/3419 +- Fix output by @Hind-M in https://github.com/mamba-org/mamba/pull/3428 +- Update mamba.sh.in script by @SylvainCorlay in https://github.com/mamba-org/mamba/pull/3422 +- Execute remove action before install actions by @SylvainCorlay in https://github.com/mamba-org/mamba/pull/3424 + +CI fixes and doc: + +- docs: Specify `CMAKE_INSTALL_PREFIX` by @jjerphan in https://github.com/mamba-org/mamba/pull/3438 + libmamba 2.0.0rc4 (August 29, 2024) =================================== diff --git a/libmambapy/CHANGELOG.md b/libmambapy/CHANGELOG.md index c59583e307..04219ff7d7 100644 --- a/libmambapy/CHANGELOG.md +++ b/libmambapy/CHANGELOG.md @@ -1,3 +1,19 @@ +libmambapy 2.0.0rc5 (September 13, 2024) +======================================== + +Enhancements: + +- Remove cctools patch from feedstock in CI by @JohanMabille in https://github.com/mamba-org/mamba/pull/3442 + +Bug fixes: + +- fix: add warning when using defaults by @wolfv in https://github.com/mamba-org/mamba/pull/3434 +- Update mamba.sh.in script by @SylvainCorlay in https://github.com/mamba-org/mamba/pull/3422 + +CI fixes and doc: + +- docs: Specify `CMAKE_INSTALL_PREFIX` by @jjerphan in https://github.com/mamba-org/mamba/pull/3438 + libmambapy 2.0.0rc4 (August 29, 2024) ===================================== diff --git a/micromamba/CHANGELOG.md b/micromamba/CHANGELOG.md index 4aaba00256..806675dc3b 100644 --- a/micromamba/CHANGELOG.md +++ b/micromamba/CHANGELOG.md @@ -1,3 +1,21 @@ +micromamba 2.0.0rc5 (September 13, 2024) +======================================== + +Enhancements: + +- Remove cctools patch from feedstock in CI by @JohanMabille in https://github.com/mamba-org/mamba/pull/3442 + +Bug fixes: + +- Add fallback to root prefix by @Hind-M in https://github.com/mamba-org/mamba/pull/3435 +- Fixed micromamba static build after cctools and ld64 upgrade on conda… by @JohanMabille in https://github.com/mamba-org/mamba/pull/3436 +- fix: PyPI support for `env update` by @jjerphan in https://github.com/mamba-org/mamba/pull/3419 +- Update mamba.sh.in script by @SylvainCorlay in https://github.com/mamba-org/mamba/pull/3422 + +CI fixes and doc: + +- docs: Specify `CMAKE_INSTALL_PREFIX` by @jjerphan in https://github.com/mamba-org/mamba/pull/3438 + micromamba 2.0.0rc4 (August 29, 2024) ===================================== From b08d40d4d7fecf8349631b8e0996d2db75a9e91b Mon Sep 17 00:00:00 2001 From: Hind-M <70631848+Hind-M@users.noreply.github.com> Date: Tue, 17 Sep 2024 13:40:38 +0200 Subject: [PATCH 042/126] Fix test in osx (#3448) Use PRE_COMMIT_USE_MAMBA instead of PRE_COMMIT_USE_MICROMAMBA --- micromamba/tests/test_create.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/micromamba/tests/test_create.py b/micromamba/tests/test_create.py index f49ecb18e8..c67ac3a6e7 100644 --- a/micromamba/tests/test_create.py +++ b/micromamba/tests/test_create.py @@ -979,7 +979,7 @@ def create_repo(path: Path) -> str: env_prefix = tmp_path / "some-prefix" helpers.create("-p", env_prefix, "pre-commit") env_overrides = { - "PRE_COMMIT_USE_MICROMAMBA": "1", + "PRE_COMMIT_USE_MAMBA": "1", "PATH": os.pathsep.join( [ str(Path(helpers.get_umamba()).parent), From af81975dbc35f1dc3b2b58035d21fdeea64f7542 Mon Sep 17 00:00:00 2001 From: Hind-M <70631848+Hind-M@users.noreply.github.com> Date: Tue, 17 Sep 2024 15:08:00 +0200 Subject: [PATCH 043/126] Remove cctools patch removal in CI (#3451) --- .github/workflows/static_build.yml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/.github/workflows/static_build.yml b/.github/workflows/static_build.yml index 3776f32351..e3c8a989bd 100644 --- a/.github/workflows/static_build.yml +++ b/.github/workflows/static_build.yml @@ -49,22 +49,12 @@ jobs: cd micromamba-feedstock/ sed -i '' 's/libcurl >=8.4.0/libcurl >=8.4.0,<8.10/g' recipe/meta.yaml sed -i '' 's/libcurl-static >=8.4.0/libcurl-static >=8.4.0,<8.10/g' recipe/meta.yaml - - name: remove cctools patch - if: ${{ matrix.platform == 'osx' }} - run: | - cd micromamba-feedstock/ - sed -i '' '/cctools-and-ld64.patch/d' recipe/meta.yaml - name: Pin libcurl if: ${{ matrix.platform == 'linux' }} run: | cd micromamba-feedstock/ sed -i 's/libcurl >=8.4.0/libcurl >=8.4.0,<8.10/g' recipe/meta.yaml sed -i 's/libcurl-static >=8.4.0/libcurl-static >=8.4.0,<8.10/g' recipe/meta.yaml - - name: remove cctools patch - if: ${{ matrix.platform == 'linux' }} - run: | - cd micromamba-feedstock/ - sed -i '/cctools-and-ld64.patch/d' recipe/meta.yaml - name: Checkout mamba branch uses: actions/checkout@v4 with: From 81c099c3a1565f75fc7fd9037b3cbbd74607c528 Mon Sep 17 00:00:00 2001 From: Julien Jerphanion Date: Tue, 17 Sep 2024 17:38:06 +0200 Subject: [PATCH 044/126] fix: Environment removal confirmation (#3450) * fix: Environment removal confirmation Signed-off-by: Julien Jerphanion * Handle empty environment deletion Signed-off-by: Julien Jerphanion * Handle 'n' Signed-off-by: Julien Jerphanion * Reoder logic Signed-off-by: Julien Jerphanion * Use enum class for `RemoveResult` Co-authored-by: Hind-M <70631848+Hind-M@users.noreply.github.com> --------- Signed-off-by: Julien Jerphanion Co-authored-by: Hind-M <70631848+Hind-M@users.noreply.github.com> --- libmamba/include/mamba/api/remove.hpp | 11 +++++++++-- libmamba/src/api/remove.cpp | 17 +++++++++++------ micromamba/src/env.cpp | 20 +++++++++++++++++++- 3 files changed, 39 insertions(+), 9 deletions(-) diff --git a/libmamba/include/mamba/api/remove.hpp b/libmamba/include/mamba/api/remove.hpp index c77a2fc117..98c75e659c 100644 --- a/libmamba/include/mamba/api/remove.hpp +++ b/libmamba/include/mamba/api/remove.hpp @@ -18,11 +18,18 @@ namespace mamba class ChannelContext; class Configuration; - void remove(Configuration& config, int flags = MAMBA_REMOVE_PRUNE); + enum class RemoveResult : int + { + YES = 0, + NO = 1, + EMPTY = 2, + }; + + RemoveResult remove(Configuration& config, int flags = MAMBA_REMOVE_PRUNE); namespace detail { - void remove_specs( + bool remove_specs( Context& ctx, ChannelContext& channel_context, const std::vector& specs, diff --git a/libmamba/src/api/remove.cpp b/libmamba/src/api/remove.cpp index 3a30990529..d810ca8e62 100644 --- a/libmamba/src/api/remove.cpp +++ b/libmamba/src/api/remove.cpp @@ -18,7 +18,7 @@ namespace mamba { - void remove(Configuration& config, int flags) + RemoveResult remove(Configuration& config, int flags) { auto& ctx = config.context(); @@ -56,11 +56,14 @@ namespace mamba if (!remove_specs.empty()) { - detail::remove_specs(ctx, channel_context, remove_specs, prune, force); + return detail::remove_specs(ctx, channel_context, remove_specs, prune, force) + ? RemoveResult::YES + : RemoveResult::NO; } else { Console::instance().print("Nothing to do."); + return RemoveResult::EMPTY; } } @@ -108,7 +111,7 @@ namespace mamba namespace detail { - void remove_specs( + bool remove_specs( Context& ctx, ChannelContext& channel_context, const std::vector& raw_specs, @@ -144,10 +147,12 @@ namespace mamba transaction.log_json(); } - if (transaction.prompt(ctx, channel_context)) + auto prompt_entry = transaction.prompt(ctx, channel_context); + if (prompt_entry) { transaction.execute(ctx, channel_context, prefix_data); } + return prompt_entry; }; if (force) @@ -168,7 +173,7 @@ namespace mamba } } auto transaction = MTransaction(ctx, pool, pkgs_to_remove, {}, package_caches); - execute_transaction(transaction); + return execute_transaction(transaction); } else { @@ -206,7 +211,7 @@ namespace mamba package_caches ); - execute_transaction(transaction); + return execute_transaction(transaction); } } } diff --git a/micromamba/src/env.cpp b/micromamba/src/env.cpp index 6967f51136..b3d8761b6f 100644 --- a/micromamba/src/env.cpp +++ b/micromamba/src/env.cpp @@ -236,7 +236,25 @@ set_env_command(CLI::App* com, Configuration& config) [&config] { // Remove specs if exist - remove(config, MAMBA_REMOVE_ALL); + RemoveResult remove_env_result = remove(config, MAMBA_REMOVE_ALL); + + if (remove_env_result == RemoveResult::NO) + { + Console::stream() << "The environment was not removed."; + return; + } + + if (remove_env_result == RemoveResult::EMPTY) + { + Console::stream() << "No packages to remove from environment."; + + auto res = Console::prompt("Do you want to remove the environment?", 'Y'); + if (!res) + { + Console::stream() << "The environment was not removed."; + return; + } + } const auto& ctx = config.context(); if (!ctx.dry_run) From a9d8ea58ffde727ffe48b811852742e275b9e975 Mon Sep 17 00:00:00 2001 From: Hind-M <70631848+Hind-M@users.noreply.github.com> Date: Thu, 19 Sep 2024 11:27:10 +0200 Subject: [PATCH 045/126] Fix wrong version of miniforge in doc (#3462) --- docs/source/installation/mamba-installation.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/installation/mamba-installation.rst b/docs/source/installation/mamba-installation.rst index f60a6ae9f6..18a529259e 100644 --- a/docs/source/installation/mamba-installation.rst +++ b/docs/source/installation/mamba-installation.rst @@ -7,7 +7,7 @@ Mamba Installation Fresh install (recommended) *************************** -We recommend that you start with the `Miniforge distribution `_ >= ``Miniforge3-22.3.1-0``. +We recommend that you start with the `Miniforge distribution `_ >= ``Miniforge3-23.3.1-0``. If you need an older version of Mamba, please use the Mambaforge distribution. Miniforge comes with the popular ``conda-forge`` channel preconfigured, but you can modify the configuration to use any channel you like. From fc06ae8bbc7b9867fec99bfbb7b0423c426643b9 Mon Sep 17 00:00:00 2001 From: Hind-M <70631848+Hind-M@users.noreply.github.com> Date: Thu, 19 Sep 2024 11:43:05 +0200 Subject: [PATCH 046/126] Fix `test_env_update_pypi_with_conda_forge` (#3459) Fix test --- micromamba/tests/test_env.py | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/micromamba/tests/test_env.py b/micromamba/tests/test_env.py index 2c202189e0..2f6feca08e 100644 --- a/micromamba/tests/test_env.py +++ b/micromamba/tests/test_env.py @@ -1,6 +1,8 @@ import os import re import shutil + +from packaging.version import Version from pathlib import Path import pytest @@ -152,8 +154,6 @@ def test_env_update(tmp_home, tmp_root_prefix, tmp_path, prune): assert not any(package["name"] == "ipython" for package in packages) # Update python - from packaging.version import Version - env_file_yml = tmp_path / "test_env.yaml" env_file_yml.write_text(env_yaml_content_with_version_and_new_pkg) @@ -361,5 +361,12 @@ def test_env_update_pypi_with_conda_forge(tmp_home, tmp_root_prefix, tmp_path): ## See: https://github.com/mamba-org/mamba/issues/2059 pip_list_output = helpers.umamba_run("-p", env_prefix, "pip", "list", "--format=json") pip_packages_list = yaml.safe_load(pip_list_output) - - assert any(pkg["name"] == "numpy" and pkg["version"] == "1.26.4" for pkg in pip_packages_list) + # When numpy 2.0.0 is installed using mamba, + # `numpy-2.0.0.dist-info/` is still created in `env_prefix/lib/pythonx.x/site-packages/` alongside `numpy-1.26.4.dist-info` + # therefore causing an unexpected result when listing the version. + # In an ideal world, multiple package managers shouldn't be mixed but since this is supported, tests are here + # (note that a warning is printed to the user in that case) + assert any( + pkg["name"] == "numpy" and Version(pkg["version"]) >= Version("1.26.4") + for pkg in pip_packages_list + ) From 6db44c8a64bea6bcd64b9f42e38587b684f180ff Mon Sep 17 00:00:00 2001 From: Sylvain Corlay Date: Thu, 19 Sep 2024 16:40:00 +0200 Subject: [PATCH 047/126] Support CONDA_DEFAULT_ENV (#3445) * Support CONDA_DEFAULT_ENV * Fix test --- libmamba/src/api/clean.cpp | 1 + libmamba/src/api/config.cpp | 3 ++ libmamba/src/api/configuration.cpp | 45 ++++++++++++++++++++---------- libmamba/src/api/create.cpp | 1 + libmamba/src/api/info.cpp | 1 + libmamba/src/api/install.cpp | 1 + libmamba/src/api/list.cpp | 1 + libmamba/src/api/remove.cpp | 1 + libmamba/src/api/repoquery.cpp | 1 + libmamba/src/api/update.cpp | 1 + micromamba/src/config.cpp | 5 ++++ micromamba/src/constructor.cpp | 1 + micromamba/src/shell.cpp | 1 + micromamba/tests/test_create.py | 1 + micromamba/tests/test_install.py | 4 +++ micromamba/tests/test_remove.py | 1 + micromamba/tests/test_shell.py | 1 + micromamba/tests/test_update.py | 4 +++ 18 files changed, 60 insertions(+), 14 deletions(-) diff --git a/libmamba/src/api/clean.cpp b/libmamba/src/api/clean.cpp index a0982b6757..bf1cf78e8b 100644 --- a/libmamba/src/api/clean.cpp +++ b/libmamba/src/api/clean.cpp @@ -23,6 +23,7 @@ namespace mamba auto& ctx = config.context(); config.at("use_target_prefix_fallback").set_value(true); + config.at("use_default_prefix_fallback").set_value(true); config.at("use_root_prefix_fallback").set_value(true); config.load(); diff --git a/libmamba/src/api/config.cpp b/libmamba/src/api/config.cpp index 19a1008cc8..1cecb2e81e 100644 --- a/libmamba/src/api/config.cpp +++ b/libmamba/src/api/config.cpp @@ -14,6 +14,7 @@ namespace mamba void config_describe(Configuration& config) { config.at("use_target_prefix_fallback").set_value(true); + config.at("use_default_prefix_fallback").set_value(true); config.at("use_root_prefix_fallback").set_value(true); config.at("target_prefix_checks") .set_value( @@ -38,6 +39,7 @@ namespace mamba void config_list(Configuration& config) { config.at("use_target_prefix_fallback").set_value(true); + config.at("use_default_prefix_fallback").set_value(true); config.at("use_root_prefix_fallback").set_value(true); config.at("target_prefix_checks") .set_value( @@ -70,6 +72,7 @@ namespace mamba void config_sources(Configuration& config) { config.at("use_target_prefix_fallback").set_value(true); + config.at("use_default_prefix_fallback").set_value(true); config.at("use_root_prefix_fallback").set_value(true); config.at("target_prefix_checks") .set_value( diff --git a/libmamba/src/api/configuration.cpp b/libmamba/src/api/configuration.cpp index 9f21dd7afd..c8c0654951 100644 --- a/libmamba/src/api/configuration.cpp +++ b/libmamba/src/api/configuration.cpp @@ -567,10 +567,33 @@ namespace mamba void target_prefix_hook(Configuration& config, fs::u8path& prefix) { + // Fall back to environment specified in CONDA_PREFIX + bool use_target_prefix_fallback = config.at("use_target_prefix_fallback").value(); + if (prefix.empty() && use_target_prefix_fallback) + { + // CONDA_PREFIX is always a complete path + prefix = util::get_env("CONDA_PREFIX").value_or(""); + } + + // Fall back to environment specified in CONDA_DEFAULT_ENV + bool use_default_prefix_fallback = config.at("use_default_prefix_fallback").value(); + if (prefix.empty() && use_default_prefix_fallback) + { + prefix = util::get_env("CONDA_DEFAULT_ENV").value_or(""); + } + + // Fall back to base environment + bool use_root_prefix_fallback = config.at("use_root_prefix_fallback").value(); + if (prefix.empty() && use_root_prefix_fallback) + { + prefix = config.at("root_prefix").value(); + } + auto& root_prefix = config.at("root_prefix").value(); if (!prefix.empty()) { + // Prefix can be an environment name rather than a full path if (prefix.string().find_first_of("/\\") == std::string::npos) { std::string old_prefix = prefix.string(); @@ -586,20 +609,6 @@ namespace mamba .c_str()); } } - else - { - bool use_target_prefix_fallback = config.at("use_target_prefix_fallback").value(); - if (use_target_prefix_fallback) - { - prefix = util::get_env("CONDA_PREFIX").value_or(""); - } - - bool use_root_prefix_fallback = config.at("use_root_prefix_fallback").value(); - if (use_root_prefix_fallback && prefix.empty()) - { - prefix = root_prefix; - } - } #ifdef _WIN32 std::string sep = "\\"; @@ -1201,6 +1210,7 @@ namespace mamba "env_name", "spec_file_env_name", "use_target_prefix_fallback", + "use_default_prefix_fallback", "use_root_prefix_fallback" }) .set_single_op_lifetime() .description("Path to the target prefix") @@ -1227,6 +1237,13 @@ namespace mamba .set_single_op_lifetime() .description("Fallback to the root prefix or not")); + insert(Configurable("use_default_prefix_fallback", true) + .group("Basic") + .set_single_op_lifetime() + .description( + "Fallback to the prefix specified with environment variable CONDA_DEFAULT_ENV or not" + )); + insert(Configurable("target_prefix_checks", MAMBA_NO_PREFIX_CHECK) .group("Basic") .needs({ "target_prefix", "rc_files" }) diff --git a/libmamba/src/api/create.cpp b/libmamba/src/api/create.cpp index 7549a079f3..835f244f56 100644 --- a/libmamba/src/api/create.cpp +++ b/libmamba/src/api/create.cpp @@ -18,6 +18,7 @@ namespace mamba auto& ctx = config.context(); config.at("use_target_prefix_fallback").set_value(false); + config.at("use_default_prefix_fallback").set_value(false); config.at("use_root_prefix_fallback").set_value(false); config.at("target_prefix_checks") .set_value( diff --git a/libmamba/src/api/info.cpp b/libmamba/src/api/info.cpp index 0b7e5b21f6..2b0ab6bd95 100644 --- a/libmamba/src/api/info.cpp +++ b/libmamba/src/api/info.cpp @@ -26,6 +26,7 @@ namespace mamba void info(Configuration& config) { config.at("use_target_prefix_fallback").set_value(true); + config.at("use_default_prefix_fallback").set_value(true); config.at("use_root_prefix_fallback").set_value(true); config.at("target_prefix_checks") .set_value( diff --git a/libmamba/src/api/install.cpp b/libmamba/src/api/install.cpp index a722989bd8..caec744866 100644 --- a/libmamba/src/api/install.cpp +++ b/libmamba/src/api/install.cpp @@ -220,6 +220,7 @@ namespace mamba config.at("create_base").set_value(true); config.at("use_target_prefix_fallback").set_value(true); + config.at("use_default_prefix_fallback").set_value(true); config.at("use_root_prefix_fallback").set_value(true); config.at("target_prefix_checks") .set_value( diff --git a/libmamba/src/api/list.cpp b/libmamba/src/api/list.cpp index 99b489ebdc..b79a02de45 100644 --- a/libmamba/src/api/list.cpp +++ b/libmamba/src/api/list.cpp @@ -18,6 +18,7 @@ namespace mamba void list(Configuration& config, const std::string& regex) { config.at("use_target_prefix_fallback").set_value(true); + config.at("use_default_prefix_fallback").set_value(true); config.at("use_root_prefix_fallback").set_value(true); config.at("target_prefix_checks") .set_value( diff --git a/libmamba/src/api/remove.cpp b/libmamba/src/api/remove.cpp index d810ca8e62..4e831af3b8 100644 --- a/libmamba/src/api/remove.cpp +++ b/libmamba/src/api/remove.cpp @@ -27,6 +27,7 @@ namespace mamba bool remove_all = flags & MAMBA_REMOVE_ALL; config.at("use_target_prefix_fallback").set_value(true); + config.at("use_default_prefix_fallback").set_value(false); config.at("use_root_prefix_fallback").set_value(false); config.at("target_prefix_checks") .set_value( diff --git a/libmamba/src/api/repoquery.cpp b/libmamba/src/api/repoquery.cpp index fe38a6a064..e1a4b0a7e1 100644 --- a/libmamba/src/api/repoquery.cpp +++ b/libmamba/src/api/repoquery.cpp @@ -25,6 +25,7 @@ namespace mamba repoquery_init(Context& ctx, Configuration& config, QueryResultFormat format, bool use_local) { config.at("use_target_prefix_fallback").set_value(true); + config.at("use_default_prefix_fallback").set_value(true); config.at("use_root_prefix_fallback").set_value(true); config.at("target_prefix_checks") .set_value(MAMBA_ALLOW_EXISTING_PREFIX | MAMBA_ALLOW_MISSING_PREFIX); diff --git a/libmamba/src/api/update.cpp b/libmamba/src/api/update.cpp index 64744f411f..e883078d7c 100644 --- a/libmamba/src/api/update.cpp +++ b/libmamba/src/api/update.cpp @@ -132,6 +132,7 @@ namespace mamba auto& ctx = config.context(); config.at("use_target_prefix_fallback").set_value(true); + config.at("use_default_prefix_fallback").set_value(true); config.at("use_root_prefix_fallback").set_value(true); config.at("target_prefix_checks") .set_value( diff --git a/micromamba/src/config.cpp b/micromamba/src/config.cpp index 27618e1b63..8c0b5b9107 100644 --- a/micromamba/src/config.cpp +++ b/micromamba/src/config.cpp @@ -302,6 +302,7 @@ void set_sequence_to_rc(mamba::Configuration& config, const SequenceAddType& opt) { config.at("use_target_prefix_fallback").set_value(true); + config.at("use_default_prefix_fallback").set_value(true); config.at("use_root_prefix_fallback").set_value(true); config.at("target_prefix_checks") .set_value( @@ -357,6 +358,7 @@ set_config_remove_key_command(CLI::App* subcom, mamba::Configuration& config) [&]() { config.at("use_target_prefix_fallback").set_value(true); + config.at("use_default_prefix_fallback").set_value(true); config.at("use_root_prefix_fallback").set_value(true); config.at("target_prefix_checks") .set_value( @@ -421,6 +423,7 @@ set_config_remove_command(CLI::App* subcom, mamba::Configuration& config) [&] { config.at("use_target_prefix_fallback").set_value(true); + config.at("use_default_prefix_fallback").set_value(true); config.at("use_root_prefix_fallback").set_value(true); config.at("target_prefix_checks") .set_value( @@ -499,6 +502,7 @@ set_config_set_command(CLI::App* subcom, mamba::Configuration& config) [&] { config.at("use_target_prefix_fallback").set_value(true); + config.at("use_default_prefix_fallback").set_value(true); config.at("use_root_prefix_fallback").set_value(true); config.at("target_prefix_checks") .set_value( @@ -545,6 +549,7 @@ set_config_get_command(CLI::App* subcom, mamba::Configuration& config) [&] { config.at("use_target_prefix_fallback").set_value(true); + config.at("use_default_prefix_fallback").set_value(true); config.at("use_root_prefix_fallback").set_value(true); config.at("target_prefix_checks") .set_value( diff --git a/micromamba/src/constructor.cpp b/micromamba/src/constructor.cpp index b70264785c..aaf6c6db70 100644 --- a/micromamba/src/constructor.cpp +++ b/micromamba/src/constructor.cpp @@ -68,6 +68,7 @@ void construct(Configuration& config, const fs::u8path& prefix, bool extract_conda_pkgs, bool extract_tarball) { config.at("use_target_prefix_fallback").set_value(true); + config.at("use_default_prefix_fallback").set_value(true); config.at("use_root_prefix_fallback").set_value(true); config.at("target_prefix_checks") .set_value( diff --git a/micromamba/src/shell.cpp b/micromamba/src/shell.cpp index e80544f5da..5ab50d7f6c 100644 --- a/micromamba/src/shell.cpp +++ b/micromamba/src/shell.cpp @@ -104,6 +104,7 @@ namespace void set_default_config_options(Configuration& config) { config.at("use_target_prefix_fallback").set_value(false); + config.at("use_default_prefix_fallback").set_value(false); config.at("use_root_prefix_fallback").set_value(false); config.at("target_prefix_checks").set_value(MAMBA_NO_PREFIX_CHECK); } diff --git a/micromamba/tests/test_create.py b/micromamba/tests/test_create.py index c67ac3a6e7..c396b8b154 100644 --- a/micromamba/tests/test_create.py +++ b/micromamba/tests/test_create.py @@ -30,6 +30,7 @@ def check_create_result(res, root_prefix, target_prefix): assert res["root_prefix"] == str(root_prefix) assert res["target_prefix"] == str(target_prefix) assert not res["use_target_prefix_fallback"] + assert not res["use_default_prefix_fallback"] assert not res["use_root_prefix_fallback"] checks = ( helpers.MAMBA_ALLOW_EXISTING_PREFIX diff --git a/micromamba/tests/test_install.py b/micromamba/tests/test_install.py index f105473339..48c9e518bc 100644 --- a/micromamba/tests/test_install.py +++ b/micromamba/tests/test_install.py @@ -51,6 +51,7 @@ def config_tests(cls, res, root_prefix=root_prefix, target_prefix=prefix): assert res["root_prefix"] == root_prefix assert res["target_prefix"] == target_prefix assert res["use_target_prefix_fallback"] + assert res["use_default_prefix_fallback"] assert res["use_root_prefix_fallback"] checks = ( helpers.MAMBA_ALLOW_EXISTING_PREFIX @@ -179,6 +180,7 @@ def test_target_prefix( if not current_target_prefix_fallback: os.environ.pop("CONDA_PREFIX") + os.environ.pop("CONDA_DEFAULT_ENV") else: os.environ["CONDA_PREFIX"] = p @@ -205,6 +207,7 @@ def test_target_prefix_with_no_settings( # Get the actual set MAMBA_ROOT_PREFIX when setting up `TestInstall` class os.environ["MAMBA_DEFAULT_ROOT_PREFIX"] = os.environ.pop("MAMBA_ROOT_PREFIX") os.environ.pop("CONDA_PREFIX") + os.environ.pop("CONDA_DEFAULT_ENV") # Fallback on root prefix res = helpers.install(*cmd, "--print-config-only") @@ -228,6 +231,7 @@ def test_target_prefix_with_no_settings_and_no_env_var( os.environ.pop("MAMBA_ROOT_PREFIX") os.environ.pop("CONDA_PREFIX") + os.environ.pop("CONDA_DEFAULT_ENV") # Fallback on root prefix res = helpers.install(*cmd, "--print-config-only") diff --git a/micromamba/tests/test_remove.py b/micromamba/tests/test_remove.py index aa20e71335..fe710d5d50 100644 --- a/micromamba/tests/test_remove.py +++ b/micromamba/tests/test_remove.py @@ -180,6 +180,7 @@ def remove_config_common_assertions(res, root_prefix, target_prefix): assert res["root_prefix"] == str(root_prefix) assert res["target_prefix"] == str(target_prefix) assert res["use_target_prefix_fallback"] + assert not res["use_default_prefix_fallback"] assert not res["use_root_prefix_fallback"] checks = ( helpers.MAMBA_ALLOW_EXISTING_PREFIX diff --git a/micromamba/tests/test_shell.py b/micromamba/tests/test_shell.py index 50c1a77eb7..01cae73845 100644 --- a/micromamba/tests/test_shell.py +++ b/micromamba/tests/test_shell.py @@ -190,6 +190,7 @@ def test_activate_target_prefix_checks(tmp_home, tmp_root_prefix): res = helpers.shell("activate", "-p", tmp_root_prefix, "--print-config-only") assert res["target_prefix_checks"] == helpers.MAMBA_NO_PREFIX_CHECK assert not res["use_target_prefix_fallback"] + assert not res["use_default_prefix_fallback"] assert not res["use_root_prefix_fallback"] diff --git a/micromamba/tests/test_update.py b/micromamba/tests/test_update.py index ea1ad3e187..171a864a95 100644 --- a/micromamba/tests/test_update.py +++ b/micromamba/tests/test_update.py @@ -245,6 +245,7 @@ def config_tests(cls, res, root_prefix=root_prefix, target_prefix=prefix): assert res["root_prefix"] == root_prefix assert res["target_prefix"] == target_prefix assert res["use_target_prefix_fallback"] + assert res["use_default_prefix_fallback"] assert res["use_root_prefix_fallback"] checks = ( helpers.MAMBA_ALLOW_EXISTING_PREFIX @@ -372,6 +373,7 @@ def test_target_prefix( if not current_target_prefix_fallback: os.environ.pop("CONDA_PREFIX") + os.environ.pop("CONDA_DEFAULT_ENV") else: os.environ["CONDA_PREFIX"] = p @@ -398,6 +400,7 @@ def test_target_prefix_with_no_settings( # Get the actual set MAMBA_ROOT_PREFIX when setting up `TestUpdateConfig` class os.environ["MAMBA_DEFAULT_ROOT_PREFIX"] = os.environ.pop("MAMBA_ROOT_PREFIX") os.environ.pop("CONDA_PREFIX") + os.environ.pop("CONDA_DEFAULT_ENV") # Fallback on root prefix res = helpers.install(*cmd, "--print-config-only") @@ -420,6 +423,7 @@ def test_target_prefix_with_no_settings_and_no_env_var( os.environ.pop("MAMBA_ROOT_PREFIX") os.environ.pop("CONDA_PREFIX") + os.environ.pop("CONDA_DEFAULT_ENV") # Fallback on root prefix res = helpers.install(*cmd, "--print-config-only") From 1c755675bf0f1bc01f45b763fb5331929bd8cf6b Mon Sep 17 00:00:00 2001 From: Julien Jerphanion Date: Thu, 19 Sep 2024 16:54:58 +0200 Subject: [PATCH 048/126] fix: Handle extra white-space in `MatchSpec` (#3456) * test: Add non-regression test for #3453 Signed-off-by: Julien Jerphanion * Minimal suboptimal fix Signed-off-by: Julien Jerphanion * Add edge cases to the env specification Signed-off-by: Julien Jerphanion * test: Add `MatchSpec` parsing subcases Signed-off-by: Julien Jerphanion * test: Complete `test_env_create_whitespace` Signed-off-by: Julien Jerphanion * Add kytea test case Signed-off-by: Julien Jerphanion * Merge replacement of binary operators Signed-off-by: Julien Jerphanion * Lint with pre-commit Signed-off-by: Julien Jerphanion * Adapt MatchSpec Signed-off-by: Julien Jerphanion Co-authored-by: Hind Montassif * Remove redundant test Signed-off-by: Julien Jerphanion Co-authored-by: Hind Montassif * Rename subcase Co-authored-by: Hind-M <70631848+Hind-M@users.noreply.github.com> * Adapt comparison on versions Co-authored-by: Hind-M <70631848+Hind-M@users.noreply.github.com> * Adapt test case Signed-off-by: Julien Jerphanion * Remove pytorch-cpu as it is not available on windows Signed-off-by: Julien Jerphanion --------- Signed-off-by: Julien Jerphanion Co-authored-by: Hind Montassif Co-authored-by: Hind-M <70631848+Hind-M@users.noreply.github.com> --- libmamba/src/specs/match_spec.cpp | 54 +++++++++++++----- libmamba/tests/src/specs/test_match_spec.cpp | 60 ++++++++++++++++++++ micromamba/tests/env-extra-white-space.yaml | 7 +++ micromamba/tests/test_env.py | 38 +++++++++++++ 4 files changed, 145 insertions(+), 14 deletions(-) create mode 100644 micromamba/tests/env-extra-white-space.yaml diff --git a/libmamba/src/specs/match_spec.cpp b/libmamba/src/specs/match_spec.cpp index 405eb447c5..aec2ea7aaf 100644 --- a/libmamba/src/specs/match_spec.cpp +++ b/libmamba/src/specs/match_spec.cpp @@ -502,32 +502,58 @@ namespace mamba::specs auto MatchSpec::parse(std::string_view str) -> expected_parse_t { - auto parse_error = [&str](std::string_view err) -> tl::unexpected + std::string raw_match_spec_str = std::string(str); + raw_match_spec_str = util::strip(raw_match_spec_str); + + // Remove any with space after binary operators, such as: + // - `openmpi-4.1.4-ha1ae619_102`'s improperly encoded `constrains`: "cudatoolkit >= 10.2" + // - `pytorch-1.13.0-cpu_py310h02c325b_0.conda`'s improperly encoded + // `constrains`: "pytorch-cpu = 1.13.0", "pytorch-gpu = 99999999" + // - `fipy-3.4.2.1-py310hff52083_3.tar.bz2`'s improperly encoded `constrains` or + // `dep`: ">=4.5.2" + // - `infokonoha-4.6.3-pyhd8ed1ab_0.tar.bz2`'s `kytea >=0.1.4, 0.2.0` -> `kytea + // >=0.1.4,0.2.0` + // TODO: this solution reallocates memory several times potentially, but the + // number of operators is small and the strings are short, so it must be fine. + // If needed it can be optimized so that the string is only copied once. + for (const std::string& op : { ">=", "<=", "==", ">", "<", "!=", "=", "==", "," }) + { + const std::string& bad_op = op + " "; + while (raw_match_spec_str.find(bad_op) != std::string::npos) + { + raw_match_spec_str = raw_match_spec_str.substr(0, raw_match_spec_str.find(bad_op)) + op + + raw_match_spec_str.substr( + raw_match_spec_str.find(bad_op) + bad_op.size() + ); + } + } + + auto parse_error = [&raw_match_spec_str](std::string_view err) -> tl::unexpected { - return tl::make_unexpected( - ParseError(fmt::format(R"(Error parsing MatchSpec "{}": {}")", str, err)) - ); + return tl::make_unexpected(ParseError( + fmt::format(R"(Error parsing MatchSpec "{}": {}")", raw_match_spec_str, err) + )); }; static constexpr auto npos = std::string_view::npos; - str = util::strip(str); - if (str.empty()) + raw_match_spec_str = util::strip(raw_match_spec_str); + if (raw_match_spec_str.empty()) { return {}; } // A plain URL like https://conda.anaconda.org/conda-forge/linux-64/pkg-6.4-bld.conda - if (has_archive_extension(str)) + if (has_archive_extension(raw_match_spec_str)) { - return MatchSpec::parse_url(str); + return MatchSpec::parse_url(raw_match_spec_str); } // A URL with hash, generated by `mamba env export --explicit` like // https://conda.anaconda.org/conda-forge/linux-64/pkg-6.4-bld.conda#7dbaa197d7ba6032caf7ae7f32c1efa0 - if (const auto idx = str.rfind(url_md5_sep); idx != npos) + if (const auto idx = raw_match_spec_str.rfind(url_md5_sep); idx != npos) { - auto url = str.substr(0, idx); - auto hash = str.substr(idx + 1); + auto url = raw_match_spec_str.substr(0, idx); + auto hash = raw_match_spec_str.substr(idx + 1); if (has_archive_extension(url)) { return MatchSpec::parse_url(url).transform( @@ -552,7 +578,7 @@ namespace mamba::specs // - ``namespace`` // - ``spec >=3 [attr="val", ...]`` { - auto maybe_chan_ns_spec = split_channel_namespace_spec(str); + auto maybe_chan_ns_spec = split_channel_namespace_spec(raw_match_spec_str); if (!maybe_chan_ns_spec) { return parse_error(maybe_chan_ns_spec.error().what()); @@ -572,7 +598,7 @@ namespace mamba::specs out.m_channel = std::move(maybe_chan).value(); } - str = spec_str; + raw_match_spec_str = spec_str; } // Parse and apply bracket attributes ``attr="val"`` in ``pkg >=3 =mkl [attr="val", ...]``. @@ -581,7 +607,7 @@ namespace mamba::specs auto ver_str = std::string_view(); auto bld_str = std::string_view(); { - auto maybe_pkg_ver_bld = rparse_and_set_matchspec_attributes(out, str); + auto maybe_pkg_ver_bld = rparse_and_set_matchspec_attributes(out, raw_match_spec_str); if (!maybe_pkg_ver_bld) { return parse_error(maybe_pkg_ver_bld.error().what()); diff --git a/libmamba/tests/src/specs/test_match_spec.cpp b/libmamba/tests/src/specs/test_match_spec.cpp index 63b76d36bf..70859610ad 100644 --- a/libmamba/tests/src/specs/test_match_spec.cpp +++ b/libmamba/tests/src/specs/test_match_spec.cpp @@ -47,6 +47,66 @@ TEST_SUITE("specs::match_spec") CHECK_EQ(ms.str(), "xtensor>=0.12.3"); } + SUBCASE("python > 3.11") + { + auto ms = MatchSpec::parse("python > 3.11").value(); + CHECK_EQ(ms.name().str(), "python"); + CHECK_EQ(ms.version().str(), ">3.11"); + CHECK(ms.build_string().is_explicitly_free()); + CHECK(ms.build_number().is_explicitly_free()); + CHECK_EQ(ms.str(), "python>3.11"); + } + + SUBCASE("numpy < 2.0") + { + auto ms = MatchSpec::parse("numpy < 2.0").value(); + CHECK_EQ(ms.name().str(), "numpy"); + CHECK_EQ(ms.version().str(), "<2.0"); + CHECK(ms.build_string().is_explicitly_free()); + CHECK(ms.build_number().is_explicitly_free()); + CHECK_EQ(ms.str(), "numpy<2.0"); + } + + SUBCASE("pytorch-cpu = 1.13.0") + { + auto ms = MatchSpec::parse("pytorch-cpu = 1.13.0").value(); + CHECK_EQ(ms.name().str(), "pytorch-cpu"); + CHECK_EQ(ms.version().str(), "=1.13.0"); + CHECK(ms.build_string().is_explicitly_free()); + CHECK(ms.build_number().is_explicitly_free()); + CHECK_EQ(ms.str(), "pytorch-cpu=1.13.0"); + } + + SUBCASE("scipy >= 1.5.0, < 2.0.0") + { + auto ms = MatchSpec::parse("scipy >= 1.5.0, < 2.0.0").value(); + CHECK_EQ(ms.name().str(), "scipy"); + CHECK_EQ(ms.version().str(), ">=1.5.0,<2.0.0"); + CHECK(ms.build_string().is_explicitly_free()); + CHECK(ms.build_number().is_explicitly_free()); + CHECK_EQ(ms.str(), "scipy[version=\">=1.5.0,<2.0.0\"]"); + } + + SUBCASE("scikit-learn >1.0.0") + { + auto ms = MatchSpec::parse("scikit-learn >1.0.0").value(); + CHECK_EQ(ms.name().str(), "scikit-learn"); + CHECK_EQ(ms.version().str(), ">1.0.0"); + CHECK(ms.build_string().is_explicitly_free()); + CHECK(ms.build_number().is_explicitly_free()); + CHECK_EQ(ms.str(), "scikit-learn>1.0.0"); + } + + SUBCASE("kytea >=0.1.4, 0.2.0") + { + auto ms = MatchSpec::parse("kytea >=0.1.4, 0.2.0").value(); + CHECK_EQ(ms.name().str(), "kytea"); + CHECK_EQ(ms.version().str(), ">=0.1.4,==0.2.0"); + CHECK(ms.build_string().is_explicitly_free()); + CHECK(ms.build_number().is_explicitly_free()); + CHECK_EQ(ms.str(), "kytea[version=\">=0.1.4,==0.2.0\"]"); + } + SUBCASE("_libgcc_mutex 0.1 conda_forge") { auto ms = MatchSpec::parse("_libgcc_mutex 0.1 conda_forge").value(); diff --git a/micromamba/tests/env-extra-white-space.yaml b/micromamba/tests/env-extra-white-space.yaml new file mode 100644 index 0000000000..ff1a6c3bbb --- /dev/null +++ b/micromamba/tests/env-extra-white-space.yaml @@ -0,0 +1,7 @@ +channels: + - conda-forge +dependencies: + - python > 3.11 + - numpy < 2.0 + - scipy >= 1.5.0, < 2.0.0 + - scikit-learn >1.0.0 diff --git a/micromamba/tests/test_env.py b/micromamba/tests/test_env.py index 2f6feca08e..aeb4c94227 100644 --- a/micromamba/tests/test_env.py +++ b/micromamba/tests/test_env.py @@ -361,6 +361,7 @@ def test_env_update_pypi_with_conda_forge(tmp_home, tmp_root_prefix, tmp_path): ## See: https://github.com/mamba-org/mamba/issues/2059 pip_list_output = helpers.umamba_run("-p", env_prefix, "pip", "list", "--format=json") pip_packages_list = yaml.safe_load(pip_list_output) + # When numpy 2.0.0 is installed using mamba, # `numpy-2.0.0.dist-info/` is still created in `env_prefix/lib/pythonx.x/site-packages/` alongside `numpy-1.26.4.dist-info` # therefore causing an unexpected result when listing the version. @@ -370,3 +371,40 @@ def test_env_update_pypi_with_conda_forge(tmp_home, tmp_root_prefix, tmp_path): pkg["name"] == "numpy" and Version(pkg["version"]) >= Version("1.26.4") for pkg in pip_packages_list ) + + +@pytest.mark.parametrize("shared_pkgs_dirs", [True], indirect=True) +def test_env_create_whitespace(tmp_home, tmp_root_prefix, tmp_path): + # Non-regression test for: https://github.com/mamba-org/mamba/issues/3453 + + env_prefix = tmp_path / "env-extra-white-space" + + create_spec_file = tmp_path / "env-extra-white-space.yaml" + + shutil.copyfile(__this_dir__ / "env-extra-white-space.yaml", create_spec_file) + + res = helpers.run_env("create", "-p", env_prefix, "-f", create_spec_file, "-y", "--json") + assert res["success"] + + # Check that the env was created + assert env_prefix.exists() + # Check that the env has the right packages + packages = helpers.umamba_list("-p", env_prefix, "--json") + + assert any( + package["name"] == "python" and Version(package["version"]) > Version("3.11") + for package in packages + ) + assert any( + package["name"] == "numpy" and Version(package["version"]) < Version("2.0") + for package in packages + ) + assert any( + package["name"] == "scipy" + and Version("1.5.0") <= Version(package["version"]) < Version("2.0.0") + for package in packages + ) + assert any( + package["name"] == "scikit-learn" and Version(package["version"]) > Version("1.0.0") + for package in packages + ) From ad8ca3cf02a414a1240566766116b108602b82a1 Mon Sep 17 00:00:00 2001 From: Hind-M <70631848+Hind-M@users.noreply.github.com> Date: Fri, 20 Sep 2024 14:36:17 +0200 Subject: [PATCH 049/126] Compute `root prefix` as mamba install path (#3447) * Compute root prefix as mamba install path * Run test only on linux * Test conflict between conda and mamba with same base env in CI * Change strategy * Use target_compile_definitions instead of add_definitions * Add test logs * Add ENABLE_MAMBA_ROOT_PREFIX_FALLBACK OPTION --- .github/workflows/unix_impl.yml | 3 ++- .github/workflows/windows_impl.yml | 3 ++- libmamba/CMakeLists.txt | 10 ++++++++++ libmamba/src/api/configuration.cpp | 24 ++++++++++++++++++++++++ 4 files changed, 38 insertions(+), 2 deletions(-) diff --git a/.github/workflows/unix_impl.yml b/.github/workflows/unix_impl.yml index 7d04dde8e3..14614bfd07 100644 --- a/.github/workflows/unix_impl.yml +++ b/.github/workflows/unix_impl.yml @@ -40,7 +40,8 @@ jobs: --preset mamba-unix-shared-${{ inputs.build_type }} \ -D CMAKE_CXX_COMPILER_LAUNCHER=sccache \ -D CMAKE_C_COMPILER_LAUNCHER=sccache \ - -D BUILD_LIBMAMBAPY=OFF + -D BUILD_LIBMAMBAPY=OFF \ + -D ENABLE_MAMBA_ROOT_PREFIX_FALLBACK=OFF cmake --build build/ --parallel - name: Show build cache statistics run: sccache --show-stats diff --git a/.github/workflows/windows_impl.yml b/.github/workflows/windows_impl.yml index ad33f1314d..480e20dae0 100644 --- a/.github/workflows/windows_impl.yml +++ b/.github/workflows/windows_impl.yml @@ -42,7 +42,8 @@ jobs: -D CMAKE_MSVC_RUNTIME_LIBRARY="MultiThreadedDLL" ^ -D CMAKE_CXX_COMPILER_LAUNCHER=sccache ^ -D CMAKE_C_COMPILER_LAUNCHER=sccache ^ - -D BUILD_LIBMAMBAPY=OFF + -D BUILD_LIBMAMBAPY=OFF ^ + -D ENABLE_MAMBA_ROOT_PREFIX_FALLBACK=OFF if %errorlevel% neq 0 exit /b %errorlevel% cmake --build build/ --parallel if %errorlevel% neq 0 exit /b %errorlevel% diff --git a/libmamba/CMakeLists.txt b/libmamba/CMakeLists.txt index 8bd51b591f..16716339ce 100644 --- a/libmamba/CMakeLists.txt +++ b/libmamba/CMakeLists.txt @@ -659,9 +659,19 @@ endmacro() set(libmamba_targets "") +option( + ENABLE_MAMBA_ROOT_PREFIX_FALLBACK + "Enable mamba (shared) root prefix to be set to install prefix" + ON +) + if(BUILD_SHARED) message(STATUS "Adding shared libmamba target") libmamba_create_target(libmamba-dyn SHARED libmamba) + if(ENABLE_MAMBA_ROOT_PREFIX_FALLBACK) + # Use mamba installation prefix to set root prefix (base) + target_compile_definitions(libmamba-dyn PUBLIC MAMBA_USE_INSTALL_PREFIX_AS_BASE) + endif() endif() if(BUILD_STATIC) diff --git a/libmamba/src/api/configuration.cpp b/libmamba/src/api/configuration.cpp index c8c0654951..ce2c45320d 100644 --- a/libmamba/src/api/configuration.cpp +++ b/libmamba/src/api/configuration.cpp @@ -629,6 +629,21 @@ namespace mamba } } + auto + get_root_prefix_from_mamba_bin(const fs::u8path& mamba_bin_path) -> expected_t + { + if (mamba_bin_path.empty()) + { + return make_unexpected( + "`mamba` binary not found.\nPlease set `MAMBA_ROOT_PREFIX`.", + mamba_error_code::incorrect_usage + ); + } + // In linux and osx, the install path would be install_prefix/bin/mamba + // In windows, install_prefix/Scripts/mamba.exe + return { fs::weakly_canonical(mamba_bin_path.parent_path().parent_path()) }; + } + auto validate_existing_root_prefix(const fs::u8path& candidate) -> expected_t { auto prefix = fs::u8path(util::expand_home(candidate.string())); @@ -724,11 +739,20 @@ namespace mamba } else { +#ifdef MAMBA_USE_INSTALL_PREFIX_AS_BASE + // mamba case + // set the root prefix as the mamba installation path + get_root_prefix_from_mamba_bin(util::which("mamba")) + .transform([&](fs::u8path&& p) { prefix = std::move(p); }) + .or_else([](mamba_error&& error) { throw std::move(error); }); +#else + // micromamba case validate_existing_root_prefix(default_root_prefix_v1()) .or_else([](const auto& /* error */) { return validate_root_prefix(default_root_prefix_v2()); }) .transform([&](fs::u8path&& p) { prefix = std::move(p); }) .or_else([](mamba_error&& error) { throw std::move(error); }); +#endif } if (env_name.configured()) From 860ae0ea04f2d7842c6ace913c9bca133ed2929e Mon Sep 17 00:00:00 2001 From: Julien Jerphanion Date: Fri, 20 Sep 2024 14:49:54 +0200 Subject: [PATCH 050/126] test: `MatchSpec` edges cases (#3458) Add edge case test Signed-off-by: Julien Jerphanion --- libmamba/tests/src/specs/test_match_spec.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/libmamba/tests/src/specs/test_match_spec.cpp b/libmamba/tests/src/specs/test_match_spec.cpp index 70859610ad..a90266909f 100644 --- a/libmamba/tests/src/specs/test_match_spec.cpp +++ b/libmamba/tests/src/specs/test_match_spec.cpp @@ -107,6 +107,19 @@ TEST_SUITE("specs::match_spec") CHECK_EQ(ms.str(), "kytea[version=\">=0.1.4,==0.2.0\"]"); } + // Invalid case from `inform2w64-sysroot_win-64-v12.0.0.r2.ggc561118da-h707e725_0.conda` + // which is currently supported but which must not. + SUBCASE("mingw-w64-ucrt-x86_64-crt-git v12.0.0.r2.ggc561118da h707e725_0") + { + auto ms = MatchSpec::parse("mingw-w64-ucrt-x86_64-crt-git v12.0.0.r2.ggc561118da h707e725_0") + .value(); + CHECK_EQ(ms.name().str(), "mingw-w64-ucrt-x86_64-crt-git"); + CHECK_EQ(ms.version().str(), "==0v12.0.0.0r2.0ggc561118da"); + CHECK_EQ(ms.build_string().str(), "h707e725_0"); + CHECK(ms.build_number().is_explicitly_free()); + CHECK_EQ(ms.str(), "mingw-w64-ucrt-x86_64-crt-git==0v12.0.0.0r2.0ggc561118da=h707e725_0"); + } + SUBCASE("_libgcc_mutex 0.1 conda_forge") { auto ms = MatchSpec::parse("_libgcc_mutex 0.1 conda_forge").value(); From d3cb2f8a0c17c4014eb6f9046dc327666a8985bf Mon Sep 17 00:00:00 2001 From: Hind Montassif Date: Fri, 20 Sep 2024 15:58:06 +0200 Subject: [PATCH 051/126] release libmamba 2.0.0rc6, libmambapy 2.0.0rc6, micromamba 2.0.0rc6 --- CHANGELOG.md | 23 +++++++++++++++++++++++ libmamba/CHANGELOG.md | 19 +++++++++++++++++++ libmambapy/CHANGELOG.md | 9 +++++++++ micromamba/CHANGELOG.md | 19 +++++++++++++++++++ 4 files changed, 70 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9807699c37..dea81e4be1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,26 @@ +2024.09.20 +========== + +Releases: libmamba 2.0.0rc6, libmambapy 2.0.0rc6, micromamba 2.0.0rc6 + +Enhancements: + +- [libmamba] test: `MatchSpec` edges cases by @jjerphan in https://github.com/mamba-org/mamba/pull/3458 +- [libmamba] Compute `root prefix` as mamba install path by @Hind-M in https://github.com/mamba-org/mamba/pull/3447 +- [libmamba, micromamba] Support CONDA_DEFAULT_ENV by @SylvainCorlay in https://github.com/mamba-org/mamba/pull/3445 + +Bug fixes: + +- [libmamba, micromamba] fix: Handle extra white-space in `MatchSpec` by @jjerphan in https://github.com/mamba-org/mamba/pull/3456 +- [micromamba] Fix `test_env_update_pypi_with_conda_forge` by @Hind-M in https://github.com/mamba-org/mamba/pull/3459 +- [libmamba, micromamba] fix: Environment removal confirmation by @jjerphan in https://github.com/mamba-org/mamba/pull/3450 +- [micromamba] Fix test in osx by @Hind-M in https://github.com/mamba-org/mamba/pull/3448 + +CI fixes and doc: + +- [all] Fix wrong version of miniforge in doc by @Hind-M in https://github.com/mamba-org/mamba/pull/3462 +- [all] Remove cctools patch removal in CI by @Hind-M in https://github.com/mamba-org/mamba/pull/3451 + 2024.09.13 ========== diff --git a/libmamba/CHANGELOG.md b/libmamba/CHANGELOG.md index b8871f37f7..15060d4d1b 100644 --- a/libmamba/CHANGELOG.md +++ b/libmamba/CHANGELOG.md @@ -1,3 +1,22 @@ +libmamba 2.0.0rc6 (September 20, 2024) +====================================== + +Enhancements: + +- test: `MatchSpec` edges cases by @jjerphan in https://github.com/mamba-org/mamba/pull/3458 +- Compute `root prefix` as mamba install path by @Hind-M in https://github.com/mamba-org/mamba/pull/3447 +- Support CONDA_DEFAULT_ENV by @SylvainCorlay in https://github.com/mamba-org/mamba/pull/3445 + +Bug fixes: + +- fix: Handle extra white-space in `MatchSpec` by @jjerphan in https://github.com/mamba-org/mamba/pull/3456 +- fix: Environment removal confirmation by @jjerphan in https://github.com/mamba-org/mamba/pull/3450 + +CI fixes and doc: + +- Fix wrong version of miniforge in doc by @Hind-M in https://github.com/mamba-org/mamba/pull/3462 +- Remove cctools patch removal in CI by @Hind-M in https://github.com/mamba-org/mamba/pull/3451 + libmamba 2.0.0rc5 (September 13, 2024) ====================================== diff --git a/libmambapy/CHANGELOG.md b/libmambapy/CHANGELOG.md index 04219ff7d7..4a7fdda605 100644 --- a/libmambapy/CHANGELOG.md +++ b/libmambapy/CHANGELOG.md @@ -1,3 +1,12 @@ +libmambapy 2.0.0rc6 (September 20, 2024) +======================================== + + +CI fixes and doc: + +- Fix wrong version of miniforge in doc by @Hind-M in https://github.com/mamba-org/mamba/pull/3462 +- Remove cctools patch removal in CI by @Hind-M in https://github.com/mamba-org/mamba/pull/3451 + libmambapy 2.0.0rc5 (September 13, 2024) ======================================== diff --git a/micromamba/CHANGELOG.md b/micromamba/CHANGELOG.md index 806675dc3b..3cdad58047 100644 --- a/micromamba/CHANGELOG.md +++ b/micromamba/CHANGELOG.md @@ -1,3 +1,22 @@ +micromamba 2.0.0rc6 (September 20, 2024) +======================================== + +Enhancements: + +- Support CONDA_DEFAULT_ENV by @SylvainCorlay in https://github.com/mamba-org/mamba/pull/3445 + +Bug fixes: + +- fix: Handle extra white-space in `MatchSpec` by @jjerphan in https://github.com/mamba-org/mamba/pull/3456 +- Fix `test_env_update_pypi_with_conda_forge` by @Hind-M in https://github.com/mamba-org/mamba/pull/3459 +- fix: Environment removal confirmation by @jjerphan in https://github.com/mamba-org/mamba/pull/3450 +- Fix test in osx by @Hind-M in https://github.com/mamba-org/mamba/pull/3448 + +CI fixes and doc: + +- Fix wrong version of miniforge in doc by @Hind-M in https://github.com/mamba-org/mamba/pull/3462 +- Remove cctools patch removal in CI by @Hind-M in https://github.com/mamba-org/mamba/pull/3451 + micromamba 2.0.0rc5 (September 13, 2024) ======================================== From a656fe9524bcd953d9d9cf9728ae93c3702870f1 Mon Sep 17 00:00:00 2001 From: Johan Mabille Date: Wed, 25 Sep 2024 11:31:42 +0200 Subject: [PATCH 052/126] release libmamba 2.0.0, libmambapy 2.0.0, micromamba 2.0.0 --- CHANGELOG.md | 297 +++++++++++++++++++++++++++ libmamba/CHANGELOG.md | 249 ++++++++++++++++++++++ libmambapy/CHANGELOG.md | 129 ++++++++++++ libmambapy/src/libmambapy/version.py | 2 +- micromamba/CHANGELOG.md | 155 ++++++++++++++ 5 files changed, 831 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dea81e4be1..c5ec295a93 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,300 @@ +2024.09.25 +========== + +Releases: libmamba 2.0.0, libmambapy 2.0.0, micromamba 2.0.0 + +Enhancements: + +- [libmamba] test: `MatchSpec` edges cases by @jjerphan in https://github.com/mamba-org/mamba/pull/3458 +- [libmamba] Compute `root prefix` as mamba install path by @Hind-M in https://github.com/mamba-org/mamba/pull/3447 +- [libmamba, micromamba] Support CONDA_DEFAULT_ENV by @SylvainCorlay in https://github.com/mamba-org/mamba/pull/3445 +- [all] Remove cctools patch from feedstock in CI by @JohanMabille in https://github.com/mamba-org/mamba/pull/3442 +- [micromamba] test: Adapt test_explicit_export_topologically_sorted by @jjerphan in https://github.com/mamba-org/mamba/pull/3377 +- [libmamba] test: Comparability and hashability of `PackageInfo` and `MatchSpec` by @jjerphan in https://github.com/mamba-org/mamba/pull/3369 +- [libmamba] build: Support fmt 11 (follow-up) by @jjerphan in https://github.com/mamba-org/mamba/pull/3371 +- [libmamba, micromamba] build: Support fmt 11 by @jjerphan in https://github.com/mamba-org/mamba/pull/3368 +- [libmamba] Make more classes hashable and comparable by @jjerphan in https://github.com/mamba-org/mamba/pull/3363 +- [libmambapy, libmamba] Replace `Context` with `Context::platform` where possible by @jjerphan in https://github.com/mamba-org/mamba/pull/3364 +- [libmamba] Update mamba.xsh: support xonsh >= 0.18.0 by @anki-code in https://github.com/mamba-org/mamba/pull/3355 +- [libmamba] Remove logs for every package by @Hind-M in https://github.com/mamba-org/mamba/pull/3335 +- [libmamba] maint: Remove declaration of `PrefixData::load` by @jjerphan in https://github.com/mamba-org/mamba/pull/3325 +- [libmamba] maint: Remove some warnings by @jjerphan in https://github.com/mamba-org/mamba/pull/3320 +- [libmamba] maint: Remove `PrefixData::load` by @jjerphan in https://github.com/mamba-org/mamba/pull/3318 +- [libmamba, micromamba] OCI/Conda mapping by @Hind-M in https://github.com/mamba-org/mamba/pull/3310 +- [libmamba, micromamba] [OCI - Mirrors] Add tests and doc by @Hind-M in https://github.com/mamba-org/mamba/pull/3307 +- [libmamba] [OCI Registry] Handle compressed repodata by @Hind-M in https://github.com/mamba-org/mamba/pull/3300 +- [libmamba] [CEP-15] Support `base_url` with `repodata_version: 2` using `mamba` parser by @Hind-M in https://github.com/mamba-org/mamba/pull/3282 +- [libmamba] Fix OCIMirror use by @Hind-M in https://github.com/mamba-org/mamba/pull/3296 +- [all] Add checking typos to pre-commit by @Hind-M in https://github.com/mamba-org/mamba/pull/3278 +- [libmambapy, libmamba] Bind text_style and graphic params by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3266 +- [libmambapy] Bind VersionPredicate by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3255 +- [all] Update pre-commit hooks" by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3252 +- [micromamba, libmamba] Refactor os utilities by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3248 +- [libmamba] Implemented OCI mirrors by @JohanMabille in https://github.com/mamba-org/mamba/pull/3246 +- [libmamba] Passed url_path to request_generators by @JohanMabille in https://github.com/mamba-org/mamba/pull/3245 +- [libmambapy, libmamba] Handle regex in build string by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3239 +- [micromamba, libmamba] [mamba-content-trust] Add integration test by @Hind-M in https://github.com/mamba-org/mamba/pull/3234 +- [libmamba] Release libsolv memory before installation by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3238 +- [all] Custom resolve complex MatchSpec in Solver by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3233 +- [libmambapy, libmamba] Add MatchSpec::contains_except_channel" by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3231 +- [all] [mamba content trust] Enable verifying packages signatures by @Hind-M in https://github.com/mamba-org/mamba/pull/3192 +- [libmambapy, libmamba] Refactor MatchSpec::str by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3215 +- [all] Subdir renaming by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3214 +- [libmambapy, libmamba] Fully bind MatchSpec by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3213 +- [libmamba] Add more MatchSpec tests by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3211 +- [micromamba, libmamba] Expected in specs parse API by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3207 +- [libmamba] Refactor MatchSpec::parse by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3205 +- [all] Added HTTP Mirrors by @JohanMabille in https://github.com/mamba-org/mamba/pull/3178 +- [all] Use expected for specs parsing by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3201 +- [libmamba] Refactor ObjPool to use views in callbacks by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3199 +- [libmambapy, libmamba] Add more solver tests and other small features by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3198 +- [libmambapy, libmamba] Finalized Solver bindings and add solver doc by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3195 +- [libmambapy, libmamba] Add libsolv.Database Bindings and tests by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3186 +- [libmamba] Add (some) solver Database tests by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3185 +- [libmamba] Make libsolv wrappers into standalone library by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3181 +- [all] Rename MPool into solver::libsolv::Database by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3180 +- [all] Automate releases (`CHANGELOG.md` updating) by @Hind-M in https://github.com/mamba-org/mamba/pull/3179 +- [all] Simplify MPool Interface by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3177 +- [all] Clean libsolv use in Transaction by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3171 +- [micromamba, libmamba] Rewrite Query with Pool functions (wrapping libsolv) by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3168 +- [micromamba] Remove hard coded mamba by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3069 +- [libmamba, micromamba] Support multiple env yaml specs by @jchorl in https://github.com/mamba-org/mamba/pull/2993 +- [libmamba] Update shell hook comments by @jonashaag in https://github.com/mamba-org/mamba/pull/3051 +- [micromamba] Duplicate reposerver to isolate micromamba tests by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3071 +- [libmamba, libmambapy] More specs bindings by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3080 +- [libmamba, libmambapy] Add VersionSpec::str by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3081 +- [all] Some future proofing MatchSpec by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3082 +- [libmamba] Reformat string by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3085 +- [libmamba] Clean up url_manip by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3086 +- [libmamba, libmambapy] Fix VersionSpec free ranges by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3088 +- [libmamba] Add parsing utilities by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3090 +- [libmamba] Bump MAMBA libsolv file ABI by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3093 +- [libmamba, libmambapy] MatchSpec use VersionSpec by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3089 +- [libmamba, libmambapy] GlobSpec by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3094 +- [libmamba] Add BuildNumberSpec by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3098 +- [libmamba] Refactor MatchSpec unlikey data by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3099 +- [libmamba, micromamba] Remove micromamba shell init -p by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3092 +- [all] Clean PackageInfo interface by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3103 +- [libmamba, libmambapy] NoArchType as standalone enum by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3108 +- [all] Move PackageInfo in specs:: by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3109 +- [libmamba, libmambapy] Change PackageInfo types by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3113 +- [libmamba, libmambapy] Add some PackageInfo tests by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3115 +- [libmamba, libmambapy] Rename ChannelSpec > UndefinedChannel by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3117 +- [libmamba, libmambapy] Add Channel::contains_package by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3121 +- [libmamba, libmambapy] Pool channel match by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3122 +- [libmamba] Added mirrored channels by @JohanMabille in https://github.com/mamba-org/mamba/pull/3125 +- [libmamba, micromamba] Move util_random.hpp > util/random.hpp by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3129 +- [micromamba] Refactor test_remove.py to use fixture by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3131 +- [libmambapy] Add expected caster to Union by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3135 +- [all] MRepo refactor by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3118 +- [libmamba, libmambapy] No M by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3137 +- [libmamba, micromamba] Explcit transaction duplicate code by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3138 +- [libmamba, libmambapy] Solver improvements by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3140 +- [libmamba] Sort transaction table entries by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3146 +- [all] Solver Request by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3141 +- [libmamba] Improve Solution usage by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3148 +- [libmamba, libmambapy] Refactor solver flags by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3153 +- [libmamba] Moved download related files to dedicated folder by @JohanMabille in https://github.com/mamba-org/mamba/pull/3155 +- [libmamba] Remove outdated commented code snippet by @jjerphan in https://github.com/mamba-org/mamba/pull/3160 +- [libmamba] Implemented support for mirrors by @JohanMabille in https://github.com/mamba-org/mamba/pull/3157 +- [all] Split Solver and Unsolvable by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3156 +- [libmamba] Proper sorting of display actions by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3165 +- [all] Solver sort deps by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3163 +- [libmamba, libmambapy] Bind solver::libsolv::UnSolvable by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3166 +- [libmamba, libmambapy] Improve Query API by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3167 +- [all] Context: not a singleton by @Klaim in https://github.com/mamba-org/mamba/pull/2615 +- [libmamba] Add CondaURL by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2805 +- [micromamba] Add env update by @Hind-M in https://github.com/mamba-org/mamba/pull/2827 +- [micromamba] Adding locks for cache directories by @rmittal87 in https://github.com/mamba-org/mamba/pull/2811 +- [micromamba] Refactor tests by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2829 +- [all] No ugly kenum by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2831 +- [libmamba, micromamba] Add Nushell activation support by cvanelteren in https://github.com/mamba-org/mamba/pull/2693 +- [libmamba] Support $var syntax in .condarc by @jonashaag in https://github.com/mamba-org/mamba/pull/2833 +- [libmamba] Handle null and false noarch values by @gabrielsimoes in https://github.com/mamba-org/mamba/pull/2835 +- [libmamba] Add CondaURL::pretty_str by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2830 +- [libmamba, micromamba] Channel cleanup by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2832 +- [libmamba] Authenfitication split user and password by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2849 +- [libmamba] Improved static build error message by @JohanMabille in https://github.com/mamba-org/mamba/pull/2850 +- [libmamba] Add local channels test by @Hind-M in https://github.com/mamba-org/mamba/pull/2853 +- [libmamba, micromamba] Don't force MSVC_RUNTIME by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2861 +- [libmamba] Build micromamba with /MD by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2862 +- [micromamba] Add comments in micromamba repoquery by @Hind-M in https://github.com/mamba-org/mamba/pull/2863 +- [libmamba, micromamba] Fix Posix shell on Windows by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2803 +- [libmamba, libmambapy] Further improve micromamba search output by @delsner in https://github.com/mamba-org/mamba/pull/2823 +- [libmamba] Minor Channel refactoring by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2852 +- [libmamba] path_to_url percent encoding by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2867 +- [libmamba] Change libsolv static lib name by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2876 +- [libmamba, libmambapy] Download by @JohanMabille in https://github.com/mamba-org/mamba/pull/2844 +- [libmamba, micromamba] Use CMake targets for reproc by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2883 +- [micromamba] Add mamba tests by @Hind-M in https://github.com/mamba-org/mamba/pull/2877 +- [libmamba] Add FindLibsolv.cmake by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2886 +- [libmamba] Read repodata.json using nl::json (rerun) by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2753 +- [libmamba, micromamba] Filesystem library by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2879 +- [libmamba] Header cleanup filesystem follow-up by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2894 +- [all] Add multiple queries to repoquery search by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2897 +- [all] Add ChannelSpec by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2870 +- [micromamba] Make some fixture local by @JohanMabille in https://github.com/mamba-org/mamba/pull/2919 +- [libmamba] Print error code if run fails by @jonashaag in https://github.com/mamba-org/mamba/pull/2848 +- [all] Added PackageFetcher by @JohanMabille in https://github.com/mamba-org/mamba/pull/2917 +- [libmamba] return architecture levels for micromamba by @isuruf in https://github.com/mamba-org/mamba/pull/2921 +- [all] Resolve ChannelSpec into a Channel by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2899 +- [libmamba] Factorize Win user folder function between files by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2925 +- [libmamba, libmambapy] Combine dev environments by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2937 +- [libmamba, micromamba] Refactor win encoding conversion by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2939 +- [micromamba] Move reposerver tests to micromamba by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2941 +- [micromamba] Remove mamba by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2942 +- [all] Dev workflow by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2948 +- [libmamba, micromamba] Add refactor getenv setenv unsetenv by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2944 +- [all] Explicit and smart CMake target by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2935 +- [libmamba, micromamba] Rename env functions by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2954 +- [libmambapy] Modularize libmambapy by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2960 +- [libmamba] Environment map by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2967 +- [libmamba] Add envrionment cleaner test fixtures by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2973 +- [all] Update dependencies on OSX by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2976 +- [all] Channel initialization by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2953 +- [libmamba] Add weakening_map by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2981 +- [libmamba, micromamba] Refactor env directories by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2983 +- [libmamba] Enable new repodata parser by default by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2989 +- [libmamba] Allow overriding archspec by @isuruf in https://github.com/mamba-org/mamba/pull/2966 +- [libmamba] Add Python-like set operations to flat_set by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2557 +- [libmamba, micromamba] Migrate expand/shrink_home by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2990 +- [libmamba, micromamba] Refactor env::which by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2997 +- [all] Migrate Channel::make_channel to resolve multi channels by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2986 +- [all] Move core/channel > specs/channel by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3000 +- [libmamba, libmambapy] Remove ChannelContext ctor by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3002 +- [libmamba] Improve ChannelContext and Channel by @AntoinePrv in xhttps://github.com/mamba-org/mamba/pull/3003 +- [all] Remove ChanelContext context capture by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3015 +- [libmamba, libmambapy] Bind Channel by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3001 +- [libmamba, micromamba] Default to hide credentials by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3017 +- [libmamba] Validation QA by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3022 +- [libmamba, micromamba] Refactor (some) OpenSSL functions by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3024 +- [libmamba] Use std::array by @AntoinePRv in https://github.com/mamba-org/mamba/pull/3037 +- [libmambapy] Bind ChannelContext by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3034 +- [libmamba, micromamba] Default to conda-forge channel by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3035 +- [libamba, libmambapy] Split validate.[ch]pp by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3041 +- [libmamba] Remove duplicate function by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3042 +- [libmamba, libmambapy] MatchSpec small improvements by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3043 +- [all] Plug ChannelSpec in MatchSpec by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3046 +- [libmamba] Drop unneeded dependencies by @opoplawski in https://github.com/mamba-org/mamba/pull/3016 +- [all] Change MatchSpec::parse to named constructor by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3048 +- [libmamba, libmambapy] restore use_default_signal_handler flag for libmambapy by @dholth in https://github.com/mamba-org/mamba/pull/3028 +- [micromamba] Added mamba as dynamic build of micromamba by @JohanMabille in https://github.com/mamba-org/mamba/pull/3060 + +Bug fixes: + +- [libmamba, micromamba] fix: Handle extra white-space in `MatchSpec` by @jjerphan in https://github.com/mamba-org/mamba/pull/3456 +- [micromamba] Fix `test_env_update_pypi_with_conda_forge` by @Hind-M in https://github.com/mamba-org/mamba/pull/3459 +- [libmamba, micromamba] fix: Environment removal confirmation by @jjerphan in https://github.com/mamba-org/mamba/pull/3450 +- [micromamba] Fix test in osx by @Hind-M in https://github.com/mamba-org/mamba/pull/3448 +- [libmamba, libmambapy] fix: add warning when using defaults by @wolfv in https://github.com/mamba-org/mamba/pull/3434 +- [libmamba, micromamba] Add fallback to root prefix by @Hind-M in https://github.com/mamba-org/mamba/pull/3435 +- [libmamba] Fix x86_64 to use underscore instead of dash by @traversaro in https://github.com/mamba-org/mamba/pull/3433 +- [libmamba, micromamba] Fixed micromamba static build after cctools and ld64 upgrade on conda… by @JohanMabille in https://github.com/mamba-org/mamba/pull/3436 +- [libmamba, micromamba] fix: PyPI support for `env update` by @jjerphan in https://github.com/mamba-org/mamba/pull/3419 +- [libmamba] Fix output by @Hind-M in https://github.com/mamba-org/mamba/pull/3428 +- [all] Update mamba.sh.in script by @SylvainCorlay in https://github.com/mamba-org/mamba/pull/3422 +- [libmamba] Execute remove action before install actions by @SylvainCorlay in https://github.com/mamba-org/mamba/pull/3424 +- [micromamba] test: Adapt `test_remove_orphaned` unlinks by @jjerphan in https://github.com/mamba-org/mamba/pull/3417 +- [micromamba, libmamba] fix: Reduce logging system overhead by @jjerphan in https://github.com/mamba-org/mamba/pull/3416 +- [all] Define `etc/profile.d/mamba.sh` and install it by @jjerphan in https://github.com/mamba-org/mamba/pull/3413 +- [micromamba] Add posix to supported shells by @jjerphan in https://github.com/mamba-org/mamba/pull/3412 +- [all] Replaces instances of -p with --root-prefix in documentation by @SylvainCorlay in https://github.com/mamba-org/mamba/pull/3411 +- [libmamba, micromamba] [micromamba] Fix behavior of `env update` (to mimick conda) by @Hind-M in https://github.com/mamba-org/mamba/pull/3396 +- [libmamba] Reset the prompt back to default by @cvanelteren in https://github.com/mamba-org/mamba/pull/3392 +- [libmamba] Add missing header by @Hind-M in https://github.com/mamba-org/mamba/pull/3389 +- [libmamba] Restore previous behavior of `MAMBA_ROOT_PREFIX` by @Hind-M in https://github.com/mamba-org/mamba/pull/3365 +- [libmamba] Allow leading lowercase letter in version by @Hind-M in https://github.com/mamba-org/mamba/pull/3361 +- [libmamba] Allow spaces in version after operator by @Hind-M in https://github.com/mamba-org/mamba/pull/3358 +- [micromamba] Attempt to fix `test_proxy_install` by @Hind-M in https://github.com/mamba-org/mamba/pull/3324 +- [micromamba] Fix `test_no_python_pinning` by @Hind-M in https://github.com/mamba-org/mamba/pull/3321 +- [libmamba] Fixed restoring the previous signal handler for example in python case (Windows only for now) by @Klaim in https://github.com/mamba-org/mamba/pull/3297 +- [all] Split `ContextOptions::enable_logging_and_signal_handling` into 2 different options by @Klaim in https://github.com/mamba-org/mamba/pull/3329 +- [libmambapy, libmamba] libmambapy: use `Context` explicitly by @Klaim in https://github.com/mamba-org/mamba/pull/3309 +- [micromamba] Fix test_no_python_pinning by @Hind-M in https://github.com/mamba-org/mamba/pull/3319 +- [all] Fix release scripts by @Hind-M in https://github.com/mamba-org/mamba/pull/3306 +- [libmamba] Hotfix to allow Ctrl+C in python scipts by @Klaim in https://github.com/mamba-org/mamba/pull/3285 +- [libmamba] Fix typos in comments by @ryandesign in https://github.com/mamba-org/mamba/pull/3272 +- [all] Fix VersionSpec equal and glob by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3269 +- [libmamba] Fix pin repr in solver error messages by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3268 +- [libmambapy] Add missing pybind header by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3256 +- [libmambapy, libmamba] Don't add duplicate .conda and .tar.bz2 packages by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3253 +- [all] Use conda-forge feedstock for static builds by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3249 +- [micromamba, libmamba] Mamba 2.0 name fixes by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3225 +- [all] Make Taskfile.dist.yml Windows-compatible by @carschandler in https://github.com/mamba-org/mamba/pull/3219 +- [libmamba] fix(micromamba): anaconda private channels not working by @s22chan in https://github.com/mamba-org/mamba/pull/3220 +- [micromamba] Remove unmaintained and broken pytest-lazy-fixture by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3193 +- [libmamba] Simple logging fix by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3184 +- [libmamba, micromamba] Fix URL enconding in repodata.json by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3076 +- [libmamba, micromamba] gracefully handle conflicting names in yaml specs by @jchorl in https://github.com/mamba-org/mamba/pull/3083 +- [libmamba] Fix verbose and strange prefix in Powershell by @pwnfan in https://github.com/mamba-org/mamba/pull/3116 +- [libmamba] handle other deps in multiple env files by @jchorl in https://github.com/mamba-org/mamba/pull/3096 +- [libmambapy] Fix expected caster by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3136 +- [libmamba, micromamba] add manually given .tar.bz2 / .conda packages to solver pool by @0xbe7a in https://github.com/mamba-org/mamba/pull/3164 +- [libmambapy] Fix 2.0 alpha by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3067 +- [libmambapy] fix subs by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2817 +- [libmamba, micromamba] Fix linking on Windows when Scripts folder is missing by @dalcinl in https://github.com/mamba-org/mamba/pull/2825 +- [libmamba] added support for empty lines in dependency file in txt format by @rmittal87 in https://github.com/mamba-org/mamba/pull/2812 +- [libmamba] Fix local channels location by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2851 +- [libmamba] Fixed libmamba tests static build by @JohanMabille in https://github.com/mamba-org/mamba/pull/2855 +- [micromamba] Fix win test micro.mamba.pm by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2888 +- [libmamba, micromamba] Add CI test for local channels by @Hind-M in https://github.com/mamba-org/mamba/pull/2854 +- [micromamba] Fixed "micromamba package transmute names files going from .conda -> .tar.bz2 incorrectly" by @mariusvniekerk in https://github.com/mamba-org/mamba/issues/2911 +- [libmamba] Nushell hotfix by @cvanelteren https://github.com/mamba-org/mamba/pull/2841 +- [libmamba] Added missing dependency in libmambaConfig.cmake.in by @JohanMabille in https://github.com/mamba-org/mamba/pull/2916 +- [libmamba] Allow defaults::* spec by @isuruf in https://github.com/mamba-org/mamba/pull/2927 +- [libmamba] https://github.com/mamba-org/mamba/pull/2929 by @bruchim-cisco in https://github.com/mamba-org/mamba/pull/2929 +- [libmamba] Fix channels with slashes regression by @isuruf in https://github.com/mamba-org/mamba/pull/2926 +- [micromamba] Fix micromamba test dependency conda-package-handling by @rominf in https://github.com/mamba-org/mamba/pull/2945 +- [libmamba, libmambapy] fix: Parse remote_connect_timeout_secs as a double by @jjerphan in https://github.com/mamba-org/mamba/pull/2949 +- [libmamba] Add mirrors by @Hind-M in https://github.com/mamba-org/mamba/pull/2795 +- [all] Add cmake-format by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2962 +- [micromamba] removed dependency on conda-index by @JohanMabille in https://github.com/mamba-org/mamba/pull/2964 +- [libmamba] Fixed move semantics of DownloadAttempt by @JohanMabille in https://github.com/mamba-org/mamba/pull/2963 +- [libmamba] Nu 0.87.0 by @cvanelteren in https://github.com/mamba-org/mamba/pull/2984 +- [libmamba] fix config precedence for base env by @0xbe7a in https://github.com/mamba-org/mamba/pull/3009 +- [libmamba] Fix libmamba cmake version file by @opoplawski in https://github.com/mamba-org/mamba/pull/3013 + +CI fixes and doc: + +- [all] Fix wrong version of miniforge in doc by @Hind-M in https://github.com/mamba-org/mamba/pull/3462 +- [all] Remove cctools patch removal in CI by @Hind-M in https://github.com/mamba-org/mamba/pull/3451 +- [all] docs: Specify `CMAKE_INSTALL_PREFIX` by @jjerphan in https://github.com/mamba-org/mamba/pull/3438 +- [all] docs: Adapt "Solving Package Environments" section by @jjerphan in https://github.com/mamba-org/mamba/pull/3326 +- [all] [win-64] Remove workaround by @Hind-M in https://github.com/mamba-org/mamba/pull/3398 +- [all] [win-64] Add constraint on fmt by @Hind-M in https://github.com/mamba-org/mamba/pull/3400 +- [all] Unpin cryptography, python, and add make to environment-dev.yml by @jaimergp in https://github.com/mamba-org/mamba/pull/3352 +- [all] ci: Unpin libcxx <18 by @jjerphan in https://github.com/mamba-org/mamba/pull/3375 +- [all] chore(ci): bump github action versions by @corneliusroemer in https://github.com/mamba-org/mamba/pull/3350 +- [all] doc(more_concepts.rst): improve clarity by @corneliusroemer in https://github.com/mamba-org/mamba/pull/3357 +- [micromamba] Temporarily disabled no_python_pinning test on Windows by @JohanMabille in https://github.com/mamba-org/mamba/pull/3322 +- [all] Fix CI failure on win-64 by @Hind-M in https://github.com/mamba-org/mamba/pull/3315 +- [micromamba] Test with xtensor-python instead of unmaintained xframe by @JohanMabille in https://github.com/mamba-org/mamba/pull/3286 +- [all] Small changelog additions by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3254 +- [all] Fixed a spelling mistake in micromamba-installation.rst by @codeblech in https://github.com/mamba-org/mamba/pull/3236 +- [all] Typos in dev_environment.rst by @jd-foster in https://github.com/mamba-org/mamba/pull/3235 +- [all] Add MatchSpec doc and fix errors by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3224 +- [libmambapy] Remove dead mamba.py doc by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3078 +- [all] Document specs::Channel by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3077 +- [all] Fix --override-channels docs by @jonashaag in https://github.com/mamba-org/mamba/pull/3084 +- [all] Add 2.0 changes draft by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3091 +- [all] Add Breathe for API documentation by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3087 +- [micromamba] Add instructions for gnu coreutils on OSX by @benmoss in https://github.com/mamba-org/mamba/pull/3111 +- [all] Warning around manual install and add ref to conda-libmamba by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3119 +- [all] Add MacOS DNS issue logging by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3130 +- [all] Add CI merge groups by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3068 +- [micromamba] Build micromamba win with feedstock by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2859 +- [micromamba] Update GitHub Actions steps to open Issues for failed scheduled jobs by @jdblischak in https://github.com/mamba-org/mamba/pull/2884 +- [micromamba] Fix Ci by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2889 +- [micromamba] Mark Anaconda channels as unsupported by @jonashaag in https://github.com/mamba-org/mamba/pull/2904 +- [micromamba] Fix nodefaults in documentation by @jonashaag in https://github.com/mamba-org/mamba/pull/2809 +- [micromamba] Improve install instruction by @jonashaag in https://github.com/mamba-org/mamba/pull/2908 +- [libmambapy] Refactor CI and libamambapy tests (on Unix) by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2952 +- [libmambapy] Refactor CI and libamambapy tests (on Win) by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2955 +- [all] Simplify and correct development documention by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2975 +- [all] Add install from source instructions by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2977 +- [all] update readme install link by @artifical-agent in https://github.com/mamba-org/mamba/pull/2980 +- [all] Fail fast except on debug runs by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2985 + 2024.09.20 ========== diff --git a/libmamba/CHANGELOG.md b/libmamba/CHANGELOG.md index 15060d4d1b..b9d8faad56 100644 --- a/libmamba/CHANGELOG.md +++ b/libmamba/CHANGELOG.md @@ -1,3 +1,252 @@ +libmamba 2.0.0 (September 25, 2024) +=================================== + +Enhancements: + +- test: `MatchSpec` edges cases by @jjerphan in https://github.com/mamba-org/mamba/pull/3458 +- Compute `root prefix` as mamba install path by @Hind-M in https://github.com/mamba-org/mamba/pull/3447 +- Support CONDA_DEFAULT_ENV by @SylvainCorlay in https://github.com/mamba-org/mamba/pull/3445 +- Remove cctools patch from feedstock in CI by @JohanMabille in https://github.com/mamba-org/mamba/pull/3442 +- test: Comparability and hashability of `PackageInfo` and `MatchSpec` by @jjerphan in https://github.com/mamba-org/mamba/pull/3369 +- build: Support fmt 11 (follow-up) by @jjerphan in https://github.com/mamba-org/mamba/pull/3371 +- build: Support fmt 11 by @jjerphan in https://github.com/mamba-org/mamba/pull/3368 +- Make more classes hashable and comparable by @jjerphan in https://github.com/mamba-org/mamba/pull/3363 +- Replace `Context` with `Context::platform` where possible by @jjerphan in https://github.com/mamba-org/mamba/pull/3364 +- Update mamba.xsh: support xonsh >= 0.18.0 by @anki-code in https://github.com/mamba-org/mamba/pull/3355 +- Remove logs for every package by @Hind-M in https://github.com/mamba-org/mamba/pull/3335 +- maint: Remove declaration of `PrefixData::load` by @jjerphan in https://github.com/mamba-org/mamba/pull/3325 +- maint: Remove some warnings by @jjerphan in https://github.com/mamba-org/mamba/pull/3320 +- maint: Remove `PrefixData::load` by @jjerphan in https://github.com/mamba-org/mamba/pull/3318 +- OCI/Conda mapping by @Hind-M in https://github.com/mamba-org/mamba/pull/3310 +- [OCI - Mirrors] Add tests and doc by @Hind-M in https://github.com/mamba-org/mamba/pull/3307 +- [OCI Registry] Handle compressed repodata by @Hind-M in https://github.com/mamba-org/mamba/pull/3300 +- [CEP-15] Support `base_url` with `repodata_version: 2` using `mamba` parser by @Hind-M in https://github.com/mamba-org/mamba/pull/3282 +- Fix OCIMirror use by @Hind-M in https://github.com/mamba-org/mamba/pull/3296 +- Add checking typos to pre-commit by @Hind-M in https://github.com/mamba-org/mamba/pull/3278 +- Bind text_style and graphic params by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3266 +- Update pre-commit hooks" by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3252 +- Refactor os utilities by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3248 +- Implemented OCI mirrors by @JohanMabille in https://github.com/mamba-org/mamba/pull/3246 +- Passed url_path to request_generators by @JohanMabille in https://github.com/mamba-org/mamba/pull/3245 +- Handle regex in build string by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3239 +- [mamba-content-trust] Add integration test by @Hind-M in https://github.com/mamba-org/mamba/pull/3234 +- Release libsolv memory before installation by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3238 +- Custom resolve complex MatchSpec in Solver by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3233 +- Add MatchSpec::contains_except_channel" by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3231 +- [mamba content trust] Enable verifying packages signatures by @Hind-M in https://github.com/mamba-org/mamba/pull/3192 +- Refactor MatchSpec::str by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3215 +- Subdir renaming by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3214 +- Fully bind MatchSpec by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3213 +- Add more MatchSpec tests by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3211 +- Expected in specs parse API by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3207 +- Refactor MatchSpec::parse by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3205 +- Added HTTP Mirrors by @JohanMabille in https://github.com/mamba-org/mamba/pull/3178 +- Use expected for specs parsing by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3201 +- Refactor ObjPool to use views in callbacks by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3199 +- Add more solver tests and other small features by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3198 +- Finalized Solver bindings and add solver doc by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3195 +- Add libsolv.Database Bindings and tests by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3186 +- Add (some) solver Database tests by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3185 +- Make libsolv wrappers into standalone library by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3181 +- Rename MPool into solver::libsolv::Database by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3180 +- Automate releases (`CHANGELOG.md` updating) by @Hind-M in https://github.com/mamba-org/mamba/pull/3179 +- Simplify MPool Interface by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3177 +- Clean libsolv use in Transaction by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3171 +- Rewrite Query with Pool functions (wrapping libsolv) by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3168 +- Support multiple env yaml specs by @jchorl in https://github.com/mamba-org/mamba/pull/2993 +- Update shell hook comments by @jonashaag in https://github.com/mamba-org/mamba/pull/3051 +- More specs bindings by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3080 +- Add VersionSpec::str by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3081 +- Some future proofing MatchSpec by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3082 +- Reformat string by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3085 +- Clean up url_manip by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3086 +- Fix VersionSpec free ranges by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3088 +- Add parsing utilities by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3090 +- Bump MAMBA libsolv file ABI by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3093 +- MatchSpec use VersionSpec by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3089 +- GlobSpec by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3094 +- Add BuildNumberSpec by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3098 +- Refactor MatchSpec unlikey data by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3099 +- Remove micromamba shell init -p by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3092 +- Clean PackageInfo interface by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3103 +- NoArchType as standalone enum by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3108 +- Move PackageInfo in specs:: by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3109 +- Change PackageInfo types by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3113 +- Add some PackageInfo tests by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3115 +- Rename ChannelSpec > UndefinedChannel by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3117 +- Add Channel::contains_package by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3121 +- Pool channel match by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3122 +- Added mirrored channels by @JohanMabille in https://github.com/mamba-org/mamba/pull/3125 +- Move util_random.hpp > util/random.hpp by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3129 +- MRepo refactor by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3118 +- No M by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3137 +- Explcit transaction duplicate code by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3138 +- Solver improvements by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3140 +- Sort transaction table entries by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3146 +- Solver Request by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3141 +- Improve Solution usage by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3148 +- Refactor solver flags by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3153 +- Moved download related files to dedicated folder by @JohanMabille in https://github.com/mamba-org/mamba/pull/3155 +- Remove outdated commented code snippet by @jjerphan in https://github.com/mamba-org/mamba/pull/3160 +- Implemented support for mirrors by @JohanMabille in https://github.com/mamba-org/mamba/pull/3157 +- Split Solver and Unsolvable by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3156 +- Proper sorting of display actions by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3165 +- Solver sort deps by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3163 +- Bind solver::libsolv::UnSolvable by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3166 +- Improve Query API by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3167 +- Context: not a singleton by @Klaim in https://github.com/mamba-org/mamba/pull/2615 +- Add CondaURL by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2805 +- No ugly kenum by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2831 +- Add Nushell activation support by cvanelteren in https://github.com/mamba-org/mamba/pull/2693 +- Support $var syntax in .condarc by @jonashaag in https://github.com/mamba-org/mamba/pull/2833 +- Handle null and false noarch values by @gabrielsimoes in https://github.com/mamba-org/mamba/pull/2835 +- Add CondaURL::pretty_str by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2830 +- Channel cleanup by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2832 +- Authenfitication split user and password by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2849 +- Improved static build error message by @JohanMabille in https://github.com/mamba-org/mamba/pull/2850 +- Add local channels test by @Hind-M in https://github.com/mamba-org/mamba/pull/2853 +- Don't force MSVC_RUNTIME by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2861 +- Build micromamba with /MD by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2862 +- Fix Posix shell on Windows by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2803 +- Further improve micromamba search output by @delsner in https://github.com/mamba-org/mamba/pull/2823 +- Minor Channel refactoring by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2852 +- path_to_url percent encoding by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2867 +- Change libsolv static lib name by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2876 +- Download by @JohanMabille in https://github.com/mamba-org/mamba/pull/2844 +- Use CMake targets for reproc by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2883 +- Add FindLibsolv.cmake by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2886 +- Read repodata.json using nl::json (rerun) by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2753 +- Filesystem library by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2879 +- Header cleanup filesystem follow-up by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2894 +- Add multiple queries to repoquery search by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2897 +- Add ChannelSpec by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2870 +- Print error code if run fails by @jonashaag in https://github.com/mamba-org/mamba/pull/2848 +- Added PackageFetcher by @JohanMabille in https://github.com/mamba-org/mamba/pull/2917 +- return architecture levels for micromamba by @isuruf in https://github.com/mamba-org/mamba/pull/2921 +- Resolve ChannelSpec into a Channel by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2899 +- Factorize Win user folder function between files by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2925 +- Combine dev environments by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2937 +- Refactor win encoding conversion by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2939 +- Dev workflow by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2948 +- Add refactor getenv setenv unsetenv by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2944 +- Explicit and smart CMake target by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2935 +- Rename env functions by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2954 +- Environment map by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2967 +- Add envrionment cleaner test fixtures by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2973 +- Update dependencies on OSX by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2976 +- Channel initialization by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2953 +- Add weakening_map by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2981 +- Refactor env directories by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2983 +- Enable new repodata parser by default by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2989 +- Allow overriding archspec by @isuruf in https://github.com/mamba-org/mamba/pull/2966 +- Add Python-like set operations to flat_set by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2557 +- Migrate expand/shrink_home by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2990 +- Refactor env::which by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2997 +- Migrate Channel::make_channel to resolve multi channels by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2986 +- Move core/channel > specs/channel by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3000 +- Remove ChannelContext ctor by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3002 +- Improve ChannelContext and Channel by @AntoinePrv in xhttps://github.com/mamba-org/mamba/pull/3003 +- Remove ChanelContext context capture by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3015 +- Bind Channel by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3001 +- Default to hide credentials by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3017 +- Validation QA by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3022 +- Refactor (some) OpenSSL functions by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3024 +- Use std::array by @AntoinePRv in https://github.com/mamba-org/mamba/pull/3037 +- Default to conda-forge channel by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3035 +- Remove duplicate function by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3042 +- MatchSpec small improvements by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3043 +- Plug ChannelSpec in MatchSpec by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3046 +- Drop unneeded dependencies by @opoplawski in https://github.com/mamba-org/mamba/pull/3016 +- Change MatchSpec::parse to named constructor by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3048 +- restore use_default_signal_handler flag for libmambapy by @dholth in https://github.com/mamba-org/mamba/pull/3028 + +Bug fixes: + +- fix: Handle extra white-space in `MatchSpec` by @jjerphan in https://github.com/mamba-org/mamba/pull/3456 +- fix: Environment removal confirmation by @jjerphan in https://github.com/mamba-org/mamba/pull/3450 +- fix: add warning when using defaults by @wolfv in https://github.com/mamba-org/mamba/pull/3434 +- Add fallback to root prefix by @Hind-M in https://github.com/mamba-org/mamba/pull/3435 +- Fix x86_64 to use underscore instead of dash by @traversaro in https://github.com/mamba-org/mamba/pull/3433 +- Fixed micromamba static build after cctools and ld64 upgrade on conda… by @JohanMabille in https://github.com/mamba-org/mamba/pull/3436 +- fix: PyPI support for `env update` by @jjerphan in https://github.com/mamba-org/mamba/pull/3419 +- Fix output by @Hind-M in https://github.com/mamba-org/mamba/pull/3428 +- Update mamba.sh.in script by @SylvainCorlay in https://github.com/mamba-org/mamba/pull/3422 +- Execute remove action before install actions by @SylvainCorlay in https://github.com/mamba-org/mamba/pull/3424 +- fix: Reduce logging system overhead by @jjerphan in https://github.com/mamba-org/mamba/pull/3416 +- Define `etc/profile.d/mamba.sh` and install it by @jjerphan in https://github.com/mamba-org/mamba/pull/3413 +- Replaces instances of -p with --root-prefix in documentation by @SylvainCorlay in https://github.com/mamba-org/mamba/pull/3411 +- [micromamba] Fix behavior of `env update` (to mimick conda) by @Hind-M in https://github.com/mamba-org/mamba/pull/3396 +- Reset the prompt back to default by @cvanelteren in https://github.com/mamba-org/mamba/pull/3392 +- Add missing header by @Hind-M in https://github.com/mamba-org/mamba/pull/3389 +- Restore previous behavior of `MAMBA_ROOT_PREFIX` by @Hind-M in https://github.com/mamba-org/mamba/pull/3365 +- Allow leading lowercase letter in version by @Hind-M in https://github.com/mamba-org/mamba/pull/3361 +- Allow spaces in version after operator by @Hind-M in https://github.com/mamba-org/mamba/pull/3358 +- Fixed restoring the previous signal handler for example in python case (Windows only for now) by @Klaim in https://github.com/mamba-org/mamba/pull/3297 +- Split `ContextOptions::enable_logging_and_signal_handling` into 2 different options by @Klaim in https://github.com/mamba-org/mamba/pull/3329 +- libmambapy: use `Context` explicitly by @Klaim in https://github.com/mamba-org/mamba/pull/3309 +- Fix release scripts by @Hind-M in https://github.com/mamba-org/mamba/pull/3306 +- Hotfix to allow Ctrl+C in python scipts by @Klaim in https://github.com/mamba-org/mamba/pull/3285 +- Fix typos in comments by @ryandesign in https://github.com/mamba-org/mamba/pull/3272 +- Fix VersionSpec equal and glob by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3269 +- Fix pin repr in solver error messages by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3268 +- Don't add duplicate .conda and .tar.bz2 packages by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3253 +- Use conda-forge feedstock for static builds by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3249 +- Mamba 2.0 name fixes by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3225 +- Make Taskfile.dist.yml Windows-compatible by @carschandler in https://github.com/mamba-org/mamba/pull/3219 +- fix(micromamba): anaconda private channels not working by @s22chan in https://github.com/mamba-org/mamba/pull/3220 +- Simple logging fix by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3184 +- Fix URL enconding in repodata.json by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3076 +- gracefully handle conflicting names in yaml specs by @jchorl in https://github.com/mamba-org/mamba/pull/3083 +- Fix verbose and strange prefix in Powershell by @pwnfan in https://github.com/mamba-org/mamba/pull/3116 +- handle other deps in multiple env files by @jchorl in https://github.com/mamba-org/mamba/pull/3096 +- add manually given .tar.bz2 / .conda packages to solver pool by @0xbe7a in https://github.com/mamba-org/mamba/pull/3164 +- Fix linking on Windows when Scripts folder is missing by @dalcinl in https://github.com/mamba-org/mamba/pull/2825 +- added support for empty lines in dependency file in txt format by @rmittal87 in https://github.com/mamba-org/mamba/pull/2812 +- Fix local channels location by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2851 +- Fixed libmamba tests static build by @JohanMabille in https://github.com/mamba-org/mamba/pull/2855 +- Add CI test for local channels by @Hind-M in https://github.com/mamba-org/mamba/pull/2854 +- Nushell hotfix by @cvanelteren https://github.com/mamba-org/mamba/pull/2841 +- Added missing dependency in libmambaConfig.cmake.in by @JohanMabille in https://github.com/mamba-org/mamba/pull/2916 +- Allow defaults::* spec by @isuruf in https://github.com/mamba-org/mamba/pull/2927 +- https://github.com/mamba-org/mamba/pull/2929 by @bruchim-cisco in https://github.com/mamba-org/mamba/pull/2929 +- Fix channels with slashes regression by @isuruf in https://github.com/mamba-org/mamba/pull/2926 +- fix: Parse remote_connect_timeout_secs as a double by @jjerphan in https://github.com/mamba-org/mamba/pull/2949 +- Add mirrors by @Hind-M in https://github.com/mamba-org/mamba/pull/2795 +- Add cmake-format by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2962 +- Fixed move semantics of DownloadAttempt by @JohanMabille in https://github.com/mamba-org/mamba/pull/2963 +- Nu 0.87.0 by @cvanelteren in https://github.com/mamba-org/mamba/pull/2984 +- fix config precedence for base env by @0xbe7a in https://github.com/mamba-org/mamba/pull/3009 +- Fix libmamba cmake version file by @opoplawski in https://github.com/mamba-org/mamba/pull/3013 + +CI fixes and doc: + +- Fix wrong version of miniforge in doc by @Hind-M in https://github.com/mamba-org/mamba/pull/3462 +- Remove cctools patch removal in CI by @Hind-M in https://github.com/mamba-org/mamba/pull/3451 +- docs: Specify `CMAKE_INSTALL_PREFIX` by @jjerphan in https://github.com/mamba-org/mamba/pull/3438 +- docs: Adapt "Solving Package Environments" section by @jjerphan in https://github.com/mamba-org/mamba/pull/3326 +- [win-64] Remove workaround by @Hind-M in https://github.com/mamba-org/mamba/pull/3398 +- [win-64] Add constraint on fmt by @Hind-M in https://github.com/mamba-org/mamba/pull/3400 +- Unpin cryptography, python, and add make to environment-dev.yml by @jaimergp in https://github.com/mamba-org/mamba/pull/3352 +- ci: Unpin libcxx <18 by @jjerphan in https://github.com/mamba-org/mamba/pull/3375 +- chore(ci): bump github action versions by @corneliusroemer in https://github.com/mamba-org/mamba/pull/3350 +- doc(more_concepts.rst): improve clarity by @corneliusroemer in https://github.com/mamba-org/mamba/pull/3357 +- Fix CI failure on win-64 by @Hind-M in https://github.com/mamba-org/mamba/pull/3315 +- Small changelog additions by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3254 +- Fixed a spelling mistake in micromamba-installation.rst by @codeblech in https://github.com/mamba-org/mamba/pull/3236 +- Typos in dev_environment.rst by @jd-foster in https://github.com/mamba-org/mamba/pull/3235 +- Add MatchSpec doc and fix errors by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3224 +- Document specs::Channel by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3077 +- Fix --override-channels docs by @jonashaag in https://github.com/mamba-org/mamba/pull/3084 +- Add 2.0 changes draft by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3091 +- Add Breathe for API documentation by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3087 +- Warning around manual install and add ref to conda-libmamba by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3119 +- Add MacOS DNS issue logging by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3130 +- Add CI merge groups by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3068 +- Simplify and correct development documention by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2975 +- Add install from source instructions by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2977 +- update readme install link by @artifical-agent in https://github.com/mamba-org/mamba/pull/2980 +- Fail fast except on debug runs by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2985 + libmamba 2.0.0rc6 (September 20, 2024) ====================================== diff --git a/libmambapy/CHANGELOG.md b/libmambapy/CHANGELOG.md index 4a7fdda605..82f31ce078 100644 --- a/libmambapy/CHANGELOG.md +++ b/libmambapy/CHANGELOG.md @@ -1,3 +1,132 @@ +libmambapy 2.0.0 (September 25, 2024) +===================================== + +Enhancements: + +- Remove cctools patch from feedstock in CI by @JohanMabille in https://github.com/mamba-org/mamba/pull/3442 +- Replace `Context` with `Context::platform` where possible by @jjerphan in https://github.com/mamba-org/mamba/pull/3364 +- Add checking typos to pre-commit by @Hind-M in https://github.com/mamba-org/mamba/pull/3278 +- Bind text_style and graphic params by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3266 +- Bind VersionPredicate by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3255 +- Update pre-commit hooks" by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3252 +- Handle regex in build string by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3239 +- Custom resolve complex MatchSpec in Solver by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3233 +- Add MatchSpec::contains_except_channel" by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3231 +- [mamba content trust] Enable verifying packages signatures by @Hind-M in https://github.com/mamba-org/mamba/pull/3192 +- Refactor MatchSpec::str by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3215 +- Subdir renaming by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3214 +- Fully bind MatchSpec by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3213 +- Added HTTP Mirrors by @JohanMabille in https://github.com/mamba-org/mamba/pull/3178 +- Use expected for specs parsing by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3201 +- Add more solver tests and other small features by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3198 +- Finalized Solver bindings and add solver doc by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3195 +- Add libsolv.Database Bindings and tests by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3186 +- Rename MPool into solver::libsolv::Database by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3180 +- Automate releases (`CHANGELOG.md` updating) by @Hind-M in https://github.com/mamba-org/mamba/pull/3179 +- Simplify MPool Interface by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3177 +- Clean libsolv use in Transaction by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3171 +- More specs bindings by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3080 +- Add VersionSpec::str by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3081 +- Some future proofing MatchSpec by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3082 +- Fix VersionSpec free ranges by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3088 +- MatchSpec use VersionSpec by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3089 +- GlobSpec by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3094 +- Clean PackageInfo interface by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3103 +- NoArchType as standalone enum by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3108 +- Move PackageInfo in specs:: by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3109 +- Change PackageInfo types by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3113 +- Add some PackageInfo tests by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3115 +- Rename ChannelSpec > UndefinedChannel by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3117 +- Add Channel::contains_package by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3121 +- Pool channel match by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3122 +- Add expected caster to Union by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3135 +- MRepo refactor by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3118 +- No M by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3137 +- Solver improvements by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3140 +- Solver Request by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3141 +- Refactor solver flags by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3153 +- Split Solver and Unsolvable by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3156 +- Solver sort deps by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3163 +- Bind solver::libsolv::UnSolvable by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3166 +- Improve Query API by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3167 +- Context: not a singleton by @Klaim in https://github.com/mamba-org/mamba/pull/2615 +- No ugly kenum by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2831 +- Further improve micromamba search output by @delsner in https://github.com/mamba-org/mamba/pull/2823 +- Download by @JohanMabille in https://github.com/mamba-org/mamba/pull/2844 +- Add multiple queries to repoquery search by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2897 +- Add ChannelSpec by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2870 +- Added PackageFetcher by @JohanMabille in https://github.com/mamba-org/mamba/pull/2917 +- Resolve ChannelSpec into a Channel by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2899 +- Combine dev environments by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2937 +- Dev workflow by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2948 +- Explicit and smart CMake target by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2935 +- Modularize libmambapy by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2960 +- Update dependencies on OSX by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2976 +- Channel initialization by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2953 +- Migrate Channel::make_channel to resolve multi channels by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2986 +- Move core/channel > specs/channel by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3000 +- Remove ChannelContext ctor by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3002 +- Remove ChanelContext context capture by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3015 +- Bind Channel by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3001 +- Bind ChannelContext by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3034 +- Split validate.[ch]pp by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3041 +- MatchSpec small improvements by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3043 +- Plug ChannelSpec in MatchSpec by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3046 +- Change MatchSpec::parse to named constructor by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3048 +- restore use_default_signal_handler flag for libmambapy by @dholth in https://github.com/mamba-org/mamba/pull/3028 + +Bug fixes: + +- fix: add warning when using defaults by @wolfv in https://github.com/mamba-org/mamba/pull/3434 +- Update mamba.sh.in script by @SylvainCorlay in https://github.com/mamba-org/mamba/pull/3422 +- Define `etc/profile.d/mamba.sh` and install it by @jjerphan in https://github.com/mamba-org/mamba/pull/3413 +- Replaces instances of -p with --root-prefix in documentation by @SylvainCorlay in https://github.com/mamba-org/mamba/pull/3411 +- Split `ContextOptions::enable_logging_and_signal_handling` into 2 different options by @Klaim in https://github.com/mamba-org/mamba/pull/3329 +- libmambapy: use `Context` explicitly by @Klaim in https://github.com/mamba-org/mamba/pull/3309 +- Fix release scripts by @Hind-M in https://github.com/mamba-org/mamba/pull/3306 +- Fix VersionSpec equal and glob by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3269 +- Add missing pybind header by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3256 +- Don't add duplicate .conda and .tar.bz2 packages by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3253 +- Use conda-forge feedstock for static builds by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3249 +- Make Taskfile.dist.yml Windows-compatible by @carschandler in https://github.com/mamba-org/mamba/pull/3219 +- Fix expected caster by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3136 +- Fix 2.0 alpha by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3067 +- fix subs by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2817 +- fix: Parse remote_connect_timeout_secs as a double by @jjerphan in https://github.com/mamba-org/mamba/pull/2949 +- Add cmake-format by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2962 + +CI fixes and doc: + +- Fix wrong version of miniforge in doc by @Hind-M in https://github.com/mamba-org/mamba/pull/3462 +- Remove cctools patch removal in CI by @Hind-M in https://github.com/mamba-org/mamba/pull/3451 +- docs: Specify `CMAKE_INSTALL_PREFIX` by @jjerphan in https://github.com/mamba-org/mamba/pull/3438 +- docs: Adapt "Solving Package Environments" section by @jjerphan in https://github.com/mamba-org/mamba/pull/3326 +- [win-64] Remove workaround by @Hind-M in https://github.com/mamba-org/mamba/pull/3398 +- [win-64] Add constraint on fmt by @Hind-M in https://github.com/mamba-org/mamba/pull/3400 +- Unpin cryptography, python, and add make to environment-dev.yml by @jaimergp in https://github.com/mamba-org/mamba/pull/3352 +- ci: Unpin libcxx <18 by @jjerphan in https://github.com/mamba-org/mamba/pull/3375 +- chore(ci): bump github action versions by @corneliusroemer in https://github.com/mamba-org/mamba/pull/3350 +- doc(more_concepts.rst): improve clarity by @corneliusroemer in https://github.com/mamba-org/mamba/pull/3357 +- Fix CI failure on win-64 by @Hind-M in https://github.com/mamba-org/mamba/pull/3315 +- Small changelog additions by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3254 +- Fixed a spelling mistake in micromamba-installation.rst by @codeblech in https://github.com/mamba-org/mamba/pull/3236 +- Typos in dev_environment.rst by @jd-foster in https://github.com/mamba-org/mamba/pull/3235 +- Add MatchSpec doc and fix errors by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3224 +- Remove dead mamba.py doc by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3078 +- Document specs::Channel by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3077 +- Fix --override-channels docs by @jonashaag in https://github.com/mamba-org/mamba/pull/3084 +- Add 2.0 changes draft by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3091 +- Add Breathe for API documentation by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3087 +- Warning around manual install and add ref to conda-libmamba by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3119 +- Add MacOS DNS issue logging by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3130 +- Add CI merge groups by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3068 +- Refactor CI and libamambapy tests (on Unix) by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2952 +- Refactor CI and libamambapy tests (on Win) by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2955 +- Simplify and correct development documention by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2975 +- Add install from source instructions by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2977 +- update readme install link by @artifical-agent in https://github.com/mamba-org/mamba/pull/2980 +- Fail fast except on debug runs by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2985 + libmambapy 2.0.0rc6 (September 20, 2024) ======================================== diff --git a/libmambapy/src/libmambapy/version.py b/libmambapy/src/libmambapy/version.py index 1bce6fc6eb..f65c5ee9e4 100644 --- a/libmambapy/src/libmambapy/version.py +++ b/libmambapy/src/libmambapy/version.py @@ -1,2 +1,2 @@ -version_info = (2, 0, 0) +version_info = ("2", "0", "0") __version__ = ".".join(map(str, version_info)) diff --git a/micromamba/CHANGELOG.md b/micromamba/CHANGELOG.md index 3cdad58047..423e9bd1a6 100644 --- a/micromamba/CHANGELOG.md +++ b/micromamba/CHANGELOG.md @@ -1,3 +1,158 @@ +micromamba 2.0.0 (September 25, 2024) +===================================== + +Enhancements: + +- Support CONDA_DEFAULT_ENV by @SylvainCorlay in https://github.com/mamba-org/mamba/pull/3445 +- Remove cctools patch from feedstock in CI by @JohanMabille in https://github.com/mamba-org/mamba/pull/3442 +- test: Adapt test_explicit_export_topologically_sorted by @jjerphan in https://github.com/mamba-org/mamba/pull/3377 +- build: Support fmt 11 by @jjerphan in https://github.com/mamba-org/mamba/pull/3368 +- OCI/Conda mapping by @Hind-M in https://github.com/mamba-org/mamba/pull/3310 +- [OCI - Mirrors] Add tests and doc by @Hind-M in https://github.com/mamba-org/mamba/pull/3307 +- Add checking typos to pre-commit by @Hind-M in https://github.com/mamba-org/mamba/pull/3278 +- Update pre-commit hooks" by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3252 +- Refactor os utilities by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3248 +- [mamba-content-trust] Add integration test by @Hind-M in https://github.com/mamba-org/mamba/pull/3234 +- Custom resolve complex MatchSpec in Solver by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3233 +- [mamba content trust] Enable verifying packages signatures by @Hind-M in https://github.com/mamba-org/mamba/pull/3192 +- Subdir renaming by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3214 +- Expected in specs parse API by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3207 +- Added HTTP Mirrors by @JohanMabille in https://github.com/mamba-org/mamba/pull/3178 +- Use expected for specs parsing by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3201 +- Rename MPool into solver::libsolv::Database by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3180 +- Automate releases (`CHANGELOG.md` updating) by @Hind-M in https://github.com/mamba-org/mamba/pull/3179 +- Simplify MPool Interface by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3177 +- Clean libsolv use in Transaction by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3171 +- Rewrite Query with Pool functions (wrapping libsolv) by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3168 +- Remove hard coded mamba by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3069 +- Support multiple env yaml specs by @jchorl in https://github.com/mamba-org/mamba/pull/2993 +- Duplicate reposerver to isolate micromamba tests by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3071 +- Some future proofing MatchSpec by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3082 +- Remove micromamba shell init -p by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3092 +- Clean PackageInfo interface by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3103 +- Move PackageInfo in specs:: by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3109 +- Move util_random.hpp > util/random.hpp by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3129 +- Refactor test_remove.py to use fixture by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3131 +- MRepo refactor by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3118 +- Explcit transaction duplicate code by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3138 +- Solver Request by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3141 +- Split Solver and Unsolvable by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3156 +- Solver sort deps by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3163 +- Context: not a singleton by @Klaim in https://github.com/mamba-org/mamba/pull/2615 +- Add env update by @Hind-M in https://github.com/mamba-org/mamba/pull/2827 +- Adding locks for cache directories by @rmittal87 in https://github.com/mamba-org/mamba/pull/2811 +- Refactor tests by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2829 +- No ugly kenum by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2831 +- Add Nushell activation support by cvanelteren in https://github.com/mamba-org/mamba/pull/2693 +- Channel cleanup by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2832 +- Don't force MSVC_RUNTIME by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2861 +- Add comments in micromamba repoquery by @Hind-M in https://github.com/mamba-org/mamba/pull/2863 +- Fix Posix shell on Windows by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2803 +- Use CMake targets for reproc by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2883 +- Add mamba tests by @Hind-M in https://github.com/mamba-org/mamba/pull/2877 +- Filesystem library by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2879 +- Add multiple queries to repoquery search by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2897 +- Add ChannelSpec by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2870 +- Make some fixture local by @JohanMabille in https://github.com/mamba-org/mamba/pull/2919 +- Added PackageFetcher by @JohanMabille in https://github.com/mamba-org/mamba/pull/2917 +- Resolve ChannelSpec into a Channel by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2899 +- Refactor win encoding conversion by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2939 +- Move reposerver tests to micromamba by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2941 +- Remove mamba by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2942 +- Dev workflow by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2948 +- Add refactor getenv setenv unsetenv by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2944 +- Explicit and smart CMake target by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2935 +- Rename env functions by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2954 +- Update dependencies on OSX by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2976 +- Channel initialization by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2953 +- Refactor env directories by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2983 +- Migrate expand/shrink_home by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2990 +- Refactor env::which by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2997 +- Migrate Channel::make_channel to resolve multi channels by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2986 +- Move core/channel > specs/channel by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3000 +- Remove ChanelContext context capture by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3015 +- Default to hide credentials by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3017 +- Refactor (some) OpenSSL functions by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3024 +- Default to conda-forge channel by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3035 +- Plug ChannelSpec in MatchSpec by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3046 +- Change MatchSpec::parse to named constructor by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3048 +- Added mamba as dynamic build of micromamba by @JohanMabille in https://github.com/mamba-org/mamba/pull/3060 + +Bug fixes: + +- fix: Handle extra white-space in `MatchSpec` by @jjerphan in https://github.com/mamba-org/mamba/pull/3456 +- Fix `test_env_update_pypi_with_conda_forge` by @Hind-M in https://github.com/mamba-org/mamba/pull/3459 +- fix: Environment removal confirmation by @jjerphan in https://github.com/mamba-org/mamba/pull/3450 +- Fix test in osx by @Hind-M in https://github.com/mamba-org/mamba/pull/3448 +- Add fallback to root prefix by @Hind-M in https://github.com/mamba-org/mamba/pull/3435 +- Fixed micromamba static build after cctools and ld64 upgrade on conda… by @JohanMabille in https://github.com/mamba-org/mamba/pull/3436 +- fix: PyPI support for `env update` by @jjerphan in https://github.com/mamba-org/mamba/pull/3419 +- Update mamba.sh.in script by @SylvainCorlay in https://github.com/mamba-org/mamba/pull/3422 +- test: Adapt `test_remove_orphaned` unlinks by @jjerphan in https://github.com/mamba-org/mamba/pull/3417 +- fix: Reduce logging system overhead by @jjerphan in https://github.com/mamba-org/mamba/pull/3416 +- Define `etc/profile.d/mamba.sh` and install it by @jjerphan in https://github.com/mamba-org/mamba/pull/3413 +- Add posix to supported shells by @jjerphan in https://github.com/mamba-org/mamba/pull/3412 +- Replaces instances of -p with --root-prefix in documentation by @SylvainCorlay in https://github.com/mamba-org/mamba/pull/3411 +- [micromamba] Fix behavior of `env update` (to mimick conda) by @Hind-M in https://github.com/mamba-org/mamba/pull/3396 +- Attempt to fix `test_proxy_install` by @Hind-M in https://github.com/mamba-org/mamba/pull/3324 +- Fix `test_no_python_pinning` by @Hind-M in https://github.com/mamba-org/mamba/pull/3321 +- Split `ContextOptions::enable_logging_and_signal_handling` into 2 different options by @Klaim in https://github.com/mamba-org/mamba/pull/3329 +- Fix test_no_python_pinning by @Hind-M in https://github.com/mamba-org/mamba/pull/3319 +- Fix release scripts by @Hind-M in https://github.com/mamba-org/mamba/pull/3306 +- Fix VersionSpec equal and glob by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3269 +- Use conda-forge feedstock for static builds by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3249 +- Mamba 2.0 name fixes by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3225 +- Make Taskfile.dist.yml Windows-compatible by @carschandler in https://github.com/mamba-org/mamba/pull/3219 +- Remove unmaintained and broken pytest-lazy-fixture by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3193 +- Fix URL enconding in repodata.json by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3076 +- gracefully handle conflicting names in yaml specs by @jchorl in https://github.com/mamba-org/mamba/pull/3083 +- add manually given .tar.bz2 / .conda packages to solver pool by @0xbe7a in https://github.com/mamba-org/mamba/pull/3164 +- Fix linking on Windows when Scripts folder is missing by @dalcinl in https://github.com/mamba-org/mamba/pull/2825 +- Fix win test micro.mamba.pm by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2888 +- Add CI test for local channels by @Hind-M in https://github.com/mamba-org/mamba/pull/2854 +- Fixed "micromamba package transmute names files going from .conda -> .tar.bz2 incorrectly" by @mariusvniekerk in https://github.com/mamba-org/mamba/issues/2911 +- Fix micromamba test dependency conda-package-handling by @rominf in https://github.com/mamba-org/mamba/pull/2945 +- Add cmake-format by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2962 +- removed dependency on conda-index by @JohanMabille in https://github.com/mamba-org/mamba/pull/2964 + +CI fixes and doc: + +- Fix wrong version of miniforge in doc by @Hind-M in https://github.com/mamba-org/mamba/pull/3462 +- Remove cctools patch removal in CI by @Hind-M in https://github.com/mamba-org/mamba/pull/3451 +- docs: Specify `CMAKE_INSTALL_PREFIX` by @jjerphan in https://github.com/mamba-org/mamba/pull/3438 +- docs: Adapt "Solving Package Environments" section by @jjerphan in https://github.com/mamba-org/mamba/pull/3326 +- [win-64] Remove workaround by @Hind-M in https://github.com/mamba-org/mamba/pull/3398 +- [win-64] Add constraint on fmt by @Hind-M in https://github.com/mamba-org/mamba/pull/3400 +- Unpin cryptography, python, and add make to environment-dev.yml by @jaimergp in https://github.com/mamba-org/mamba/pull/3352 +- ci: Unpin libcxx <18 by @jjerphan in https://github.com/mamba-org/mamba/pull/3375 +- chore(ci): bump github action versions by @corneliusroemer in https://github.com/mamba-org/mamba/pull/3350 +- doc(more_concepts.rst): improve clarity by @corneliusroemer in https://github.com/mamba-org/mamba/pull/3357 +- Temporarily disabled no_python_pinning test on Windows by @JohanMabille in https://github.com/mamba-org/mamba/pull/3322 +- Fix CI failure on win-64 by @Hind-M in https://github.com/mamba-org/mamba/pull/3315 +- Test with xtensor-python instead of unmaintained xframe by @JohanMabille in https://github.com/mamba-org/mamba/pull/3286 +- Small changelog additions by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3254 +- Fixed a spelling mistake in micromamba-installation.rst by @codeblech in https://github.com/mamba-org/mamba/pull/3236 +- Typos in dev_environment.rst by @jd-foster in https://github.com/mamba-org/mamba/pull/3235 +- Add MatchSpec doc and fix errors by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3224 +- Document specs::Channel by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3077 +- Fix --override-channels docs by @jonashaag in https://github.com/mamba-org/mamba/pull/3084 +- Add 2.0 changes draft by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3091 +- Add Breathe for API documentation by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3087 +- Add instructions for gnu coreutils on OSX by @benmoss in https://github.com/mamba-org/mamba/pull/3111 +- Warning around manual install and add ref to conda-libmamba by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3119 +- Add MacOS DNS issue logging by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3130 +- Add CI merge groups by @AntoinePrv in https://github.com/mamba-org/mamba/pull/3068 +- Build micromamba win with feedstock by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2859 +- Update GitHub Actions steps to open Issues for failed scheduled jobs by @jdblischak in https://github.com/mamba-org/mamba/pull/2884 +- Fix Ci by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2889 +- Mark Anaconda channels as unsupported by @jonashaag in https://github.com/mamba-org/mamba/pull/2904 +- Fix nodefaults in documentation by @jonashaag in https://github.com/mamba-org/mamba/pull/2809 +- Improve install instruction by @jonashaag in https://github.com/mamba-org/mamba/pull/2908 +- Simplify and correct development documention by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2975 +- Add install from source instructions by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2977 +- update readme install link by @artifical-agent in https://github.com/mamba-org/mamba/pull/2980 +- Fail fast except on debug runs by @AntoinePrv in https://github.com/mamba-org/mamba/pull/2985 + micromamba 2.0.0rc6 (September 20, 2024) ======================================== From df9a2dcc77c0f1275e120f7f1ce5dfea06e59fc3 Mon Sep 17 00:00:00 2001 From: Johan Mabille Date: Fri, 27 Sep 2024 21:35:20 +0200 Subject: [PATCH 053/126] GHA issue workaround (#3476) Back to micromamba 1.5.10 on Windows --- .github/workflows/static_build.yml | 1 + .github/workflows/windows_impl.yml | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/.github/workflows/static_build.yml b/.github/workflows/static_build.yml index e3c8a989bd..eb438e9376 100644 --- a/.github/workflows/static_build.yml +++ b/.github/workflows/static_build.yml @@ -151,6 +151,7 @@ jobs: uses: ilammy/msvc-dev-cmd@v1 - uses: mamba-org/setup-micromamba@v1 with: + micromamba-version: '1.5.10-0' environment-name: mambabuild init-shell: bash cmd.exe # Constraint on fmt is due to an issue with 11.0.2 (to be fixed in next version) diff --git a/.github/workflows/windows_impl.yml b/.github/workflows/windows_impl.yml index 480e20dae0..b66856639d 100644 --- a/.github/workflows/windows_impl.yml +++ b/.github/workflows/windows_impl.yml @@ -25,6 +25,7 @@ jobs: - name: Create build environment uses: mamba-org/setup-micromamba@v1 with: + micromamba-version: '1.5.10-0' environment-file: ./dev/environment-dev.yml environment-name: build_env cache-environment: true @@ -77,6 +78,7 @@ jobs: - name: Create build environment uses: mamba-org/setup-micromamba@v1 with: + micromamba-version: '1.5.10-0' environment-file: ./build/environment.lock environment-name: build_env init-shell: bash cmd.exe @@ -106,6 +108,7 @@ jobs: - name: Create build environment uses: mamba-org/setup-micromamba@v1 with: + micromamba-version: '1.5.10-0' environment-file: ./build/environment.lock environment-name: build_env init-shell: bash cmd.exe @@ -134,6 +137,7 @@ jobs: - name: Create build environment uses: mamba-org/setup-micromamba@v1 with: + micromamba-version: '1.5.10-0' environment-file: ./build/environment.lock environment-name: build_env init-shell: bash cmd.exe powershell From db5f6de8f22b28350d0a597ec68000633e5b206a Mon Sep 17 00:00:00 2001 From: Tim Hoffmann <2836374+timhoffm@users.noreply.github.com> Date: Sat, 28 Sep 2024 04:54:50 +0200 Subject: [PATCH 054/126] doc: add github links to documentation (#3471) I've tried to find the github repository from the documentation, but it seems that it's not linked. This PR adds links - as a button in the theme - at the top of https://mamba.readthedocs.io/en/latest/developer_zone/contributing.html Co-authored-by: Sylvain Corlay --- CONTRIBUTING.rst | 2 ++ docs/source/conf.py | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/CONTRIBUTING.rst b/CONTRIBUTING.rst index af070a51fd..b5da6221c4 100644 --- a/CONTRIBUTING.rst +++ b/CONTRIBUTING.rst @@ -2,6 +2,8 @@ Contributing ============== +The mamba repository is hosted at https://github.com/mamba-org/mamba. + When contributing to this repository, it is always a good idea to first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change. diff --git a/docs/source/conf.py b/docs/source/conf.py index c4baefd6cb..176a39d983 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -61,6 +61,10 @@ html_logo = "_static/logo.png" html_title = "documentation" +html_theme_options = { + "repository_url": "https://github.com/mamba-org/mamba", + "use_repository_button": True, +} # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, From 79034ebff18a0b2e6d34e00348a59e649e0b8796 Mon Sep 17 00:00:00 2001 From: Johan Mabille Date: Sat, 28 Sep 2024 07:07:11 +0200 Subject: [PATCH 055/126] Added --copy flag to create and install commands (#3474) Co-authored-by: Sylvain Corlay --- micromamba/src/common_options.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/micromamba/src/common_options.cpp b/micromamba/src/common_options.cpp index 94c70a7e6a..7c3b30a1cc 100644 --- a/micromamba/src/common_options.cpp +++ b/micromamba/src/common_options.cpp @@ -393,7 +393,7 @@ init_install_options(CLI::App* subcom, Configuration& config) auto& always_copy = config.at("always_copy"); subcom->add_flag( - "--always-copy,!--no-always-copy", + "--always-copy,--copy,!--no-always-copy", always_copy.get_cli_config(), always_copy.description() ); From 2e8b3ee7bcb48a548a4db274bd1991ab3d8a11fd Mon Sep 17 00:00:00 2001 From: Johan Mabille Date: Mon, 30 Sep 2024 16:06:13 +0200 Subject: [PATCH 056/126] Fix micromamba activate on Windows (#3484) Fixed mamba_hook.bat --- libmamba/data/mamba_hook.bat | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/libmamba/data/mamba_hook.bat b/libmamba/data/mamba_hook.bat index aadd191931..7a635f1a1e 100644 --- a/libmamba/data/mamba_hook.bat +++ b/libmamba/data/mamba_hook.bat @@ -13,13 +13,15 @@ __MAMBA_INSERT_MAMBA_EXE__ @SET __mambabin_dir= @SET __mamba_root= +@echo off @REM We need to define an alias with the same name as the executable to be called by the user. @REM Get the base filename of MAMBA_EXE -@FOR %%A in ("%MAMBA_EXE%") do set "__mamba_filename=%%~nxA" -@REM Remove .exe extension from the filename -@SET "__mamba_name=!__mamba_filename:%~x1=!" -@REM Define correct alias depending on the executable name -@set "__mamba_cmd=call ""%MAMBA_BAT%"" $*" -@DOSKEY !__mamba_name!=!__mamba_cmd! - +@FOR %%A in ("%MAMBA_EXE%") do ( + @set "__mamba_filename=%%~nxA" + @REM Remove .exe extension from the filename + @SET "__mamba_name=!__mamba_filename:%~x1=!" + @REM Define correct alias depending on the executable name + @set "__mamba_cmd=call ""%MAMBA_BAT%"" $*" + @DOSKEY !__mamba_name!=!__mamba_cmd! +) @SET CONDA_SHLVL=0 From 0b824fe252208903a9d310dbfeefb52e92858b6f Mon Sep 17 00:00:00 2001 From: Julien Jerphanion Date: Mon, 30 Sep 2024 16:41:49 +0200 Subject: [PATCH 057/126] fix: Support for PEP 440 "Compatible Releases" (operator `~=` for `MatchSpec`) (#3483) Signed-off-by: Julien Jerphanion Co-authored-by: Johan Mabille --- libmamba/src/specs/match_spec.cpp | 45 +++++++++++++++++++- libmamba/tests/src/specs/test_match_spec.cpp | 23 +++++++++- micromamba/tests/test_install.py | 9 ++++ 3 files changed, 74 insertions(+), 3 deletions(-) diff --git a/libmamba/src/specs/match_spec.cpp b/libmamba/src/specs/match_spec.cpp index aec2ea7aaf..2659865b50 100644 --- a/libmamba/src/specs/match_spec.cpp +++ b/libmamba/src/specs/match_spec.cpp @@ -505,6 +505,10 @@ namespace mamba::specs std::string raw_match_spec_str = std::string(str); raw_match_spec_str = util::strip(raw_match_spec_str); + // Those are temporary adaptations to handle some instances of `MatchSpec` which is not + // yet formally specified. + // For a tentative formulation of the MatchSpec see: https://github.com/conda/ceps/pull/82 + // Remove any with space after binary operators, such as: // - `openmpi-4.1.4-ha1ae619_102`'s improperly encoded `constrains`: "cudatoolkit >= 10.2" // - `pytorch-1.13.0-cpu_py310h02c325b_0.conda`'s improperly encoded @@ -516,7 +520,7 @@ namespace mamba::specs // TODO: this solution reallocates memory several times potentially, but the // number of operators is small and the strings are short, so it must be fine. // If needed it can be optimized so that the string is only copied once. - for (const std::string& op : { ">=", "<=", "==", ">", "<", "!=", "=", "==", "," }) + for (const std::string& op : { ">=", "<=", "==", ">", "<", "!=", "=", "==", "~=", "," }) { const std::string& bad_op = op + " "; while (raw_match_spec_str.find(bad_op) != std::string::npos) @@ -528,6 +532,45 @@ namespace mamba::specs } } + // Handle PEP 440 "Compatible release" specification + // See: https://peps.python.org/pep-0440/#compatible-release + // + // Find a general replacement of the encoding of `~=` with `>=,.*` to be able to parse it + // properly. + // + // For instance: + // + // "~=x.y" must be replaced to ">=x.y,x.*" where `x` and `y` are positive integers. + // + // This solution must handle the case where the version is encoded with `~=` within the + // specification for instance: + // + // ">1.8,<2|==1.7,!=1.9,~=1.7.1 py34_0" + // + // must be replaced with: + // + // ">1.8,<2|==1.7,!=1.9,>=1.7.1,1.7.* py34_0" + // + while (raw_match_spec_str.find("~=") != std::string::npos) + { + // Extract the string before the `~=` operator (">1.8,<2|==1.7,!=1.9," for the above + // example) + const auto before = raw_match_spec_str.substr(0, str.find("~=")); + // Extract the string after the `~=` operator (include `~=` in it) and the next operator + // space or end of the string ("~=1.7.1 py34_0" for the above example) + const auto after = raw_match_spec_str.substr(str.find("~=")); + // Extract the version part after the `~=` operator ("1.7.1" for the above example) + const auto version = after.substr(2, after.find_first_of(" ,") - 2); + // Extract the version part without the last segment ("1.7" for the above example) + const auto version_without_last_segment = version.substr(0, version.find_last_of('.')); + // Extract the build part after the version part (" py34_0" for the above example) if + // present + const auto build = after.find(" ") != std::string::npos ? after.substr(after.find(" ")) + : ""; + raw_match_spec_str = before + ">=" + version + "," + version_without_last_segment + ".*" + + build; + } + auto parse_error = [&raw_match_spec_str](std::string_view err) -> tl::unexpected { return tl::make_unexpected(ParseError( diff --git a/libmamba/tests/src/specs/test_match_spec.cpp b/libmamba/tests/src/specs/test_match_spec.cpp index a90266909f..2c8f94bc3c 100644 --- a/libmamba/tests/src/specs/test_match_spec.cpp +++ b/libmamba/tests/src/specs/test_match_spec.cpp @@ -446,9 +446,28 @@ TEST_SUITE("specs::match_spec") { auto ms = MatchSpec::parse(R"(numpy >1.8,<2|==1.7,!=1.9,~=1.7.1 py34_0)").value(); CHECK_EQ(ms.name().str(), "numpy"); - CHECK_EQ(ms.version().str(), ">1.8,((<2|==1.7),(!=1.9,~=1.7))"); + CHECK_EQ(ms.version().str(), ">1.8,((<2|==1.7),(!=1.9,(>=1.7.1,=1.7)))"); CHECK_EQ(ms.build_string().str(), "py34_0"); - CHECK_EQ(ms.str(), R"ms(numpy[version=">1.8,((<2|==1.7),(!=1.9,~=1.7))",build="py34_0"])ms"); + CHECK_EQ( + ms.str(), + R"ms(numpy[version=">1.8,((<2|==1.7),(!=1.9,(>=1.7.1,=1.7)))",build="py34_0"])ms" + ); + } + + SUBCASE("python-graphviz~=0.20") + { + auto ms = MatchSpec::parse("python-graphviz~=0.20").value(); + CHECK_EQ(ms.name().str(), "python-graphviz"); + CHECK_EQ(ms.version().str(), ">=0.20,=0"); + CHECK_EQ(ms.str(), R"ms(python-graphviz[version=">=0.20,=0"])ms"); + } + + SUBCASE("python-graphviz ~= 0.20") + { + auto ms = MatchSpec::parse("python-graphviz ~= 0.20").value(); + CHECK_EQ(ms.name().str(), "python-graphviz"); + CHECK_EQ(ms.version().str(), ">=0.20,=0"); + CHECK_EQ(ms.str(), R"ms(python-graphviz[version=">=0.20,=0"])ms"); } SUBCASE("*[md5=fewjaflknd]") diff --git a/micromamba/tests/test_install.py b/micromamba/tests/test_install.py index 48c9e518bc..67800cb894 100644 --- a/micromamba/tests/test_install.py +++ b/micromamba/tests/test_install.py @@ -4,6 +4,7 @@ import subprocess import sys from pathlib import Path +from packaging.version import Version import pytest @@ -633,6 +634,14 @@ def test_force_reinstall_not_installed(self, existing_cache): reinstall_res = helpers.install("xtensor", "--force-reinstall", "--json") assert "xtensor" in {pkg["name"] for pkg in reinstall_res["actions"]["LINK"]} + def test_install_compatible_release(self, existing_cache): + """Install compatible release.""" + res = helpers.install("numpy~=1.26.0", "--force-reinstall", "--json") + assert "numpy" in {pkg["name"] for pkg in res["actions"]["LINK"]} + + numpy = [pkg for pkg in res["actions"]["LINK"] if pkg["name"] == "numpy"][0] + assert Version(numpy["version"]) >= Version("1.26.0") + def test_install_check_dirs(tmp_home, tmp_root_prefix): env_name = "myenv" From b23a07956ac8b68856c0c97d498b32b97f2c1038 Mon Sep 17 00:00:00 2001 From: Johan Mabille Date: Mon, 30 Sep 2024 19:28:04 +0200 Subject: [PATCH 058/126] --full-name option for list (#3485) Added --full-name option to the list command --- libmamba/include/mamba/api/list.hpp | 6 ++-- libmamba/src/api/list.cpp | 48 ++++++++++++++++++++--------- micromamba/src/list.cpp | 11 +++++++ micromamba/tests/test_list.py | 13 ++++++++ 4 files changed, 61 insertions(+), 17 deletions(-) diff --git a/libmamba/include/mamba/api/list.hpp b/libmamba/include/mamba/api/list.hpp index fd055df2a5..bd4245321d 100644 --- a/libmamba/include/mamba/api/list.hpp +++ b/libmamba/include/mamba/api/list.hpp @@ -17,14 +17,16 @@ namespace mamba void list(Configuration& config, const std::string& regex); - namespace detail + /*namespace detail { + struct list_options; + void list_packages(const Context& ctx, std::string regex, ChannelContext& channel_context); struct formatted_pkg; bool compare_alphabetically(const formatted_pkg& a, const formatted_pkg& b); - } + }*/ } #endif diff --git a/libmamba/src/api/list.cpp b/libmamba/src/api/list.cpp index b79a02de45..28006b2c65 100644 --- a/libmamba/src/api/list.cpp +++ b/libmamba/src/api/list.cpp @@ -15,24 +15,15 @@ namespace mamba { - void list(Configuration& config, const std::string& regex) - { - config.at("use_target_prefix_fallback").set_value(true); - config.at("use_default_prefix_fallback").set_value(true); - config.at("use_root_prefix_fallback").set_value(true); - config.at("target_prefix_checks") - .set_value( - MAMBA_ALLOW_EXISTING_PREFIX | MAMBA_ALLOW_MISSING_PREFIX - | MAMBA_NOT_ALLOW_NOT_ENV_PREFIX | MAMBA_EXPECT_EXISTING_PREFIX - ); - config.load(); - auto channel_context = ChannelContext::make_conda_compatible(config.context()); - detail::list_packages(config.context(), regex, channel_context); - } namespace detail { + struct list_options + { + bool full_name; + }; + struct formatted_pkg { std::string name, version, build, channel; @@ -43,7 +34,12 @@ namespace mamba return a.name < b.name; } - void list_packages(const Context& ctx, std::string regex, ChannelContext& channel_context) + void list_packages( + const Context& ctx, + std::string regex, + ChannelContext& channel_context, + list_options options + ) { auto sprefix_data = PrefixData::create(ctx.prefix_params.target_prefix, channel_context); if (!sprefix_data) @@ -53,6 +49,10 @@ namespace mamba } PrefixData& prefix_data = sprefix_data.value(); + if (options.full_name) + { + regex = '^' + regex + '$'; + } std::regex spec_pat(regex); if (ctx.output_params.json) @@ -145,4 +145,22 @@ namespace mamba t.print(std::cout); } } + + void list(Configuration& config, const std::string& regex) + { + config.at("use_target_prefix_fallback").set_value(true); + config.at("use_default_prefix_fallback").set_value(true); + config.at("use_root_prefix_fallback").set_value(true); + config.at("target_prefix_checks") + .set_value( + MAMBA_ALLOW_EXISTING_PREFIX | MAMBA_ALLOW_MISSING_PREFIX + | MAMBA_NOT_ALLOW_NOT_ENV_PREFIX | MAMBA_EXPECT_EXISTING_PREFIX + ); + config.load(); + + detail::list_options options; + options.full_name = config.at("full_name").value(); + auto channel_context = ChannelContext::make_conda_compatible(config.context()); + detail::list_packages(config.context(), regex, channel_context, std::move(options)); + } } diff --git a/micromamba/src/list.cpp b/micromamba/src/list.cpp index 0023bbf4ad..aeeb7a995d 100644 --- a/micromamba/src/list.cpp +++ b/micromamba/src/list.cpp @@ -22,6 +22,17 @@ init_list_parser(CLI::App* subcom, Configuration& config) .group("cli") .description("List only packages matching a regular expression")); subcom->add_option("regex", regex.get_cli_config(), regex.description()); + + auto& full_name = config.insert(Configurable("full_name", false) + .group("cli") + .description("Only search for full names, i.e., ^$.")); + subcom->add_flag("-f,--full-name", full_name.get_cli_config(), full_name.description()); + + // TODO: implement this in libmamba/list.cpp + /*auto& canonical = config.insert(Configurable("canonical", false) + .group("cli") + .description("Output canonical names of packages only.")); + subcom->add_flag("-c,--canonical", canonical.get_cli_config(), canonical.description());*/ } void diff --git a/micromamba/tests/test_list.py b/micromamba/tests/test_list.py index ce10222ce5..91d80b9096 100644 --- a/micromamba/tests/test_list.py +++ b/micromamba/tests/test_list.py @@ -23,6 +23,19 @@ def test_list(tmp_home, tmp_root_prefix, tmp_env_name, tmp_xtensor_env, env_sele assert "xtl" in names +@pytest.mark.parametrize("quiet_flag", ["", "-q", "--quiet"]) +@pytest.mark.parametrize("shared_pkgs_dirs", [True], indirect=True) +def test_list_name(tmp_home, tmp_root_prefix, tmp_xtensor_env, quiet_flag): + helpers.install("xtensor-python") + res = helpers.umamba_list("xt", "--json", quiet_flag) + names = sorted([i["name"] for i in res]) + assert names == ["xtensor", "xtensor-python", "xtl"] + + full_res = helpers.umamba_list("xtensor", "--full-name", "--json", quiet_flag) + full_names = sorted([i["name"] for i in full_res]) + assert full_names == ["xtensor"] + + @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): From f8bfd115df85063b2756c979d293863ef7961ac5 Mon Sep 17 00:00:00 2001 From: Johan Mabille Date: Mon, 30 Sep 2024 21:49:44 +0200 Subject: [PATCH 059/126] Fixed channel output in umamba list (#3486) Fixed channel output in umamba list --- libmamba/src/api/list.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/libmamba/src/api/list.cpp b/libmamba/src/api/list.cpp index 28006b2c65..f28594e114 100644 --- a/libmamba/src/api/list.cpp +++ b/libmamba/src/api/list.cpp @@ -73,13 +73,17 @@ namespace mamba if (regex.empty() || std::regex_search(pkg_info.name, spec_pat)) { - auto channels = channel_context.make_channel(pkg_info.package_url); - assert(channels.size() == 1); // A URL can only resolve to one channel - obj["base_url"] = channels.front().url().str(specs::CondaURL::Credentials::Remove + auto display_channels = channel_context.make_channel(pkg_info.channel); + auto url_channels = channel_context.make_channel(pkg_info.package_url); + assert(display_channels.size() == 1); // A URL can only resolve to one + // channel + assert(url_channels.size() == 1); // A URL can only resolve to one channel + obj["base_url"] = url_channels.front().url().str( + specs::CondaURL::Credentials::Remove ); obj["build_number"] = pkg_info.build_number; obj["build_string"] = pkg_info.build_string; - obj["channel"] = channels.front().display_name(); + obj["channel"] = display_channels.front().display_name(); obj["dist_name"] = pkg_info.str(); obj["name"] = pkg_info.name; obj["platform"] = pkg_info.platform; @@ -113,7 +117,7 @@ namespace mamba } else { - auto channels = channel_context.make_channel(package.second.package_url); + auto channels = channel_context.make_channel(package.second.channel); assert(channels.size() == 1); // A URL can only resolve to one channel formatted_pkgs.channel = channels.front().display_name(); } From 9fc7b99ea32daaf3019416e0a42141b23923fd82 Mon Sep 17 00:00:00 2001 From: Johan Mabille Date: Mon, 30 Sep 2024 22:05:50 +0200 Subject: [PATCH 060/126] release libmamba 2.0.1, libmambapy 2.0.1, micromamba 2.0.1 --- CHANGELOG.md | 17 +++++++++++++++++ libmamba/CHANGELOG.md | 14 ++++++++++++++ libmamba/include/mamba/version.hpp | 2 +- libmambapy/CHANGELOG.md | 8 ++++++++ libmambapy/src/libmambapy/version.py | 2 +- micromamba/CHANGELOG.md | 13 +++++++++++++ micromamba/src/version.hpp | 2 +- 7 files changed, 55 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c5ec295a93..fc798e6efd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,20 @@ +2024.09.30 +========== + +Releases: libmamba 2.0.1, libmambapy 2.0.1, micromamba 2.0.1 + +Bug fixes: + +- [libmamba] Fixed channel output in umamba list by @JohanMabille in https://github.com/mamba-org/mamba/pull/3486 +- [libmamba, micromamba] --full-name option for list by @JohanMabille in https://github.com/mamba-org/mamba/pull/3485 +- [libmamba, micromamba] fix: Support for PEP 440 "Compatible Releases" (operator `~=` for `MatchSpec`) by @jjerphan in https://github.com/mamba-org/mamba/pull/3483 +- [libmamba] Fix micromamba activate on Windows by @JohanMabille in https://github.com/mamba-org/mamba/pull/3484 +- [micromamba] Added --copy flag to create and install commands by @JohanMabille in https://github.com/mamba-org/mamba/pull/3474 + +CI fixes and doc: + +- [all] doc: add github links to documentation by @timhoffm in https://github.com/mamba-org/mamba/pull/3471 + 2024.09.25 ========== diff --git a/libmamba/CHANGELOG.md b/libmamba/CHANGELOG.md index b9d8faad56..96014d93b7 100644 --- a/libmamba/CHANGELOG.md +++ b/libmamba/CHANGELOG.md @@ -1,3 +1,17 @@ +libmamba 2.0.1 (September 30, 2024) +=================================== + +Bug fixes: + +- Fixed channel output in umamba list by @JohanMabille in https://github.com/mamba-org/mamba/pull/3486 +- --full-name option for list by @JohanMabille in https://github.com/mamba-org/mamba/pull/3485 +- fix: Support for PEP 440 "Compatible Releases" (operator `~=` for `MatchSpec`) by @jjerphan in https://github.com/mamba-org/mamba/pull/3483 +- Fix micromamba activate on Windows by @JohanMabille in https://github.com/mamba-org/mamba/pull/3484 + +CI fixes and doc: + +- doc: add github links to documentation by @timhoffm in https://github.com/mamba-org/mamba/pull/3471 + libmamba 2.0.0 (September 25, 2024) =================================== diff --git a/libmamba/include/mamba/version.hpp b/libmamba/include/mamba/version.hpp index bba4d8c026..6412d77150 100644 --- a/libmamba/include/mamba/version.hpp +++ b/libmamba/include/mamba/version.hpp @@ -12,7 +12,7 @@ #define LIBMAMBA_VERSION_MAJOR 2 #define LIBMAMBA_VERSION_MINOR 0 -#define LIBMAMBA_VERSION_PATCH 0 +#define LIBMAMBA_VERSION_PATCH 1 // Binary version #define LIBMAMBA_BINARY_CURRENT 2 diff --git a/libmambapy/CHANGELOG.md b/libmambapy/CHANGELOG.md index 82f31ce078..028ac1bfa3 100644 --- a/libmambapy/CHANGELOG.md +++ b/libmambapy/CHANGELOG.md @@ -1,3 +1,11 @@ +libmambapy 2.0.1 (September 30, 2024) +===================================== + + +CI fixes and doc: + +- doc: add github links to documentation by @timhoffm in https://github.com/mamba-org/mamba/pull/3471 + libmambapy 2.0.0 (September 25, 2024) ===================================== diff --git a/libmambapy/src/libmambapy/version.py b/libmambapy/src/libmambapy/version.py index f65c5ee9e4..b6c59f463b 100644 --- a/libmambapy/src/libmambapy/version.py +++ b/libmambapy/src/libmambapy/version.py @@ -1,2 +1,2 @@ -version_info = ("2", "0", "0") +version_info = ("2", "0", "1") __version__ = ".".join(map(str, version_info)) diff --git a/micromamba/CHANGELOG.md b/micromamba/CHANGELOG.md index 423e9bd1a6..65c9327557 100644 --- a/micromamba/CHANGELOG.md +++ b/micromamba/CHANGELOG.md @@ -1,3 +1,16 @@ +micromamba 2.0.1 (September 30, 2024) +===================================== + +Bug fixes: + +- --full-name option for list by @JohanMabille in https://github.com/mamba-org/mamba/pull/3485 +- fix: Support for PEP 440 "Compatible Releases" (operator `~=` for `MatchSpec`) by @jjerphan in https://github.com/mamba-org/mamba/pull/3483 +- Added --copy flag to create and install commands by @JohanMabille in https://github.com/mamba-org/mamba/pull/3474 + +CI fixes and doc: + +- doc: add github links to documentation by @timhoffm in https://github.com/mamba-org/mamba/pull/3471 + micromamba 2.0.0 (September 25, 2024) ===================================== diff --git a/micromamba/src/version.hpp b/micromamba/src/version.hpp index 2658edab30..60ff70a4cc 100644 --- a/micromamba/src/version.hpp +++ b/micromamba/src/version.hpp @@ -12,7 +12,7 @@ #define UMAMBA_VERSION_MAJOR 2 #define UMAMBA_VERSION_MINOR 0 -#define UMAMBA_VERSION_PATCH 0 +#define UMAMBA_VERSION_PATCH 1 // Binary version #define UMAMBA_BINARY_CURRENT 1 From 0b97555fbc5085dc50cc70be42796090ad8a2e33 Mon Sep 17 00:00:00 2001 From: Johan Mabille Date: Wed, 2 Oct 2024 12:51:06 +0200 Subject: [PATCH 061/126] Rollback to micromamba 1.5.10 in CI (#3491) --- .github/workflows/unix_impl.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/unix_impl.yml b/.github/workflows/unix_impl.yml index 14614bfd07..8fc78a8931 100644 --- a/.github/workflows/unix_impl.yml +++ b/.github/workflows/unix_impl.yml @@ -25,6 +25,7 @@ jobs: - name: Create build environment uses: mamba-org/setup-micromamba@v1 with: + micromamba-version: '1.5.10-0' environment-file: ./dev/environment-dev.yml environment-name: build_env cache-environment: true @@ -72,6 +73,7 @@ jobs: - name: Create build environment uses: mamba-org/setup-micromamba@v1 with: + micromamba-version: '1.5.10-0' environment-file: ./build/environment.lock environment-name: build_env - name: Run solv-cpp tests @@ -98,6 +100,7 @@ jobs: - name: Create build environment uses: mamba-org/setup-micromamba@v1 with: + micromamba-version: '1.5.10-0' environment-file: ./build/environment.lock environment-name: build_env - name: Install libmambapy @@ -125,6 +128,7 @@ jobs: - name: Create build environment uses: mamba-org/setup-micromamba@v1 with: + micromamba-version: '1.5.10-0' environment-file: ./build/environment.lock environment-name: build_env - name: install zsh, xonsh, fish and tcsh in linux @@ -182,6 +186,7 @@ jobs: - name: Create build environment uses: mamba-org/setup-micromamba@v1 with: + micromamba-version: '1.5.10-0' environment-file: ./build/environment.lock environment-name: build_env - name: Run tests using conda-content-trust (server side) From 45c437a3c8b4e92539f397c09d9322ed0082fd3e Mon Sep 17 00:00:00 2001 From: Hind-M <70631848+Hind-M@users.noreply.github.com> Date: Wed, 2 Oct 2024 14:01:07 +0200 Subject: [PATCH 062/126] Fix `channel` and `base_url` in `list` cmd (#3488) * Fix channel and base_url in list cmd * Add func * Fix oci tests --- docs/source/developer_zone/changes-2.0.rst | 4 +- libmamba/src/api/list.cpp | 51 ++++++++++++++++++---- micromamba/tests/test_create.py | 20 ++++----- micromamba/tests/test_list.py | 4 ++ 4 files changed, 56 insertions(+), 23 deletions(-) diff --git a/docs/source/developer_zone/changes-2.0.rst b/docs/source/developer_zone/changes-2.0.rst index ee520c6439..bf92cfd8b9 100644 --- a/docs/source/developer_zone/changes-2.0.rst +++ b/docs/source/developer_zone/changes-2.0.rst @@ -185,5 +185,5 @@ Listing packages in the created ``pandoc_from_oci`` environment: $ micromamba list -n pandoc_from_oci Name Version Build Channel - ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────── - pandoc 3.2 ha770c72_0 https://pkg-containers.githubusercontent.com/ghcr1/blobs/pandoc-3.2-ha770c72_0.conda + ───────────────────────────────────────────────────────────────────────────────────── + pandoc 3.2 ha770c72_0 https://pkg-containers.githubusercontent.com/ghcr1/blobs diff --git a/libmamba/src/api/list.cpp b/libmamba/src/api/list.cpp index f28594e114..277de0646c 100644 --- a/libmamba/src/api/list.cpp +++ b/libmamba/src/api/list.cpp @@ -12,6 +12,7 @@ #include "mamba/core/channel_context.hpp" #include "mamba/core/context.hpp" #include "mamba/core/prefix_data.hpp" +#include "mamba/util/string.hpp" namespace mamba { @@ -34,6 +35,31 @@ namespace mamba return a.name < b.name; } + // This is more or less an implementation of `util::rstrip` specific to this use case + // (for printing purposes), but using `std::string` instead of `std::string_view` + // `util::rstrip` is not used here because it leads to an UB, + // `using non owned/tracked strings from Channel (& co) and PackageInfo + std::string rstrip(const std::string& full_str, const std::string& sub_str) + { + if (util::ends_with(full_str, sub_str)) + { + return full_str.substr(0, full_str.length() - sub_str.length()); + } + else + { + return full_str; + } + } + + std::string strip_from_filename_and_platform( + const std::string& full_str, + const std::string& filename, + const std::string& platform + ) + { + return rstrip(rstrip(rstrip(rstrip(full_str, filename), "/"), platform), "/"); + } + void list_packages( const Context& ctx, std::string regex, @@ -73,17 +99,20 @@ namespace mamba if (regex.empty() || std::regex_search(pkg_info.name, spec_pat)) { - auto display_channels = channel_context.make_channel(pkg_info.channel); - auto url_channels = channel_context.make_channel(pkg_info.package_url); - assert(display_channels.size() == 1); // A URL can only resolve to one - // channel - assert(url_channels.size() == 1); // A URL can only resolve to one channel - obj["base_url"] = url_channels.front().url().str( - specs::CondaURL::Credentials::Remove + auto channels = channel_context.make_channel(pkg_info.package_url); + assert(channels.size() == 1); // A URL can only resolve to one channel + obj["base_url"] = strip_from_filename_and_platform( + channels.front().url().str(specs::CondaURL::Credentials::Remove), + pkg_info.filename, + pkg_info.platform ); obj["build_number"] = pkg_info.build_number; obj["build_string"] = pkg_info.build_string; - obj["channel"] = display_channels.front().display_name(); + obj["channel"] = strip_from_filename_and_platform( + channels.front().display_name(), + pkg_info.filename, + pkg_info.platform + ); obj["dist_name"] = pkg_info.str(); obj["name"] = pkg_info.name; obj["platform"] = pkg_info.platform; @@ -119,7 +148,11 @@ namespace mamba { auto channels = channel_context.make_channel(package.second.channel); assert(channels.size() == 1); // A URL can only resolve to one channel - formatted_pkgs.channel = channels.front().display_name(); + formatted_pkgs.channel = strip_from_filename_and_platform( + channels.front().display_name(), + package.second.filename, + package.second.platform + ); } packages.push_back(formatted_pkgs); } diff --git a/micromamba/tests/test_create.py b/micromamba/tests/test_create.py index c396b8b154..e4a1fc310a 100644 --- a/micromamba/tests/test_create.py +++ b/micromamba/tests/test_create.py @@ -1231,9 +1231,8 @@ def test_create_from_oci_mirrored_channels(tmp_home, tmp_root_prefix, tmp_path, assert pkg["name"] == "pandoc" if spec == "pandoc=3.1.13": assert pkg["version"] == "3.1.13" - assert pkg["base_url"].startswith( - "https://pkg-containers.githubusercontent.com/ghcr1/blobs/pandoc" - ) + assert pkg["base_url"] == "https://pkg-containers.githubusercontent.com/ghcr1/blobs" + assert pkg["channel"] == "https://pkg-containers.githubusercontent.com/ghcr1/blobs" @pytest.mark.parametrize("shared_pkgs_dirs", [True], indirect=True) @@ -1261,16 +1260,14 @@ def test_create_from_oci_mirrored_channels_with_deps(tmp_home, tmp_root_prefix, assert len(packages) > 2 assert any( package["name"] == "xtensor" - and package["base_url"].startswith( - "https://pkg-containers.githubusercontent.com/ghcr1/blobs/xtensor" - ) + and package["base_url"] == "https://pkg-containers.githubusercontent.com/ghcr1/blobs" + and package["channel"] == "https://pkg-containers.githubusercontent.com/ghcr1/blobs" for package in packages ) assert any( package["name"] == "xtl" - and package["base_url"].startswith( - "https://pkg-containers.githubusercontent.com/ghcr1/blobs/xtl" - ) + and package["base_url"] == "https://pkg-containers.githubusercontent.com/ghcr1/blobs" + and package["channel"] == "https://pkg-containers.githubusercontent.com/ghcr1/blobs" for package in packages ) @@ -1304,9 +1301,8 @@ def test_create_from_oci_mirrored_channels_pkg_name_mapping( assert len(packages) == 1 pkg = packages[0] assert pkg["name"] == "_go_select" - assert pkg["base_url"].startswith( - "https://pkg-containers.githubusercontent.com/ghcr1/blobs/_go_select" - ) + assert pkg["base_url"] == "https://pkg-containers.githubusercontent.com/ghcr1/blobs" + assert pkg["channel"] == "https://pkg-containers.githubusercontent.com/ghcr1/blobs" @pytest.mark.parametrize("shared_pkgs_dirs", [True], indirect=True) diff --git a/micromamba/tests/test_list.py b/micromamba/tests/test_list.py index 91d80b9096..1865ed7dab 100644 --- a/micromamba/tests/test_list.py +++ b/micromamba/tests/test_list.py @@ -21,6 +21,10 @@ def test_list(tmp_home, tmp_root_prefix, tmp_env_name, tmp_xtensor_env, env_sele names = [i["name"] for i in res] assert "xtensor" in names assert "xtl" in names + assert all( + i["channel"] == "conda-forge" and i["base_url"] == "https://conda.anaconda.org/conda-forge" + for i in res + ) @pytest.mark.parametrize("quiet_flag", ["", "-q", "--quiet"]) From d162759107934d1492cfc2bece21c8d17d73e2ac Mon Sep 17 00:00:00 2001 From: Johan Mabille Date: Wed, 2 Oct 2024 15:06:53 +0200 Subject: [PATCH 063/126] Win activate (#3489) * Fixed activation scripts for cmd.exe * Fixed get_PATH on Windows * linter --- libmamba/data/activate.bat | 12 +----------- libmamba/data/mamba_hook.bat | 16 +++++----------- libmamba/src/core/activation.cpp | 18 ++++++++++++------ libmamba/src/core/shell_init.cpp | 19 ++++++++++++++----- 4 files changed, 32 insertions(+), 33 deletions(-) diff --git a/libmamba/data/activate.bat b/libmamba/data/activate.bat index eb52a9eb5f..0b63e3ee9b 100644 --- a/libmamba/data/activate.bat +++ b/libmamba/data/activate.bat @@ -2,14 +2,4 @@ @REM SPDX-License-Identifier: BSD-3-Clause @CALL "%~dp0..\condabin\mamba_hook.bat" - -@REM Replaced by mamba executable with the MAMBA_EXE variable pointing to the correct location. -__MAMBA_INSERT_MAMBA_EXE__ - -@REM We need to know the name of the executable, either mamba or micromamba -@REM Get the base filename of MAMBA_EXE -@FOR %%A in ("%MAMBA_EXE%") do set "__mamba_filename=%%~nxA" -@REM Remove .exe extension from the filename -@SET "__mamba_name=!__mamba_filename:%~x1=!" - -!__mamba_name! activate %* +__MAMBA_INSERT_EXE_NAME__ activate %* diff --git a/libmamba/data/mamba_hook.bat b/libmamba/data/mamba_hook.bat index 7a635f1a1e..0c314eca81 100644 --- a/libmamba/data/mamba_hook.bat +++ b/libmamba/data/mamba_hook.bat @@ -13,15 +13,9 @@ __MAMBA_INSERT_MAMBA_EXE__ @SET __mambabin_dir= @SET __mamba_root= -@echo off -@REM We need to define an alias with the same name as the executable to be called by the user. -@REM Get the base filename of MAMBA_EXE -@FOR %%A in ("%MAMBA_EXE%") do ( - @set "__mamba_filename=%%~nxA" - @REM Remove .exe extension from the filename - @SET "__mamba_name=!__mamba_filename:%~x1=!" - @REM Define correct alias depending on the executable name - @set "__mamba_cmd=call ""%MAMBA_BAT%"" $*" - @DOSKEY !__mamba_name!=!__mamba_cmd! -) +@REM @DOSKEY does not work with delayed evaluation +@REM @DOSKEY after the first usage of a macro whose name is defined with a variable +@REM Therefore no magic here, just grep and replace when generating the final file +@DOSKEY __MAMBA_INSERT_EXE_NAME__="%MAMBA_BAT%" $* + @SET CONDA_SHLVL=0 diff --git a/libmamba/src/core/activation.cpp b/libmamba/src/core/activation.cpp index 0e4039601f..f18485bab3 100644 --- a/libmamba/src/core/activation.cpp +++ b/libmamba/src/core/activation.cpp @@ -228,13 +228,20 @@ namespace mamba std::vector Activator::get_PATH() { std::vector path; + std::vector strings{}; + if (m_env.find("PATH") != m_env.end()) { - auto strings = util::split(m_env["PATH"], util::pathsep()); - for (auto& s : strings) - { - path.push_back(s); - } + strings = util::split(m_env["PATH"], util::pathsep()); + } + // On Windows, the variable can be Path and not PATH + else if (m_env.find("Path") != m_env.end()) + { + strings = util::split(m_env["Path"], util::pathsep()); + } + for (auto& s : strings) + { + path.push_back(s); } return path; } @@ -267,7 +274,6 @@ namespace mamba std::vector final_path = get_path_dirs(prefix); final_path.insert(final_path.end(), path_list.begin(), path_list.end()); final_path.erase(std::unique(final_path.begin(), final_path.end()), final_path.end()); - std::string result = util::join(util::pathsep(), final_path).string(); return result; } diff --git a/libmamba/src/core/shell_init.cpp b/libmamba/src/core/shell_init.cpp index bffe508eb7..d4d6744d92 100644 --- a/libmamba/src/core/shell_init.cpp +++ b/libmamba/src/core/shell_init.cpp @@ -686,6 +686,7 @@ namespace mamba void init_root_prefix_cmdexe(const Context&, const fs::u8path& root_prefix) { fs::u8path exe = get_self_exe_path(); + fs::u8path exe_name = exe.stem(); try { @@ -697,7 +698,7 @@ namespace mamba // Maybe the prefix isn't writable. No big deal, just keep going. } - std::ofstream mamba_bat_f = open_ofstream(root_prefix / "condabin" / "mamba.bat"); + // mamba.bat std::string mamba_bat_contents(data_mamba_bat); util::replace_all( mamba_bat_contents, @@ -709,14 +710,16 @@ namespace mamba std::string("__MAMBA_INSERT_MAMBA_EXE__"), "@SET \"MAMBA_EXE=" + exe.string() + "\"" ); - + std::ofstream mamba_bat_f = open_ofstream(root_prefix / "condabin" / "mamba.bat"); mamba_bat_f << mamba_bat_contents; + + // _mamba_activate.bat std::ofstream _mamba_activate_bat_f = open_ofstream( root_prefix / "condabin" / "_mamba_activate.bat" ); _mamba_activate_bat_f << data__mamba_activate_bat; - + // condabin/activate.bat std::string activate_bat_contents(data_activate_bat); util::replace_all( activate_bat_contents, @@ -728,22 +731,28 @@ namespace mamba std::string("__MAMBA_INSERT_MAMBA_EXE__"), "@SET \"MAMBA_EXE=" + exe.string() + "\"" ); - - + util::replace_all( + activate_bat_contents, + std::string("__MAMBA_INSERT_EXE_NAME__"), + exe_name.string() + ); std::ofstream condabin_activate_bat_f = open_ofstream( root_prefix / "condabin" / "activate.bat" ); condabin_activate_bat_f << activate_bat_contents; + // Scripts/activate.bat std::ofstream scripts_activate_bat_f = open_ofstream(root_prefix / "Scripts" / "activate.bat"); scripts_activate_bat_f << activate_bat_contents; + // mamba_hook.bat std::string hook_content = data_mamba_hook_bat; util::replace_all( hook_content, std::string("__MAMBA_INSERT_MAMBA_EXE__"), "@SET \"MAMBA_EXE=" + exe.string() + "\"" ); + util::replace_all(hook_content, std::string("__MAMBA_INSERT_EXE_NAME__"), exe_name.string()); std::ofstream mamba_hook_bat_f = open_ofstream(root_prefix / "condabin" / "mamba_hook.bat"); mamba_hook_bat_f << hook_content; From b7367417f731f6f8cc26cfa74eddd2d7488dff6f Mon Sep 17 00:00:00 2001 From: Julien Jerphanion Date: Wed, 2 Oct 2024 17:21:57 +0200 Subject: [PATCH 064/126] fix: Handle `MatchSpec` with brackets when parsing environments' history (#3490) * fix: Adapt `parse_comment_line` to handle more `MatchSpec` Signed-off-by: Julien Jerphanion * test: Add non-regression python test Signed-off-by: Julien Jerphanion * test: Add non-regression C++ test Signed-off-by: Julien Jerphanion * Apply review comments Signed-off-by: Julien Jerphanion Co-authored-by: Johan Mabille * test: Skip test on Windows Signed-off-by: Julien Jerphanion --------- Signed-off-by: Julien Jerphanion Co-authored-by: Johan Mabille --- libmamba/src/core/history.cpp | 38 ++++++++++++++++ .../history/parse_metadata/conda-meta/history | 44 +++++++++++++++++++ libmamba/tests/src/core/test_history.cpp | 12 +++++ micromamba/tests/test_create.py | 15 +++++++ 4 files changed, 109 insertions(+) create mode 100644 libmamba/tests/data/history/parse_metadata/conda-meta/history diff --git a/libmamba/src/core/history.cpp b/libmamba/src/core/history.cpp index 1bdc2faa2e..6a2e44488c 100644 --- a/libmamba/src/core/history.cpp +++ b/libmamba/src/core/history.cpp @@ -126,12 +126,50 @@ namespace mamba { needle[0] = value[idx_start]; idx_end = value.find_first_of(needle.c_str(), idx_search); + + // Capturing `MatchSpecs` without internal quotes (e.g `libcurl`) if (idx_end != std::string::npos && value[idx_end - 1] != '\\') { pkg_specs.push_back(value.substr(idx_start + 1, idx_end - 1 - idx_start)); idx_start = value.find_first_of("\'\"", idx_end + 1); idx_search = idx_start + 1; } + // Capturing `MatchSpecs` with metadata (e.g `libcurl[version=\">=7.86,<8.10\"]`) + else if (idx_end != std::string::npos && value[idx_end - 1] == '\\') + { + // Find if "[" is present in between idx_search and idx_end + auto idx_bracket = value.find_first_of("[", idx_search); + + // If "[" is present, then find the closing bracket + if (idx_bracket != std::string::npos && idx_bracket < idx_end) + { + auto idx_closing_bracket = value.find_first_of("]", idx_bracket); + if (idx_closing_bracket != std::string::npos) + { + auto start_string = idx_start + 1; + auto end_string = idx_closing_bracket + 1; + auto len_matchspec = end_string - start_string; + + // Quotes are excluded (e.g. `libcurl[version=\">=7.86,<8.10\"]` is + // extracted from `"libcurl[version=\">=7.86,<8.10\"]"`) + auto match_spec = value.substr(start_string, len_matchspec); + // Remove the backslash from the MatchSpec + match_spec.erase( + std::remove(match_spec.begin(), match_spec.end(), '\\'), + match_spec.end() + ); + pkg_specs.push_back(std::move(match_spec)); + idx_start = value.find_first_of("\'\"", end_string + 1); + idx_search = idx_start + 1; + } + } + // If "[" is not present, then there's a problem with the MatchSpec + else if (idx_bracket == std::string::npos || idx_bracket > idx_end) + { + throw std::runtime_error("Parsing of history file failed at: " + value); + } + } + else { idx_search = idx_end; diff --git a/libmamba/tests/data/history/parse_metadata/conda-meta/history b/libmamba/tests/data/history/parse_metadata/conda-meta/history new file mode 100644 index 0000000000..41a2c0472f --- /dev/null +++ b/libmamba/tests/data/history/parse_metadata/conda-meta/history @@ -0,0 +1,44 @@ +==> 2024-10-02 12:29:11 <== +# cmd: micromamba create -n repro2 pandas[version=">=0.25.2,<3"] +# conda version: 3.8.0 ++conda-forge::_libgcc_mutex-0.1-conda_forge ++conda-forge::python_abi-3.12-5_cp312 ++conda-forge::ca-certificates-2024.8.30-hbcca054_0 ++conda-forge::ld_impl_linux-64-2.43-h712a8e2_1 ++conda-forge::libgomp-14.1.0-h77fa898_1 ++conda-forge::_openmp_mutex-4.5-2_gnu ++conda-forge::libgcc-14.1.0-h77fa898_1 ++conda-forge::libgfortran5-14.1.0-hc5f4f2c_1 ++conda-forge::libgcc-ng-14.1.0-h69a702a_1 ++conda-forge::openssl-3.3.2-hb9d3cd8_0 ++conda-forge::libexpat-2.6.3-h5888daf_0 ++conda-forge::libstdcxx-14.1.0-hc0a3c3a_1 ++conda-forge::libgfortran-14.1.0-h69a702a_1 ++conda-forge::libffi-3.4.2-h7f98852_5 ++conda-forge::libxcrypt-4.4.36-hd590300_1 ++conda-forge::bzip2-1.0.8-h4bc722e_7 ++conda-forge::ncurses-6.5-he02047a_1 ++conda-forge::libzlib-1.3.1-h4ab18f5_1 ++conda-forge::xz-5.2.6-h166bdaf_0 ++conda-forge::libuuid-2.38.1-h0b41bf4_0 ++conda-forge::libnsl-2.0.1-hd590300_0 ++conda-forge::libgfortran-ng-14.1.0-h69a702a_1 ++conda-forge::readline-8.2-h8228510_1 ++conda-forge::tk-8.6.13-noxft_h4845f30_101 ++conda-forge::libsqlite-3.46.1-hadc24fc_0 ++conda-forge::libopenblas-0.3.27-pthreads_hac2b453_1 ++conda-forge::libblas-3.9.0-24_linux64_openblas ++conda-forge::libcblas-3.9.0-24_linux64_openblas ++conda-forge::liblapack-3.9.0-24_linux64_openblas ++conda-forge::tzdata-2024a-h8827d51_1 ++conda-forge::python-3.12.6-hc5c86c4_2_cpython ++conda-forge::wheel-0.44.0-pyhd8ed1ab_0 ++conda-forge::setuptools-75.1.0-pyhd8ed1ab_0 ++conda-forge::pip-24.2-pyh8b19718_1 ++conda-forge::six-1.16.0-pyh6c4a22f_0 ++conda-forge::pytz-2024.1-pyhd8ed1ab_0 ++conda-forge::python-tzdata-2024.2-pyhd8ed1ab_0 ++conda-forge::python-dateutil-2.9.0-pyhd8ed1ab_0 ++conda-forge::numpy-2.1.1-py312h58c1407_0 ++conda-forge::pandas-2.2.3-py312hf9745cd_1 +# update specs: ["pandas[version=\">=0.25.2,<3\"]"] diff --git a/libmamba/tests/src/core/test_history.cpp b/libmamba/tests/src/core/test_history.cpp index 429c2468cf..4666dc84ff 100644 --- a/libmamba/tests/src/core/test_history.cpp +++ b/libmamba/tests/src/core/test_history.cpp @@ -93,6 +93,18 @@ namespace mamba REQUIRE_EQ(updated_history_buffer.str(), check_buffer.str()); } + TEST_CASE("parse_metadata") + { + auto channel_context = ChannelContext::make_conda_compatible(mambatests::context()); + + History history_instance( + mambatests::test_data_dir / "history/parse_metadata", + channel_context + ); + // Must not throw + std::vector user_reqs = history_instance.get_user_requests(); + } + #ifndef _WIN32 TEST_CASE("parse_segfault") { diff --git a/micromamba/tests/test_create.py b/micromamba/tests/test_create.py index e4a1fc310a..1987a8bcad 100644 --- a/micromamba/tests/test_create.py +++ b/micromamba/tests/test_create.py @@ -1328,3 +1328,18 @@ def test_create_package_with_non_url_char(tmp_home, tmp_root_prefix): res = helpers.create("-n", "myenv", "-c", "conda-forge", "x264>=1!0", "--json") assert any(pkg["name"] == "x264" for pkg in res["actions"]["LINK"]) + + +@pytest.mark.timeout(20) +@pytest.mark.parametrize("shared_pkgs_dirs", [True], indirect=True) +@pytest.mark.skipif( + platform.system() == "Windows", reason="This test fails on Windows for unknown reasons" +) +def test_parsable_env_history_with_metadata(tmp_home, tmp_root_prefix, tmp_path): + env_prefix = tmp_path / "env-micromamba-list" + + res = helpers.create("-p", env_prefix, 'pandas[version=">=0.25.2,<3"]', "--json") + assert res["success"] + + # Must not hang + helpers.umamba_list("-p", env_prefix, "--json") From 31b23473e059b47c03b065e5592ea5a7cf77fc9b Mon Sep 17 00:00:00 2001 From: Johan Mabille Date: Wed, 2 Oct 2024 18:03:58 +0200 Subject: [PATCH 065/126] release libmamba 2.0.2, libmambapy 2.0.2, micromamba 2.0.2 --- CHANGELOG.md | 15 +++++++++++++++ libmamba/CHANGELOG.md | 13 +++++++++++++ libmamba/include/mamba/version.hpp | 2 +- libmambapy/CHANGELOG.md | 8 ++++++++ libmambapy/src/libmambapy/version.py | 2 +- micromamba/CHANGELOG.md | 12 ++++++++++++ micromamba/src/version.hpp | 2 +- 7 files changed, 51 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fc798e6efd..7c20c6f2cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,18 @@ +2024.10.02 +========== + +Releases: libmamba 2.0.2, libmambapy 2.0.2, micromamba 2.0.2 + +Bug fixes: + +- [micromamba, libmamba] fix: Handle `MatchSpec` with brackets when parsing environments' history by @jjerphan in https://github.com/mamba-org/mamba/pull/3490 +- [libmamba] Win activate by @JohanMabille in https://github.com/mamba-org/mamba/pull/3489 +- [micromamba, libmamba] Fix `channel` and `base_url` in `list` cmd by @Hind-M in https://github.com/mamba-org/mamba/pull/3488 + +CI fixes and doc: + +- [all] Rollback to micromamba 1.5.10 in CI by @JohanMabille in https://github.com/mamba-org/mamba/pull/3491 + 2024.09.30 ========== diff --git a/libmamba/CHANGELOG.md b/libmamba/CHANGELOG.md index 96014d93b7..0629d44602 100644 --- a/libmamba/CHANGELOG.md +++ b/libmamba/CHANGELOG.md @@ -1,3 +1,16 @@ +libmamba 2.0.2 (October 02, 2024) +================================= + +Bug fixes: + +- fix: Handle `MatchSpec` with brackets when parsing environments' history by @jjerphan in https://github.com/mamba-org/mamba/pull/3490 +- Win activate by @JohanMabille in https://github.com/mamba-org/mamba/pull/3489 +- Fix `channel` and `base_url` in `list` cmd by @Hind-M in https://github.com/mamba-org/mamba/pull/3488 + +CI fixes and doc: + +- Rollback to micromamba 1.5.10 in CI by @JohanMabille in https://github.com/mamba-org/mamba/pull/3491 + libmamba 2.0.1 (September 30, 2024) =================================== diff --git a/libmamba/include/mamba/version.hpp b/libmamba/include/mamba/version.hpp index 6412d77150..5fc55bdf0e 100644 --- a/libmamba/include/mamba/version.hpp +++ b/libmamba/include/mamba/version.hpp @@ -12,7 +12,7 @@ #define LIBMAMBA_VERSION_MAJOR 2 #define LIBMAMBA_VERSION_MINOR 0 -#define LIBMAMBA_VERSION_PATCH 1 +#define LIBMAMBA_VERSION_PATCH 2 // Binary version #define LIBMAMBA_BINARY_CURRENT 2 diff --git a/libmambapy/CHANGELOG.md b/libmambapy/CHANGELOG.md index 028ac1bfa3..44e12d8df4 100644 --- a/libmambapy/CHANGELOG.md +++ b/libmambapy/CHANGELOG.md @@ -1,3 +1,11 @@ +libmambapy 2.0.2 (October 02, 2024) +=================================== + + +CI fixes and doc: + +- Rollback to micromamba 1.5.10 in CI by @JohanMabille in https://github.com/mamba-org/mamba/pull/3491 + libmambapy 2.0.1 (September 30, 2024) ===================================== diff --git a/libmambapy/src/libmambapy/version.py b/libmambapy/src/libmambapy/version.py index b6c59f463b..b9d07545a4 100644 --- a/libmambapy/src/libmambapy/version.py +++ b/libmambapy/src/libmambapy/version.py @@ -1,2 +1,2 @@ -version_info = ("2", "0", "1") +version_info = ("2", "0", "2") __version__ = ".".join(map(str, version_info)) diff --git a/micromamba/CHANGELOG.md b/micromamba/CHANGELOG.md index 65c9327557..f6e57cac01 100644 --- a/micromamba/CHANGELOG.md +++ b/micromamba/CHANGELOG.md @@ -1,3 +1,15 @@ +micromamba 2.0.2 (October 02, 2024) +=================================== + +Bug fixes: + +- fix: Handle `MatchSpec` with brackets when parsing environments' history by @jjerphan in https://github.com/mamba-org/mamba/pull/3490 +- Fix `channel` and `base_url` in `list` cmd by @Hind-M in https://github.com/mamba-org/mamba/pull/3488 + +CI fixes and doc: + +- Rollback to micromamba 1.5.10 in CI by @JohanMabille in https://github.com/mamba-org/mamba/pull/3491 + micromamba 2.0.1 (September 30, 2024) ===================================== diff --git a/micromamba/src/version.hpp b/micromamba/src/version.hpp index 60ff70a4cc..0600c7c9ef 100644 --- a/micromamba/src/version.hpp +++ b/micromamba/src/version.hpp @@ -12,7 +12,7 @@ #define UMAMBA_VERSION_MAJOR 2 #define UMAMBA_VERSION_MINOR 0 -#define UMAMBA_VERSION_PATCH 1 +#define UMAMBA_VERSION_PATCH 2 // Binary version #define UMAMBA_BINARY_CURRENT 1 From 675c6de0e6cdaa485c2014d3a434eaf5af4edff8 Mon Sep 17 00:00:00 2001 From: Johan Mabille Date: Fri, 4 Oct 2024 08:54:44 +0200 Subject: [PATCH 066/126] Upgraded CI to micromamba 2.0.2 (#3497) * Upgraded CI to micromamba 2.0.2 * Investigate CI setup * touch my.bat --- .github/workflows/static_build.yml | 5 ++--- .github/workflows/unix_impl.yml | 15 +++++---------- .github/workflows/windows_impl.yml | 12 ++++-------- 3 files changed, 11 insertions(+), 21 deletions(-) diff --git a/.github/workflows/static_build.yml b/.github/workflows/static_build.yml index eb438e9376..d2e1cac9f3 100644 --- a/.github/workflows/static_build.yml +++ b/.github/workflows/static_build.yml @@ -67,7 +67,7 @@ jobs: mv mamba/ micromamba-feedstock/source # Prevent irrelevant file permission error git -C micromamba-feedstock/ config --local --add safe.directory '*' - - uses: mamba-org/setup-micromamba@v1 + - uses: mamba-org/setup-micromamba@v2 with: environment-name: mambabuild create-args: python boa @@ -149,9 +149,8 @@ jobs: key: sccache-${{ github.job }}-win-64 - name: Set up MSVC uses: ilammy/msvc-dev-cmd@v1 - - uses: mamba-org/setup-micromamba@v1 + - uses: mamba-org/setup-micromamba@v2 with: - micromamba-version: '1.5.10-0' environment-name: mambabuild init-shell: bash cmd.exe # Constraint on fmt is due to an issue with 11.0.2 (to be fixed in next version) diff --git a/.github/workflows/unix_impl.yml b/.github/workflows/unix_impl.yml index 8fc78a8931..d152ada956 100644 --- a/.github/workflows/unix_impl.yml +++ b/.github/workflows/unix_impl.yml @@ -23,9 +23,8 @@ jobs: - name: Checkout mamba repository uses: actions/checkout@v4 - name: Create build environment - uses: mamba-org/setup-micromamba@v1 + uses: mamba-org/setup-micromamba@v2 with: - micromamba-version: '1.5.10-0' environment-file: ./dev/environment-dev.yml environment-name: build_env cache-environment: true @@ -71,9 +70,8 @@ jobs: path: build/ key_suffix: ${{ inputs.os }}-${{ inputs.build_type }} - name: Create build environment - uses: mamba-org/setup-micromamba@v1 + uses: mamba-org/setup-micromamba@v2 with: - micromamba-version: '1.5.10-0' environment-file: ./build/environment.lock environment-name: build_env - name: Run solv-cpp tests @@ -98,9 +96,8 @@ jobs: path: build/ key_suffix: ${{ inputs.os }}-${{ inputs.build_type }} - name: Create build environment - uses: mamba-org/setup-micromamba@v1 + uses: mamba-org/setup-micromamba@v2 with: - micromamba-version: '1.5.10-0' environment-file: ./build/environment.lock environment-name: build_env - name: Install libmambapy @@ -126,9 +123,8 @@ jobs: path: build/ key_suffix: ${{ inputs.os }}-${{ inputs.build_type }} - name: Create build environment - uses: mamba-org/setup-micromamba@v1 + uses: mamba-org/setup-micromamba@v2 with: - micromamba-version: '1.5.10-0' environment-file: ./build/environment.lock environment-name: build_env - name: install zsh, xonsh, fish and tcsh in linux @@ -184,9 +180,8 @@ jobs: path: build/ key_suffix: ${{ inputs.os }}-${{ inputs.build_type }} - name: Create build environment - uses: mamba-org/setup-micromamba@v1 + uses: mamba-org/setup-micromamba@v2 with: - micromamba-version: '1.5.10-0' environment-file: ./build/environment.lock environment-name: build_env - name: Run tests using conda-content-trust (server side) diff --git a/.github/workflows/windows_impl.yml b/.github/workflows/windows_impl.yml index b66856639d..a3b3ca3cea 100644 --- a/.github/workflows/windows_impl.yml +++ b/.github/workflows/windows_impl.yml @@ -23,9 +23,8 @@ jobs: - name: Checkout mamba repository uses: actions/checkout@v4 - name: Create build environment - uses: mamba-org/setup-micromamba@v1 + uses: mamba-org/setup-micromamba@v2 with: - micromamba-version: '1.5.10-0' environment-file: ./dev/environment-dev.yml environment-name: build_env cache-environment: true @@ -76,9 +75,8 @@ jobs: path: build/ key_suffix: ${{ inputs.os }}-${{ inputs.build_type }} - name: Create build environment - uses: mamba-org/setup-micromamba@v1 + uses: mamba-org/setup-micromamba@v2 with: - micromamba-version: '1.5.10-0' environment-file: ./build/environment.lock environment-name: build_env init-shell: bash cmd.exe @@ -106,9 +104,8 @@ jobs: path: build/ key_suffix: ${{ inputs.os }}-${{ inputs.build_type }} - name: Create build environment - uses: mamba-org/setup-micromamba@v1 + uses: mamba-org/setup-micromamba@v2 with: - micromamba-version: '1.5.10-0' environment-file: ./build/environment.lock environment-name: build_env init-shell: bash cmd.exe @@ -135,9 +132,8 @@ jobs: path: build/ key_suffix: ${{ inputs.os }}-${{ inputs.build_type }} - name: Create build environment - uses: mamba-org/setup-micromamba@v1 + uses: mamba-org/setup-micromamba@v2 with: - micromamba-version: '1.5.10-0' environment-file: ./build/environment.lock environment-name: build_env init-shell: bash cmd.exe powershell From 80c8b184d0fa8415442b01bdcb5a19d204cd0a69 Mon Sep 17 00:00:00 2001 From: Hind-M <70631848+Hind-M@users.noreply.github.com> Date: Fri, 4 Oct 2024 14:41:50 +0200 Subject: [PATCH 067/126] Fix warnings and co (#3507) --- libmamba/src/specs/match_spec.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/libmamba/src/specs/match_spec.cpp b/libmamba/src/specs/match_spec.cpp index 2659865b50..970df56dea 100644 --- a/libmamba/src/specs/match_spec.cpp +++ b/libmamba/src/specs/match_spec.cpp @@ -520,9 +520,11 @@ namespace mamba::specs // TODO: this solution reallocates memory several times potentially, but the // number of operators is small and the strings are short, so it must be fine. // If needed it can be optimized so that the string is only copied once. - for (const std::string& op : { ">=", "<=", "==", ">", "<", "!=", "=", "==", "~=", "," }) + const auto op_array = std::array{ ">=", "<=", ">", "<", "!=", + "=", "==", "~=", "," }; + for (const std::string& op : op_array) { - const std::string& bad_op = op + " "; + const std::string bad_op = op + " "; while (raw_match_spec_str.find(bad_op) != std::string::npos) { raw_match_spec_str = raw_match_spec_str.substr(0, raw_match_spec_str.find(bad_op)) + op @@ -604,7 +606,7 @@ namespace mamba::specs { if (is_hash(hash)) { - ms.set_md5(std::string(hash)); + ms.set_md5(hash); } return ms; } From 553eace9d73fa589690aa2430fa61efc5d9403de Mon Sep 17 00:00:00 2001 From: Johan Mabille Date: Fri, 4 Oct 2024 16:46:37 +0200 Subject: [PATCH 068/126] Replaced rstrip reimplementation with call to remove_suffix (#3508) --- libmamba/src/api/list.cpp | 22 +++++----------------- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/libmamba/src/api/list.cpp b/libmamba/src/api/list.cpp index 277de0646c..470555d9e5 100644 --- a/libmamba/src/api/list.cpp +++ b/libmamba/src/api/list.cpp @@ -35,29 +35,17 @@ namespace mamba return a.name < b.name; } - // This is more or less an implementation of `util::rstrip` specific to this use case - // (for printing purposes), but using `std::string` instead of `std::string_view` - // `util::rstrip` is not used here because it leads to an UB, - // `using non owned/tracked strings from Channel (& co) and PackageInfo - std::string rstrip(const std::string& full_str, const std::string& sub_str) - { - if (util::ends_with(full_str, sub_str)) - { - return full_str.substr(0, full_str.length() - sub_str.length()); - } - else - { - return full_str; - } - } - std::string strip_from_filename_and_platform( const std::string& full_str, const std::string& filename, const std::string& platform ) { - return rstrip(rstrip(rstrip(rstrip(full_str, filename), "/"), platform), "/"); + using util::remove_suffix; + return std::string(remove_suffix( + remove_suffix(remove_suffix(remove_suffix(full_str, filename), "/"), platform), + "/" + )); } void list_packages( From 1e8694e1fca42f5023d477fdbd5bdcf95da1774e Mon Sep 17 00:00:00 2001 From: mleistner-bgr <148044323+mleistner-bgr@users.noreply.github.com> Date: Mon, 7 Oct 2024 18:25:02 +0200 Subject: [PATCH 069/126] Replace `[System.IO.Path]::GetFileNameWithoutExtension` with `-replace` (#3510) --- libmamba/data/Mamba.psm1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libmamba/data/Mamba.psm1 b/libmamba/data/Mamba.psm1 index 7dbe5f6e18..a0a93b8c93 100644 --- a/libmamba/data/Mamba.psm1 +++ b/libmamba/data/Mamba.psm1 @@ -171,7 +171,7 @@ if ($MambaModuleArgs.ChangePs1) { ## ALIASES ##################################################################### -$__mamba_name = [System.IO.Path]::GetFileNameWithoutExtension((Split-Path -Leaf $Env:MAMBA_EXE)); +$__mamba_name = (Split-Path -Path $Env:MAMBA_EXE -Leaf) -replace '\.[^.]+$' New-Alias -Name $__mamba_name -Value Invoke-Mamba -Force Register-ArgumentCompleter -Native -CommandName $__mamba_name -ScriptBlock $MambaAutocompleteScriptblock From c4068d31177dc2616288d2b3148fbeb91a058ff9 Mon Sep 17 00:00:00 2001 From: Julien Jerphanion Date: Mon, 7 Oct 2024 19:18:31 +0200 Subject: [PATCH 070/126] fix: Ignore inline comment in environment specification (#3512) Fix https://github.com/mamba-org/mamba/issues/3509 Signed-off-by: Julien Jerphanion --- libmamba/src/specs/match_spec.cpp | 9 +++++++++ libmamba/tests/src/specs/test_match_spec.cpp | 9 +++++++++ 2 files changed, 18 insertions(+) diff --git a/libmamba/src/specs/match_spec.cpp b/libmamba/src/specs/match_spec.cpp index 970df56dea..d314c26f55 100644 --- a/libmamba/src/specs/match_spec.cpp +++ b/libmamba/src/specs/match_spec.cpp @@ -502,6 +502,15 @@ namespace mamba::specs auto MatchSpec::parse(std::string_view str) -> expected_parse_t { + // Remove comments, i.e. everything after ` #` (space included) + if (const auto idx = str.find('#'); idx != std::string::npos && str[idx - 1] == ' ') + { + str = str.substr(0, idx); + } + + // Remove trailing whitespaces + str = util::rstrip(str); + std::string raw_match_spec_str = std::string(str); raw_match_spec_str = util::strip(raw_match_spec_str); diff --git a/libmamba/tests/src/specs/test_match_spec.cpp b/libmamba/tests/src/specs/test_match_spec.cpp index 2c8f94bc3c..a0ce149f2d 100644 --- a/libmamba/tests/src/specs/test_match_spec.cpp +++ b/libmamba/tests/src/specs/test_match_spec.cpp @@ -182,6 +182,15 @@ TEST_SUITE("specs::match_spec") CHECK_EQ(std::string(ms.error().what()), "Found invalid version predicate in \"V0.9.24\""); } + SUBCASE("importlib-metadata # drop this when dropping Python 3.8") + { + auto ms = MatchSpec::parse("importlib-metadata # drop this when dropping Python 3.8") + .value(); + CHECK_EQ(ms.name().str(), "importlib-metadata"); + CHECK(ms.version().is_explicitly_free()); + CHECK_EQ(ms.str(), "importlib-metadata"); + } + SUBCASE("foo=V0.9.24") { auto ms = MatchSpec::parse("foo=V0.9.24").value(); From 215e5e522ae12415aee91360971ba906865ba832 Mon Sep 17 00:00:00 2001 From: Hind-M <70631848+Hind-M@users.noreply.github.com> Date: Mon, 7 Oct 2024 19:43:03 +0200 Subject: [PATCH 071/126] Add recommendation if error with root prefix (#3513) Add recommendation if error --- libmamba/src/api/configuration.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/libmamba/src/api/configuration.cpp b/libmamba/src/api/configuration.cpp index ce2c45320d..110a302efd 100644 --- a/libmamba/src/api/configuration.cpp +++ b/libmamba/src/api/configuration.cpp @@ -658,7 +658,12 @@ namespace mamba && !fs::exists(prefix / "envs")) { return make_unexpected( - fmt::format(R"(Path "{}" is not an existing root prefix.)", prefix.string()), + fmt::format( + R"(Path "{}" is not an existing root prefix.)" + R"( Please set explicitly `MAMBA_ROOT_PREFIX` to "{}" to skip this error.)", + prefix.string(), + prefix.string() + ), mamba_error_code::incorrect_usage ); } @@ -688,7 +693,9 @@ namespace mamba return make_unexpected( fmt::format( R"(Could not use default root_prefix "{}":)" - R"( Directory exists, is not empty and not a conda prefix.)", + R"( Directory exists, is not empty and not a conda prefix.)" + R"( Please set explicitly `MAMBA_ROOT_PREFIX` to "{}" to skip this error.)", + prefix.string(), prefix.string() ), mamba_error_code::incorrect_usage From 91a2a2b868e7b62350eaf52a3b2dedb594f6e97a Mon Sep 17 00:00:00 2001 From: Julien Jerphanion Date: Tue, 15 Oct 2024 17:06:07 +0200 Subject: [PATCH 072/126] fix: Adapt `test_env_update_pypi_with_conda_forge` (#3537) Signed-off-by: Julien Jerphanion --- micromamba/tests/test_env.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/micromamba/tests/test_env.py b/micromamba/tests/test_env.py index aeb4c94227..1085df3e98 100644 --- a/micromamba/tests/test_env.py +++ b/micromamba/tests/test_env.py @@ -307,6 +307,8 @@ def test_env_update_conda_forge_with_pypi(tmp_home, tmp_root_prefix, tmp_path): channels: - conda-forge dependencies: +# This version of Python covers all the versions of numpy available on conda-forge and PyPI for all platforms. +- python 3.12 - pip - pip: - numpy==1.26.4 From 5e30f9f777be74261ca9911a46500a5e73f2bc0c Mon Sep 17 00:00:00 2001 From: Julien Jerphanion Date: Tue, 15 Oct 2024 17:07:20 +0200 Subject: [PATCH 073/126] maint: Clarify `env` subcommand documentation in help menu (#3502) Signed-off-by: Julien Jerphanion Co-authored-by: Hind-M <70631848+Hind-M@users.noreply.github.com> --- docs/source/user_guide/micromamba.rst | 2 +- libmamba/data/mamba.fish | 2 +- micromamba/src/umamba.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/source/user_guide/micromamba.rst b/docs/source/user_guide/micromamba.rst index 5bf223d2b3..f5f0adf7e3 100644 --- a/docs/source/user_guide/micromamba.rst +++ b/docs/source/user_guide/micromamba.rst @@ -32,7 +32,7 @@ Quickstarts config Configuration of micromamba info Information about micromamba constructor Commands to support using micromamba in constructor - env List environments + env See `mamba/micromamba env --help`. activate Activate an environment run Run an executable in an environment ps Show, inspect or kill running processes diff --git a/libmamba/data/mamba.fish b/libmamba/data/mamba.fish index d6a8861c5c..2e3c534847 100644 --- a/libmamba/data/mamba.fish +++ b/libmamba/data/mamba.fish @@ -143,7 +143,7 @@ __fish_mamba_complete_subcmds '__fish_mamba_has_command' ' config Configuration of micromamba info Information about micromamba constructor Commands to support using micromamba in constructor - env List environments + env Access information about environments activate Activate an environment run Run an executable in an environment ps Show, inspect or kill running processes diff --git a/micromamba/src/umamba.cpp b/micromamba/src/umamba.cpp index 40ce546a5b..08c2b3964e 100644 --- a/micromamba/src/umamba.cpp +++ b/micromamba/src/umamba.cpp @@ -87,7 +87,7 @@ set_umamba_command(CLI::App* com, mamba::Configuration& config) ); set_constructor_command(constructor_subcom, config); - CLI::App* env_subcom = com->add_subcommand("env", "List environments"); + CLI::App* env_subcom = com->add_subcommand("env", "Access information about environments"); set_env_command(env_subcom, config); CLI::App* activate_subcom = com->add_subcommand("activate", "Activate an environment"); From 9eb24012fc7b08f89c05396599d8d2e29123eeb1 Mon Sep 17 00:00:00 2001 From: NewUserHa <32261870+NewUserHa@users.noreply.github.com> Date: Wed, 16 Oct 2024 00:06:57 +0800 Subject: [PATCH 074/126] fix: Handle space in `mamba` and `micromamba` executable absolute paths (#3525) --- libmamba/data/mamba.bat | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libmamba/data/mamba.bat b/libmamba/data/mamba.bat index 0a5648f6be..5170368093 100644 --- a/libmamba/data/mamba.bat +++ b/libmamba/data/mamba.bat @@ -9,7 +9,7 @@ __MAMBA_INSERT_ROOT_PREFIX__ @IF [%1]==[activate] "%~dp0_mamba_activate" %* @IF [%1]==[deactivate] "%~dp0_mamba_activate" %* -@CALL %MAMBA_EXE% %* +@CALL "%MAMBA_EXE%" %* @IF %errorlevel% NEQ 0 EXIT /B %errorlevel% From 764f85f88186d28f5e0822b623b9dd06e01bb1cc Mon Sep 17 00:00:00 2001 From: Julien Jerphanion Date: Tue, 15 Oct 2024 18:30:24 +0200 Subject: [PATCH 075/126] maint: Clarify `env` subcommand documentation in help menu (cont'd) (#3539) Signed-off-by: Julien Jerphanion --- docs/source/user_guide/micromamba.rst | 2 +- libmamba/data/mamba.fish | 2 +- micromamba/src/umamba.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/source/user_guide/micromamba.rst b/docs/source/user_guide/micromamba.rst index f5f0adf7e3..b92b0cc281 100644 --- a/docs/source/user_guide/micromamba.rst +++ b/docs/source/user_guide/micromamba.rst @@ -32,7 +32,7 @@ Quickstarts config Configuration of micromamba info Information about micromamba constructor Commands to support using micromamba in constructor - env See `mamba/micromamba env --help`. + env See `mamba/micromamba env --help` activate Activate an environment run Run an executable in an environment ps Show, inspect or kill running processes diff --git a/libmamba/data/mamba.fish b/libmamba/data/mamba.fish index 2e3c534847..c7bd3ce754 100644 --- a/libmamba/data/mamba.fish +++ b/libmamba/data/mamba.fish @@ -143,7 +143,7 @@ __fish_mamba_complete_subcmds '__fish_mamba_has_command' ' config Configuration of micromamba info Information about micromamba constructor Commands to support using micromamba in constructor - env Access information about environments + env See `mamba/micromamba env --help` activate Activate an environment run Run an executable in an environment ps Show, inspect or kill running processes diff --git a/micromamba/src/umamba.cpp b/micromamba/src/umamba.cpp index 08c2b3964e..73268e2725 100644 --- a/micromamba/src/umamba.cpp +++ b/micromamba/src/umamba.cpp @@ -87,7 +87,7 @@ set_umamba_command(CLI::App* com, mamba::Configuration& config) ); set_constructor_command(constructor_subcom, config); - CLI::App* env_subcom = com->add_subcommand("env", "Access information about environments"); + CLI::App* env_subcom = com->add_subcommand("env", "See `mamba/micromamba env --help`"); set_env_command(env_subcom, config); CLI::App* activate_subcom = com->add_subcommand("activate", "Activate an environment"); From c329ca0401f57ed7c55bdfa551044e016c8ae37d Mon Sep 17 00:00:00 2001 From: Julien Jerphanion Date: Tue, 15 Oct 2024 18:30:46 +0200 Subject: [PATCH 076/126] fix: Use POSIX-compliant scripts (#3522) Signed-off-by: Julien Jerphanion --- libmamba/data/mamba.sh | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/libmamba/data/mamba.sh b/libmamba/data/mamba.sh index 502a2e857c..dc129afb90 100644 --- a/libmamba/data/mamba.sh +++ b/libmamba/data/mamba.sh @@ -51,13 +51,22 @@ __mamba_wrap() { # There is no way to register it dynamically without relying on hacks or eval. __exe_name="$(basename "${MAMBA_EXE}")" __exe_name="${__exe_name%.*}" -if [[ "${__exe_name}" == "micromamba" ]]; then - micromamba() { __mamba_wrap "${@}"; } -elif [[ "${__exe_name}" == "mamba" ]]; then - mamba() { __mamba_wrap "${@}"; } -else - echo "Error unknow MAMBA_EXE: \"${MAMBA_EXE}\", filename must be mamba or micromamba" 1>&2 -fi + +case "${__exe_name}" in + micromamba) + micromamba() { + __mamba_wrap "$@" + } + ;; + mamba) + mamba() { + __mamba_wrap "$@" + } + ;; + *) + echo "Error unknown MAMBA_EXE: \"${MAMBA_EXE}\", filename must be mamba or micromamba" 1>&2 + ;; +esac if [ -z "${CONDA_SHLVL+x}" ]; then From 3d71f575170a234d4773ac4f84b65dfaebeeceb6 Mon Sep 17 00:00:00 2001 From: Hind-M <70631848+Hind-M@users.noreply.github.com> Date: Wed, 16 Oct 2024 10:53:51 +0200 Subject: [PATCH 077/126] Create empty base prefix with `env update` (#3519) --- libmamba/src/api/update.cpp | 5 +++++ micromamba/tests/test_env.py | 28 ++++++++++++++++++++++++++++ micromamba/tests/test_install.py | 27 +++++++++++++++++++++++++++ 3 files changed, 60 insertions(+) diff --git a/libmamba/src/api/update.cpp b/libmamba/src/api/update.cpp index e883078d7c..26f679a48c 100644 --- a/libmamba/src/api/update.cpp +++ b/libmamba/src/api/update.cpp @@ -131,6 +131,11 @@ namespace mamba { auto& ctx = config.context(); + // `env update` case + if (update_params.env_update == EnvUpdate::Yes) + { + config.at("create_base").set_value(true); + } config.at("use_target_prefix_fallback").set_value(true); config.at("use_default_prefix_fallback").set_value(true); config.at("use_root_prefix_fallback").set_value(true); diff --git a/micromamba/tests/test_env.py b/micromamba/tests/test_env.py index 1085df3e98..3dbae15fb5 100644 --- a/micromamba/tests/test_env.py +++ b/micromamba/tests/test_env.py @@ -410,3 +410,31 @@ def test_env_create_whitespace(tmp_home, tmp_root_prefix, tmp_path): package["name"] == "scikit-learn" and Version(package["version"]) > Version("1.0.0") for package in packages ) + + +env_yaml_content_to_update_empty_base = """ +channels: +- conda-forge +dependencies: +- python +- xtensor +""" + + +@pytest.mark.parametrize("shared_pkgs_dirs", [True], indirect=True) +def test_env_update_empty_base(tmp_home, tmp_root_prefix, tmp_path): + env_prefix = tmp_path / "env-update-empty-base" + + os.environ["MAMBA_ROOT_PREFIX"] = str(env_prefix) + + env_file_yml = tmp_path / "test_env_empty_base.yaml" + env_file_yml.write_text(env_yaml_content_to_update_empty_base) + + cmd = ["update", "-p", env_prefix, f"--file={env_file_yml}", "-y", "--json"] + + res = helpers.run_env(*cmd) + assert res["success"] + + packages = helpers.umamba_list("-p", env_prefix, "--json") + assert any(package["name"] == "xtensor" for package in packages) + assert any(package["name"] == "python" for package in packages) diff --git a/micromamba/tests/test_install.py b/micromamba/tests/test_install.py index 67800cb894..9d256a78a2 100644 --- a/micromamba/tests/test_install.py +++ b/micromamba/tests/test_install.py @@ -741,3 +741,30 @@ def test_reinstall_with_new_version(tmp_home, tmp_root_prefix): res = helpers.umamba_run("-n", env_name, "python", "-c", "import pip; print(pip.__version__)") assert len(res) + + +env_yaml_content_to_install_empty_base = """ +channels: +- conda-forge +dependencies: +- python +- xtensor +""" + + +def test_install_empty_base(tmp_home, tmp_root_prefix, tmp_path): + env_prefix = tmp_path / "env-install-empty-base" + + os.environ["MAMBA_ROOT_PREFIX"] = str(env_prefix) + + env_file_yml = tmp_path / "test_install_env_empty_base.yaml" + env_file_yml.write_text(env_yaml_content_to_install_empty_base) + + cmd = ["-p", env_prefix, f"--file={env_file_yml}", "-y", "--json"] + + res = helpers.install(*cmd) + assert res["success"] + + packages = helpers.umamba_list("-p", env_prefix, "--json") + assert any(package["name"] == "xtensor" for package in packages) + assert any(package["name"] == "python" for package in packages) From 7ae780c6ed1357b30c9d4e2e1ae78a1ccfcb856d Mon Sep 17 00:00:00 2001 From: Julien Jerphanion Date: Thu, 17 Oct 2024 13:55:22 +0200 Subject: [PATCH 078/126] dev: Remove the use of Taskfile (#3544) Signed-off-by: Julien Jerphanion --- Taskfile.dist.yml | 323 ------------------ .../source/developer_zone/dev_environment.rst | 91 ----- 2 files changed, 414 deletions(-) delete mode 100644 Taskfile.dist.yml diff --git a/Taskfile.dist.yml b/Taskfile.dist.yml deleted file mode 100644 index b4c9bfbbc3..0000000000 --- a/Taskfile.dist.yml +++ /dev/null @@ -1,323 +0,0 @@ -version: '3' - -vars: - # Windows doesn't set the PWD environment variable automatically, but we can - # assign it using a dynamic variable since pwd does work in PowerShell - PWD: - sh: pwd - BUILD_DIR: 'build' - ENV_DIR: '{{.BUILD_DIR}}/envs' - DEV_ENV_DIR: '{{.ENV_DIR}}/dev' - DEV_RUN: 'micromamba run --prefix {{.DEV_ENV_DIR}}' - TEST_ENV_DIR: '{{.ENV_DIR}}/test' - TEST_RUN: 'micromamba run --prefix {{.TEST_ENV_DIR}}' - CMAKE_BUILD_DIR: '{{.BUILD_DIR}}/cmake' - CMAKE_PRESET: 'mamba-unix-shared-debug-dev' - CACHE_DIR: '{{.BUILD_DIR}}/pkgs' - DOCS_DIR: '{{.BUILD_DIR}}/docs' - DOCS_DOXYGEN_XML_DIR: '{{.PWD}}/{{.DOCS_DIR}}/doxygen-xml' - MAMBA_NAME: 'mamba' # Depend on preset... - TEST_MAMBA_EXE: '{{.PWD}}/{{.CMAKE_BUILD_DIR}}/micromamba/{{.MAMBA_NAME}}' - MAMBA_ROOT_PREFIX: '${HOME}/micromamba' - CPU_PERCENTAGE: 75 - CPU_TOTAL: - sh: >- - {{- if eq OS "linux" -}} - cat /proc/cpuinfo | grep processor | wc -l - {{- else if eq OS "darwin" -}} - sysctl -n hw.ncpu - {{- else -}} - echo 1 - {{- end -}} - CPU_COUNT: - sh: echo $(({{.CPU_TOTAL}} * {{.CPU_PERCENTAGE}} / 100)) - -tasks: - _create-env: - run: 'when_changed' - internal: true - cmds: - - 'micromamba create --yes --prefix "{{.prefix}}" --file ./dev/environment-dev.yml' - - 'micromamba install --yes --prefix "{{.prefix}}" --file ./dev/environment-dev-extra.yml' - sources: - - './dev/environment-dev.yml' - - './dev/environment-dev-extra.yml' - generates: - - '{{.prefix}}/conda-meta/**/*' - - _copy-env: - internal: true - cmds: - - 'micromamba env export --explicit --prefix "{{.source_prefix}}" > "{{.BUILD_DIR}}/env.tmp.lock"' - - defer: 'rm "{{.BUILD_DIR}}/env.tmp.lock"' - - 'micromamba create --yes --prefix "{{.prefix}}" --offline --file "{{.BUILD_DIR}}/env.tmp.lock"' - sources: - - '{{.source_prefix}}/conda-meta/**/*' - generates: - - '{{.prefix}}/conda-meta/**/*' - - create-dev-env: - desc: Create a local development mamba environment with all needed dependencies - summary: | - Create development Conda environment with dependencies and development packages used to build - Mamba. Many tasks are automatically run inside this environment. - The environment is located at "{{.DEV_ENV_DIR}}" and can also be activated with micromamba to - benefit from the executables and LSP tools. - cmds: [{task: '_create-env', vars: {prefix: '{{.PWD}}/{{.DEV_ENV_DIR}}'}}] - - create-test-env: - desc: Create a local test environment with as a copy of the dev environment. - summary: | - Copy the dev environment as a test environment under "{{.TEST_ENV_DIR}}". This environment is - used by some task that need to make an actual install of Mamba, ensuring the dev environment - is not modified. - deps: [create-dev-env] - cmds: - - task: '_copy-env' - vars: {source_prefix: '{{.DEV_ENV_DIR}}', prefix: '{{.TEST_ENV_DIR}}'} - - _pre-commit: - internal: true - deps: [create-dev-env] - cmds: - - cmd: '{{.DEV_RUN}} pre-commit run {{.args}}' - ignore_error: true - pre-commit: - desc: Run linters and code formatters. - summary: | - Run the pre-commit hooks inside the development environment to format and lint the code. - It is recommended to install the pre-commit hooks instead using - - pre-commit install - cmds: [{task: _pre-commit, vars: {args: '{{.CLI_ARGS | default "--all-files"}}'}}] - - _configure: - internal: true - deps: ['create-dev-env', 'create-test-env'] - cmds: - - >- - {{.DEV_RUN}} cmake -B "{{.CMAKE_BUILD_DIR}}" - --preset {{.CMAKE_PRESET}} - -D CMAKE_INSTALL_PREFIX="{{.TEST_ENV_DIR}}" - -D CMAKE_INSTALL_RPATH="{{.PWD}}/{{.TEST_ENV_DIR}}/lib" - {{.args}} - - 'ln -sf "{{.CMAKE_BUILD_DIR}}/compile_commands.json"' - # CMake knows when and how it needs to reconfigure itself, so we set that task to - # only run for the first configuration - status: - - test -f '{{.CMAKE_BUILD_DIR}}/CMakeCache.txt' - configure: - desc: Configure the CMake build. - summary: | - CMake makes a one time configuration to detect system properties and find dependencies. - This step runs such configuration steps with development options passed in. - Extra argument can be passed to CMake using the syntax: - - task configure -- -D SOME_OPTION=True - cmds: [{task: _configure, vars: {args: '{{.CLI_ARGS}}'}}] - reconfigure: - desc: Erase all CMake cache entries and run confiiguration again. - summary: | - CMake configuration can have some sticky parameters. Use this when in need to start from a - clean configuration, for instance when encountering issues with dependencies. - Extra argument can be passed to CMake using the syntax: - - task reconfigure -- -D SOME_OPTION=True - cmds: - - 'rm -rf "{{.CMAKE_BUILD_DIR}}/CMakeCache.txt"' - - {task: _configure, vars: {args: '{{.CLI_ARGS}}'}} - - _build: - internal: true - deps: ['_configure'] - cmds: - - '{{.DEV_RUN}} cmake --build "{{.CMAKE_BUILD_DIR}}" {{.args}}' - vars: - cpu_count: '{{.cpu_count | default .CPU_COUNT}}' - target: '{{.target | default "all"}}' - args: '{{.args | default (printf "--parallel %s --target %s" .cpu_count .target)}}' - # Again, CMake knows what to rebuild so we always rerun the task - build: - desc: Build all (or some) CMake targets. - summary: | - Build all CMake targets, including `micormamba` and `libmambapy`. A single target can be built - using: - - task build -- --target micromamba - cmds: [{task: '_build', vars: {args: '{{.CLI_ARGS}}'}}] - - micromamba: - desc: Run the development `micromamba`. - summary: | - When developing a feature or tracking down a bug, it can be useful to try it out "for real". - This lets you run `micromamba` with the safety of automatic recompile, and disambiguation - from a local install of stable `micromamba`. - An example run could look like: - - task micromamba -- create -n env -c conda-forge python=3.11 - deps: [{task: '_build', vars: {target: '{{.MAMBA_NAME}}'}}] - cmds: - - '"{{.TEST_MAMBA_EXE}}" {{.CLI_ARGS}}' - - _test-solv-cpp: - internal: true - deps: [{task: _build, vars: {target: 'test_solv_cpp'}}] - dir: '' - cmds: - - '{{.CMAKE_BUILD_DIR}}/libmamba/ext/solv-cpp/tests/test_solv_cpp {{.args}}' - test-solv-cpp: - desc: Run `libmamba` C++ based tests. - summary: | - Run fast C++ tests of the libsolc C++ wrappers. Running this command will rebuild only - `solv-cpp` and its tests, so compilation error may still happen when building other targets. - Test options can be passed as extra command line arguments: - - task test-solv-cpp -- --test-suite='util::*' - cmds: [{task: '_test-solv-cpp', vars: {args: '{{.CLI_ARGS}}'}}] - - _test-libmamba: - internal: true - deps: [{task: _build, vars: {target: 'test_libmamba'}}] - dir: '{{.CMAKE_BUILD_DIR}}/libmamba/tests/' - cmds: - - './test_libmamba {{.args}}' - test-libmamba: - desc: Run `libmamba` C++ based tests. - summary: | - Run fast C++ tests of libmamba. Running this command will rebuild only `libmamba` and its - tests, so compilation error may still happen when building other targets. - Test options can be passed as extra command line arguments: - - task test-libmamba -- --test-suite='util::*' - cmds: [{task: '_test-libmamba', vars: {args: '{{.CLI_ARGS}}'}}] - - _test-micromamba: - internal: true - deps: [{task: '_build', vars: {target: '{{.MAMBA_NAME}}'}}] - env: - TEST_MAMBA_EXE: '{{.TEST_MAMBA_EXE}}' - cmds: - - >- - {{.DEV_RUN}} python -m pytest micromamba/tests/ - --mamba-pkgs-dir="{{.CACHE_DIR}}" {{.args}} - test-micromamba: - desc: Run `micromamba` integration tests. - summary: | - Run slow `micromamba` tests through a Pytest Python framework. - Test options can be passed as extra command line arguments: - - task test-micromamba -- -x --failed-first -k 'test_create' - cmds: [{task: _test-micromamba, vars: {args: '{{.CLI_ARGS}}'}}] - - install-cpp: - desc: Install C++ targets into the test environment. - summary: | - Installing C++ target is needed to create the Python package but this command rarely needs - to be called directly. - deps: [_build] - cmds: - - '{{.DEV_RUN}} cmake --install "{{.CMAKE_BUILD_DIR}}" --prefix "{{.TEST_ENV_DIR}}"' - - _test-reposerver: - internal: true - deps: [{task: '_build', vars: {target: '{{.MAMBA_NAME'}}] - env: - TEST_MAMBA_EXE: '{{.TEST_MAMBA_EXE}}' - MAMBA_ROOT_PREFIX: '{{.MAMBA_ROOT_PREFIX}}' - # Explicitly using this as var since env does not override shell environment - vars: - GNUPGHOME: '{{.BUILD_DIR}}/gnupg' - cmds: - - mkdir -p {{.GNUPGHOME}} - - defer: 'rm -rf "{{.GNUPGHOME}}"' - - '{{.DEV_RUN}} --env GNUPGHOME={{.GNUPGHOME}} ./micromamba/test-server/generate_gpg_keys.sh' - - '{{.DEV_RUN}} --env GNUPGHOME={{.GNUPGHOME}} ./micromamba/test-server/testserver.sh {{.args}}' - test-reposerver: - cmds: [{task: _test-reposerver, vars: {args: '{{.CLI_ARGS}}'}}] - - install-py: - desc: Install the `libmambapy` Python package inside the test environment. - summary: | - Installing the Python package is required to run `libmambapy` Python tests but this command - rarely needs to be called explicitly. - deps: [install-cpp] - cmds: - - >- - {{.TEST_RUN}} python -m pip install - --no-deps --no-build-isolation --ignore-installed ./libmambapy/ - - _test-libmambapy: - internal: true - deps: [install-py] - cmds: - - >- - {{.TEST_RUN}} python -m pytest libmambapy/tests/ {{.args}} - test-libmambapy: - desc: Run `libmambapy` Python based unit tests. - summary: | - Run the Python unit tests of `libmambapy`. These tests do not test features of `libmamba` - but rather that the bindings code runs without errors. - Test options can be passed as extra command line arguments: - - task test-libmambapy -- -x --failed-first -k 'specs' - cmds: [{task: _test-libmambapy, vars: {args: '{{.CLI_ARGS}}'}}] - - stubgen: - desc: Regenerate libmambapy typing stubs. - summary: | - Regenerate the stub `*.pyi` stubs files providing Python typing information. - If this command creates any changes, the modifications needs to be committed. - deps: [install-py] - cmds: - - '{{.TEST_RUN}} python -m pybind11_stubgen -o "{{.BUILD_DIR}}/stubs" libmambapy.core.bindings' - - cp "{{.BUILD_DIR}}/stubs/libmambapy/core/bindings-stubs/__init__.pyi" libmambapy/src/libmambapy/__init__.pyi - - '{{.DEV_RUN}} pre-commit run --files libmambapy/src/libmambapy/__init__.pyi' - - build-doxygen-xml: - desc: Build the XML summary of libmamba C++ API - summary: | - Build the XML summary of libmamba C++ API using Doxygen - This is passed on to Sphinx through the Breathe extension for building the reference API. - deps: [create-dev-env] - cmds: - - mkdir -p echo "{{.DOCS_DOXYGEN_XML_DIR}}" - - >- - ( - cat docs/Doxyfile; - echo "INPUT=libmamba/include"; - echo "XML_OUTPUT={{.DOCS_DOXYGEN_XML_DIR}}" - ) | {{.DEV_RUN}} doxygen - - sources: - - libmamba/include/**/*.hpp - generates: - - '{{.DOCS_DOXYGEN_XML_DIR}}/**/*' - - build-docs: - desc: Build the documentation. - summary: | - Build Mamba documentation using Sphinx. - deps: [build-doxygen-xml] - env: - MAMBA_DEV_DOXYGEN_XML_DIR: '{{.DOCS_DOXYGEN_XML_DIR}}' - cmds: - - '{{.DEV_RUN}} python -m sphinx -b html docs/source {{.DOCS_DIR}}' - - test-docs: - desc: Test the documentation, for instance for dead links. - summary: | - Run documentation tests, checking for dead links. - deps: [create-dev-env] - env: - MAMBA_DEV_DOXYGEN_XML_DIR: '{{.DOCS_DOXYGEN_XML_DIR}}' - cmds: - - '{{.DEV_RUN}} python -m sphinx -W -b linkcheck docs/source {{.DOCS_DIR}}' - - clean: - desc: Remove files generated by Task commands. - summary: | - Remove files generated by Task commands. Some files and folder generated by tools may still - remain. To entirely clean the repository, run: - - git clean -xdn - cmds: - - rm -rf {{.BUILD_DIR}}' diff --git a/docs/source/developer_zone/dev_environment.rst b/docs/source/developer_zone/dev_environment.rst index 3e732cee37..59a4315320 100644 --- a/docs/source/developer_zone/dev_environment.rst +++ b/docs/source/developer_zone/dev_environment.rst @@ -24,102 +24,11 @@ it is best to work with micromamba. Refer to the :ref:`installation` page for how to install micromamba or mamba. -Develop using Taskfile -====================== - -Many development operations can be automated and chained using `Taskfile `_. -You can follow the installation instructions there, or install it via ``conda-forge``. - - -.. code:: bash - - micromamba create -n mamba -c conda-forge go-task - micromamba activate -n mamba - -If you're running on an OSX machine, you'll need to install GNU coreutils as well for the Taskfile to work. - -.. code:: bash - - micromamba create -n mamba -c conda-forge go-task coreutils - micromamba activate -n mamba - -Running commands -**************** - -Tasks and their descriptions can be queried with: - -.. code:: bash - - task --list-all - -At the time of writing, the following tasks are available: - -.. code:: - - task: Available tasks for this project: - * build: Build all (or some) CMake targets. - * build-docs: Build the documentation. - * clean: Remove files generated by Task commands. - * configure: Configure the CMake build. - * create-dev-env: Create a local development mamba environment with all needed dependencies - * create-test-env: Create a local test environment with as a copy of the dev environment. - * install-cpp: Install C++ targets into the test environment. - * install-py: Install the ``libmambapy`` Python package inside the test environment. - * micromamba: Run the development ``micromamba``. - * pre-commit: Run linters and code formatters. - * reconfigure: Erase all CMake cache entries and run confiiguration again. - * stubgen: Regenerate libmambapy typing stubs. - * test-docs: Test the documentation, for instance for dead links. - * test-libmamba: Run ``libmamba`` C++ based tests. - * test-libmambapy: Run ``libmambapy`` Python based unit tests. - * test-micromamba: Run ``micromamba`` integration tests. - -For instance to run ``libmamba`` tests, execute: - -.. code:: bash - - task test-libmamba - -Tasks have dependencies expressed between them. -For instance, when running a tests task, compilation and installation steps will be run -automatically as needed. - -Extra command line arguments can also be passed to the underlying command: - -.. code:: bash - - task test-libmamba -- --test-suite='util::*' - -Further documentation about a specific task can be queried with the ``--summary`` -option: - -.. code:: bash - - task --summary test-libmamba - -A dry-run mode can also be used to know what commands would be run, without actually -running them: - -.. code:: bash - - task --dry-run test-libmamba - - -Development tools -***************** - -With any command, ``task`` will run ``create-dev-env`` with all development dependencies. -This environment can be activated to get development tools such as -`LSP `_ code completion and lint. - - Running commands manually ========================= .. note:: - Even if not using Taskfile, the file ``Taskfile.dist.yml`` can provide insights on - useful commands. The CI files in ``.github/workflow`` provide an alternative way of developing Mamba. Install development dependencies From 0ad7255b24c6f2fe4c0117726f993438b10072f9 Mon Sep 17 00:00:00 2001 From: Julien Jerphanion Date: Thu, 17 Oct 2024 17:00:11 +0200 Subject: [PATCH 079/126] maint: Unpin libcurl<8.10 (#3548) To see if 8.10.1 solved the problem. Signed-off-by: Julien Jerphanion --- .github/workflows/static_build.yml | 12 ------------ dev/environment-dev.yml | 2 +- dev/environment-micromamba-static.yml | 4 ++-- 3 files changed, 3 insertions(+), 15 deletions(-) diff --git a/.github/workflows/static_build.yml b/.github/workflows/static_build.yml index d2e1cac9f3..86039d1898 100644 --- a/.github/workflows/static_build.yml +++ b/.github/workflows/static_build.yml @@ -43,18 +43,6 @@ jobs: run: | cd micromamba-feedstock/ sed -i '' '/conda_forge_output_validation/d' conda-forge.yml - - name: Pin libcurl - if: ${{ matrix.platform == 'osx' }} - run: | - cd micromamba-feedstock/ - sed -i '' 's/libcurl >=8.4.0/libcurl >=8.4.0,<8.10/g' recipe/meta.yaml - sed -i '' 's/libcurl-static >=8.4.0/libcurl-static >=8.4.0,<8.10/g' recipe/meta.yaml - - name: Pin libcurl - if: ${{ matrix.platform == 'linux' }} - run: | - cd micromamba-feedstock/ - sed -i 's/libcurl >=8.4.0/libcurl >=8.4.0,<8.10/g' recipe/meta.yaml - sed -i 's/libcurl-static >=8.4.0/libcurl-static >=8.4.0,<8.10/g' recipe/meta.yaml - name: Checkout mamba branch uses: actions/checkout@v4 with: diff --git a/dev/environment-dev.yml b/dev/environment-dev.yml index ae90134024..f4827b683e 100644 --- a/dev/environment-dev.yml +++ b/dev/environment-dev.yml @@ -11,7 +11,7 @@ dependencies: - cpp-expected - fmt - libarchive - - libcurl >=7.86,<8.10 + - libcurl >=7.86 - libsodium - libsolv >=0.7.18 - nlohmann_json diff --git a/dev/environment-micromamba-static.yml b/dev/environment-micromamba-static.yml index 4cc7196e24..c404dd6186 100644 --- a/dev/environment-micromamba-static.yml +++ b/dev/environment-micromamba-static.yml @@ -17,8 +17,8 @@ dependencies: - yaml-cpp-static >=0.8.0 - reproc-static >=14.2.4.post0 - reproc-cpp-static >=14.2.4.post0 - - libcurl >=8.4.0,<8.10 - - libcurl-static >=8.4.0,<8.10 + - libcurl >=8.4.0 + - libcurl-static >=8.4.0 - xz-static - libssh2-static - libarchive-minimal-static From 607c39035c69aeda1e12a9850bb70013c29ec02b Mon Sep 17 00:00:00 2001 From: Hind-M <70631848+Hind-M@users.noreply.github.com> Date: Mon, 21 Oct 2024 09:18:57 +0200 Subject: [PATCH 080/126] Correctly rename test to be run (#3545) * Correctly rename test to be run * Fix test * Skip oci test * Real fix hopefully * Skip test on windows * Adjust comment --- libmamba/include/mamba/specs/package_info.hpp | 5 +++++ libmamba/src/core/package_fetcher.cpp | 18 ++++++++++++++++-- micromamba/tests/test_install.py | 6 +++++- 3 files changed, 26 insertions(+), 3 deletions(-) diff --git a/libmamba/include/mamba/specs/package_info.hpp b/libmamba/include/mamba/specs/package_info.hpp index cdd8916d55..9ee9fd783b 100644 --- a/libmamba/include/mamba/specs/package_info.hpp +++ b/libmamba/include/mamba/specs/package_info.hpp @@ -50,12 +50,17 @@ namespace mamba::specs std::vector track_features = {}; std::vector dependencies = {}; std::vector constrains = {}; + // WARNING Be aware that `defaulted_keys` value, if set later, + // is not passed when going through `make_package_info` from libsolv std::vector defaulted_keys = {}; NoArchType noarch = NoArchType::No; std::size_t size = 0; std::size_t timestamp = 0; // FIXME this is a temporary hack to accommodate Python wheels but wheels and conda // PackageInfo, should really be split in different types. + // WARNING Be aware that `package_type` value, + // if set later to anything other than default (PackageType::Unknown), + // will not be passed when going through `make_package_info` from libsolv PackageType package_type = PackageType::Unknown; [[nodiscard]] static auto from_url(std::string_view url) -> expected_parse_t; diff --git a/libmamba/src/core/package_fetcher.cpp b/libmamba/src/core/package_fetcher.cpp index 6bfb0deaef..cd62744f4c 100644 --- a/libmamba/src/core/package_fetcher.cpp +++ b/libmamba/src/core/package_fetcher.cpp @@ -325,12 +325,26 @@ namespace mamba std::string PackageFetcher::channel() const { - return m_package_info.channel; + if (!util::starts_with(m_package_info.package_url, "file://")) + { + return m_package_info.channel; + } + else // local package case + { + return ""; + } } std::string PackageFetcher::url_path() const { - return util::concat(m_package_info.platform, '/', m_package_info.filename); + if (!util::starts_with(m_package_info.package_url, "file://")) + { + return util::concat(m_package_info.platform, '/', m_package_info.filename); + } + else // local package case + { + return m_package_info.package_url; + } } const std::string& PackageFetcher::url() const diff --git a/micromamba/tests/test_install.py b/micromamba/tests/test_install.py index 9d256a78a2..e517e41fa0 100644 --- a/micromamba/tests/test_install.py +++ b/micromamba/tests/test_install.py @@ -614,7 +614,11 @@ def test_no_reinstall(self, existing_cache): reinstall_res = helpers.install("xtensor", "--json") assert "actions" not in reinstall_res - def install_local_package(self): + @pytest.mark.skipif( + sys.platform == "win32", + reason="Set info (e.g 'name') is wrong (to be fixed)", + ) + def test_install_local_package(self): """Attempts to install a .tar.bz2 package from a local directory.""" file_path = Path(__file__).parent / "data" / "cph_test_data-0.0.1-0.tar.bz2" From 038c4c361362939e6a39f4551f2228de0042f7bf Mon Sep 17 00:00:00 2001 From: Hind-M <70631848+Hind-M@users.noreply.github.com> Date: Mon, 21 Oct 2024 12:52:45 +0200 Subject: [PATCH 081/126] [windows-vcpkg] Replace deprecated openssl with crypto feature with latest libarchive (#3556) Replace deprecated openssl with crypto in libarchive features --- vcpkg.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/vcpkg.json b/vcpkg.json index 6c2b0efca7..b34c7ca967 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -13,7 +13,7 @@ "lz4", "lzma", "lzo", - "openssl", + "crypto", "zstd" ], "name": "libarchive" From 3d9486fea5924538eef304767c34ae3b1e302eb9 Mon Sep 17 00:00:00 2001 From: Hind-M <70631848+Hind-M@users.noreply.github.com> Date: Mon, 21 Oct 2024 15:09:57 +0200 Subject: [PATCH 082/126] Fix relative path in local channel (#3540) Fix relative path in local channels --- libmamba/src/specs/unresolved_channel.cpp | 9 ++++++++- .../tests/src/specs/test_unresolved_channel.cpp | 10 +++++++++- micromamba/tests/test_install.py | 13 +++++++++++++ 3 files changed, 30 insertions(+), 2 deletions(-) diff --git a/libmamba/src/specs/unresolved_channel.cpp b/libmamba/src/specs/unresolved_channel.cpp index d59c028de0..012c2402d2 100644 --- a/libmamba/src/specs/unresolved_channel.cpp +++ b/libmamba/src/specs/unresolved_channel.cpp @@ -113,7 +113,14 @@ namespace mamba::specs auto parse_path(std::string_view str) -> std::string { - auto out = util::path_to_posix(fs::u8path(str).lexically_normal().string()); + auto out = fs::u8path(str).lexically_normal().string(); + // Using `lexically_normal()` removes the information of the relative path + // => adding it back if originally there + if (str.substr(0, 2) == "./") + { + out = "./" + out; + } + out = util::path_to_posix(out); out = util::rstrip(out, '/'); return out; } diff --git a/libmamba/tests/src/specs/test_unresolved_channel.cpp b/libmamba/tests/src/specs/test_unresolved_channel.cpp index 1a88162efd..2bce994f29 100644 --- a/libmamba/tests/src/specs/test_unresolved_channel.cpp +++ b/libmamba/tests/src/specs/test_unresolved_channel.cpp @@ -137,7 +137,15 @@ TEST_SUITE("specs::unresolved_channel") { const auto uc = UnresolvedChannel::parse("./folder/../folder/.").value(); CHECK_EQ(uc.type(), Type::Path); - CHECK_EQ(uc.location(), "folder"); + CHECK_EQ(uc.location(), "./folder"); + CHECK_EQ(uc.platform_filters(), PlatformSet{}); + } + + SUBCASE("./folder/subfolder/") + { + const auto uc = UnresolvedChannel::parse("./folder/subfolder/").value(); + CHECK_EQ(uc.type(), Type::Path); + CHECK_EQ(uc.location(), "./folder/subfolder"); CHECK_EQ(uc.platform_filters(), PlatformSet{}); } diff --git a/micromamba/tests/test_install.py b/micromamba/tests/test_install.py index e517e41fa0..3cd3feaf67 100644 --- a/micromamba/tests/test_install.py +++ b/micromamba/tests/test_install.py @@ -625,6 +625,19 @@ def test_install_local_package(self): res = helpers.install(f"file://{file_path}", "--json", default_channel=False) assert "cph_test_data" in {pkg["name"] for pkg in res["actions"]["LINK"]} + def test_install_local_package_relative_path(self): + """Attempts to install a locally built package from a relative local path.""" + spec = "./micromamba/tests/test-server/repo::test-package" + res = helpers.install(spec, "--json", default_channel=False) + assert res["success"] + + pkgs = res["actions"]["LINK"] + assert len(pkgs) == 1 + pkg = pkgs[0] + assert pkg["name"] == "test-package" + assert pkg["version"] == "0.1" + assert pkg["url"].startswith("file://") + def test_force_reinstall(self, existing_cache): """Force reinstall installs existing package again.""" res = helpers.install("xtensor", "--json") From 651622b72db5c8c665a21ee9b9e8d624856c0308 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Klaim=20=28Jo=C3=ABl=20Lamotte=29?= <142265+Klaim@users.noreply.github.com> Date: Mon, 21 Oct 2024 17:31:18 +0200 Subject: [PATCH 083/126] windows shell init files use executable name (#3546) * shell-init: Windows bat paths are factorized and depend on exe name (micromamba or mamba) except for mamba_hook.bat which for now needs to keep that name whatever the exe name; * Fixed windows version detection: When more than one line of output appears at the start of cmd (because of AUTORUN), we parsed only the first line which failed the version detection. This version simply search every line instead of just the first one. It also clarifies through more precise logs the exact reason why enabling long-paths actually failed. * Improved error output for clarity on failure to create shell-init files (.bat) or directories. --------- Co-authored-by: Johan Mabille --- .gitignore | 3 + libmamba/data/activate.bat | 2 +- libmamba/data/mamba.bat | 18 +-- libmamba/data/mamba_hook.bat | 4 +- libmamba/src/core/shell_init.cpp | 195 +++++++++++++++++++++---------- libmamba/src/core/util_os.cpp | 30 +++-- libmamba/src/util/os_win.cpp | 7 +- 7 files changed, 173 insertions(+), 86 deletions(-) diff --git a/.gitignore b/.gitignore index 864ad9a845..e0df28aa6c 100644 --- a/.gitignore +++ b/.gitignore @@ -89,3 +89,6 @@ installed.json tmp/ test_7.json.state _skbuild/ + + +/vcpkg_installed/ diff --git a/libmamba/data/activate.bat b/libmamba/data/activate.bat index 0b63e3ee9b..43dd00033a 100644 --- a/libmamba/data/activate.bat +++ b/libmamba/data/activate.bat @@ -1,5 +1,5 @@ @REM Copyright (C) 2021 QuantStack @REM SPDX-License-Identifier: BSD-3-Clause -@CALL "%~dp0..\condabin\mamba_hook.bat" +@CALL "%~dp0..\condabin\__MAMBA_INSERT_HOOK_BAT_NAME__" __MAMBA_INSERT_EXE_NAME__ activate %* diff --git a/libmamba/data/mamba.bat b/libmamba/data/mamba.bat index 5170368093..82463d8aec 100644 --- a/libmamba/data/mamba.bat +++ b/libmamba/data/mamba.bat @@ -3,21 +3,21 @@ @REM Replaced by mamba executable with the MAMBA_EXE and MAMBA_ROOT_PREFIX variable pointing @REM to the correct locations. -__MAMBA_INSERT_MAMBA_EXE__ -__MAMBA_INSERT_ROOT_PREFIX__ +__MAMBA_DEFINE_MAMBA_EXE__ +__MAMBA_DEFINE_ROOT_PREFIX__ -@IF [%1]==[activate] "%~dp0_mamba_activate" %* -@IF [%1]==[deactivate] "%~dp0_mamba_activate" %* +@IF [%1]==[activate] "%~dp0__MAMBA_INSERT_ACTIVATE_BAT_NAME__" %* +@IF [%1]==[deactivate] "%~dp0__MAMBA_INSERT_ACTIVATE_BAT_NAME__" %* @CALL "%MAMBA_EXE%" %* @IF %errorlevel% NEQ 0 EXIT /B %errorlevel% -@IF [%1]==[install] "%~dp0_mamba_activate" reactivate -@IF [%1]==[update] "%~dp0_mamba_activate" reactivate -@IF [%1]==[upgrade] "%~dp0_mamba_activate" reactivate -@IF [%1]==[remove] "%~dp0_mamba_activate" reactivate -@IF [%1]==[uninstall] "%~dp0_mamba_activate" reactivate +@IF [%1]==[install] "%~dp0__MAMBA_INSERT_ACTIVATE_BAT_NAME__" reactivate +@IF [%1]==[update] "%~dp0__MAMBA_INSERT_ACTIVATE_BAT_NAME__" reactivate +@IF [%1]==[upgrade] "%~dp0__MAMBA_INSERT_ACTIVATE_BAT_NAME__" reactivate +@IF [%1]==[remove] "%~dp0__MAMBA_INSERT_ACTIVATE_BAT_NAME__" reactivate +@IF [%1]==[uninstall] "%~dp0__MAMBA_INSERT_ACTIVATE_BAT_NAME__" reactivate @IF [%1]==[self-update] @CALL DEL /f %MAMBA_EXE%.bkup @EXIT /B %errorlevel% diff --git a/libmamba/data/mamba_hook.bat b/libmamba/data/mamba_hook.bat index 0c314eca81..64c3a20dc8 100644 --- a/libmamba/data/mamba_hook.bat +++ b/libmamba/data/mamba_hook.bat @@ -7,9 +7,9 @@ @FOR %%F in ("%~dp0") do @SET "__mambabin_dir=%%~dpF" @SET "__mambabin_dir=%__mambabin_dir:~0,-1%" @SET "PATH=%__mambabin_dir%;%PATH%" -@SET "MAMBA_BAT=%__mambabin_dir%\mamba.bat" +@SET "MAMBA_BAT=%__mambabin_dir%\__MAMBA_INSERT_BAT_NAME__" @FOR %%F in ("%__mambabin_dir%") do @SET "__mamba_root=%%~dpF" -__MAMBA_INSERT_MAMBA_EXE__ +__MAMBA_DEFINE_MAMBA_EXE__ @SET __mambabin_dir= @SET __mamba_root= diff --git a/libmamba/src/core/shell_init.cpp b/libmamba/src/core/shell_init.cpp index d4d6744d92..af63dbc0d3 100644 --- a/libmamba/src/core/shell_init.cpp +++ b/libmamba/src/core/shell_init.cpp @@ -13,6 +13,7 @@ #include #include #include +#include #include #ifdef _WIN32 #include @@ -42,9 +43,6 @@ namespace mamba static const std::regex MAMBA_INITIALIZE_PS_RE_BLOCK("\n?#region mamba initialize(?:\n|\r\n)?" "([\\s\\S]*?)" "#endregion(?:\n|\r\n)?"); - static const std::wregex - MAMBA_CMDEXE_HOOK_REGEX(L"(\"[^\"]*?mamba[-_]hook\\.bat\")", std::regex_constants::icase); - } std::string guess_shell() @@ -102,7 +100,67 @@ namespace mamba return ""; } + namespace // Windows-specific but must be available for cli on all platforms + { + struct RunInfo + { + fs::u8path this_exe_path = get_self_exe_path(); + fs::u8path this_exe_name_path = this_exe_path.stem(); + std::string this_exe_name = this_exe_name_path; + }; + + const RunInfo& run_info() + { + static const RunInfo info; + return info; + } + + struct ShellInitPathsWindowsCmd + { + fs::u8path condabin; + fs::u8path scripts; + + fs::u8path mamba_bat; + fs::u8path _mamba_activate_bat; + fs::u8path condabin_activate_bat; + fs::u8path scripts_activate_bat; + fs::u8path mamba_hook_bat; + + explicit ShellInitPathsWindowsCmd(fs::u8path root_prefix) + : condabin(root_prefix / "condabin") + , scripts(root_prefix / "Scripts") + , mamba_bat(condabin / (run_info().this_exe_name + ".bat")) + , _mamba_activate_bat(condabin / ("_" + run_info().this_exe_name + "_activate.bat")) + , condabin_activate_bat(condabin / "activate.bat") + , scripts_activate_bat(scripts / "activate.bat") + , mamba_hook_bat(condabin / "mamba_hook.bat") + { + } + + auto every_generated_files_paths() const -> std::vector + { + return { mamba_bat, + _mamba_activate_bat, + condabin_activate_bat, + scripts_activate_bat, + mamba_hook_bat }; + } + + auto every_generated_directories_paths() const -> std::vector + { + return { condabin, scripts }; + } + }; + + + } + + #ifdef _WIN32 + + static const std::wregex + MAMBA_CMDEXE_HOOK_REGEX(L"(\"[^\"]*?mamba[-_]hook\\.bat\")", std::regex_constants::icase); + std::wstring get_autorun_registry_key(const std::wstring& reg_path) { winreg::RegKey key{ HKEY_CURRENT_USER, reg_path }; @@ -137,9 +195,9 @@ namespace mamba std::wstring get_hook_string(const fs::u8path& conda_prefix) { - // '"%s"' % join(conda_prefix, 'condabin', 'conda_hook.bat') - return std::wstring(L"\"") + (conda_prefix / "condabin" / "mamba_hook.bat").wstring() - + std::wstring(L"\""); + const ShellInitPathsWindowsCmd paths{ conda_prefix }; + auto hook_path = fs::canonical(paths.mamba_hook_bat).std_path(); + return fmt::format(LR"("{}")", hook_path.make_preferred().wstring()); } void @@ -163,7 +221,11 @@ namespace mamba { if (!new_value.empty()) { - new_value += L" & " + hook_string; + if (new_value.find(hook_string) == std::wstring::npos) + { + new_value += L" & " + hook_string; + } + // else the hook path already exists in the string } else { @@ -685,76 +747,92 @@ namespace mamba void init_root_prefix_cmdexe(const Context&, const fs::u8path& root_prefix) { - fs::u8path exe = get_self_exe_path(); - fs::u8path exe_name = exe.stem(); + const ShellInitPathsWindowsCmd paths{ root_prefix }; - try - { - fs::create_directories(root_prefix / "condabin"); - fs::create_directories(root_prefix / "Scripts"); - } - catch (...) + for (const auto directory : paths.every_generated_directories_paths()) { // Maybe the prefix isn't writable. No big deal, just keep going. + std::error_code maybe_error [[maybe_unused]]; + fs::create_directories(directory, maybe_error); + if (maybe_error) + { + LOG_ERROR << "Failed to create directory '" << directory.string() + << "' : " << maybe_error.message(); + } } + + const auto replace_insert_root_prefix = [&](auto& text) + { + return util::replace_all( + text, + std::string("__MAMBA_DEFINE_ROOT_PREFIX__"), + "@SET \"MAMBA_ROOT_PREFIX=" + root_prefix.string() + "\"" + ); + }; + + const auto replace_insert_mamba_exe = [&](auto& text) + { + return util::replace_all( + text, + std::string("__MAMBA_DEFINE_MAMBA_EXE__"), + "@SET \"MAMBA_EXE=" + run_info().this_exe_path.string() + "\"" + ); + }; + + static const auto MARKER_INSERT_EXE_NAME = std::string("__MAMBA_INSERT_EXE_NAME__"); + static const auto MARKER_INSERT_MAMBA_BAT_NAME = std::string("__MAMBA_INSERT_BAT_NAME__"); + // mamba.bat std::string mamba_bat_contents(data_mamba_bat); - util::replace_all( - mamba_bat_contents, - std::string("__MAMBA_INSERT_ROOT_PREFIX__"), - "@SET \"MAMBA_ROOT_PREFIX=" + root_prefix.string() + "\"" + replace_insert_root_prefix(mamba_bat_contents); + replace_insert_mamba_exe(mamba_bat_contents); + static const auto MARKER_MAMBA_INSERT_ACTIVATE_BAT_NAME = std::string( + "__MAMBA_INSERT_ACTIVATE_BAT_NAME__" ); util::replace_all( mamba_bat_contents, - std::string("__MAMBA_INSERT_MAMBA_EXE__"), - "@SET \"MAMBA_EXE=" + exe.string() + "\"" + MARKER_MAMBA_INSERT_ACTIVATE_BAT_NAME, + paths._mamba_activate_bat.stem().string() ); - std::ofstream mamba_bat_f = open_ofstream(root_prefix / "condabin" / "mamba.bat"); + std::ofstream mamba_bat_f = open_ofstream(paths.mamba_bat); mamba_bat_f << mamba_bat_contents; // _mamba_activate.bat - std::ofstream _mamba_activate_bat_f = open_ofstream( - root_prefix / "condabin" / "_mamba_activate.bat" - ); + std::ofstream _mamba_activate_bat_f = open_ofstream(paths._mamba_activate_bat); _mamba_activate_bat_f << data__mamba_activate_bat; // condabin/activate.bat std::string activate_bat_contents(data_activate_bat); - util::replace_all( - activate_bat_contents, - std::string("__MAMBA_INSERT_ROOT_PREFIX__"), - "@SET \"MAMBA_ROOT_PREFIX=" + root_prefix.string() + "\"" - ); - util::replace_all( - activate_bat_contents, - std::string("__MAMBA_INSERT_MAMBA_EXE__"), - "@SET \"MAMBA_EXE=" + exe.string() + "\"" + replace_insert_root_prefix(activate_bat_contents); + replace_insert_mamba_exe(activate_bat_contents); + util::replace_all(activate_bat_contents, MARKER_INSERT_EXE_NAME, run_info().this_exe_name); + static const auto MARKER_MAMBA_INSERT_HOOK_BAT_NAME = std::string( + "__MAMBA_INSERT_HOOK_BAT_NAME__" ); util::replace_all( activate_bat_contents, - std::string("__MAMBA_INSERT_EXE_NAME__"), - exe_name.string() - ); - std::ofstream condabin_activate_bat_f = open_ofstream( - root_prefix / "condabin" / "activate.bat" + MARKER_MAMBA_INSERT_HOOK_BAT_NAME, + paths.mamba_hook_bat.filename().string() ); + std::ofstream condabin_activate_bat_f = open_ofstream(paths.condabin_activate_bat); condabin_activate_bat_f << activate_bat_contents; // Scripts/activate.bat - std::ofstream scripts_activate_bat_f = open_ofstream(root_prefix / "Scripts" / "activate.bat"); + std::ofstream scripts_activate_bat_f = open_ofstream(paths.scripts_activate_bat); scripts_activate_bat_f << activate_bat_contents; // mamba_hook.bat std::string hook_content = data_mamba_hook_bat; + replace_insert_mamba_exe(hook_content); + util::replace_all(hook_content, MARKER_INSERT_EXE_NAME, run_info().this_exe_name); util::replace_all( hook_content, - std::string("__MAMBA_INSERT_MAMBA_EXE__"), - "@SET \"MAMBA_EXE=" + exe.string() + "\"" + MARKER_INSERT_MAMBA_BAT_NAME, + paths.mamba_bat.filename().string() ); - util::replace_all(hook_content, std::string("__MAMBA_INSERT_EXE_NAME__"), exe_name.string()); - std::ofstream mamba_hook_bat_f = open_ofstream(root_prefix / "condabin" / "mamba_hook.bat"); + std::ofstream mamba_hook_bat_f = open_ofstream(paths.mamba_hook_bat); mamba_hook_bat_f << hook_content; } @@ -765,21 +843,12 @@ namespace mamba return; } - auto mamba_bat = root_prefix / "condabin" / "mamba.bat"; - auto _mamba_activate_bat = root_prefix / "condabin" / "_mamba_activate.bat"; - auto condabin_activate_bat = root_prefix / "condabin" / "activate.bat"; - auto scripts_activate_bat = root_prefix / "Scripts" / "activate.bat"; - auto mamba_hook_bat = root_prefix / "condabin" / "mamba_hook.bat"; + const ShellInitPathsWindowsCmd paths{ root_prefix }; - for (auto& f : { mamba_bat, - _mamba_activate_bat, - condabin_activate_bat, - scripts_activate_bat, - mamba_hook_bat }) + for (auto& f : paths.every_generated_files_paths()) { - if (fs::exists(f)) + if (fs::remove(f)) { - fs::remove(f); LOG_INFO << "Removed " << f << " file."; } else @@ -789,14 +858,14 @@ namespace mamba } // remove condabin and Scripts if empty - auto condabin = root_prefix / "condabin"; - auto scripts = root_prefix / "Scripts"; - for (auto& d : { condabin, scripts }) + for (auto& d : paths.every_generated_directories_paths()) { - if (fs::exists(d) && fs::is_empty(d)) + if (fs::is_empty(d)) { - fs::remove(d); - LOG_INFO << "Removed " << d << " directory."; + if (fs::remove(d)) + { + LOG_INFO << "Removed " << d << " directory."; + } } } } @@ -1340,7 +1409,7 @@ namespace mamba #ifdef _WIN32 // cmd.exe - std::wstring reg = get_autorun_registry_key(L"Software\\Microsoft\\Command Processor"); + const std::wstring reg = get_autorun_registry_key(L"Software\\Microsoft\\Command Processor"); if (std::regex_match(reg, MAMBA_CMDEXE_HOOK_REGEX)) { result.push_back("cmd.exe"); diff --git a/libmamba/src/core/util_os.cpp b/libmamba/src/core/util_os.cpp index fd6e38ee07..6ed3357cbb 100644 --- a/libmamba/src/core/util_os.cpp +++ b/libmamba/src/core/util_os.cpp @@ -50,9 +50,8 @@ namespace mamba fs::u8path get_self_exe_path() { #ifdef _WIN32 - DWORD size; std::wstring buffer(MAX_PATH, '\0'); - size = GetModuleFileNameW(NULL, (wchar_t*) buffer.c_str(), (DWORD) buffer.size()); + DWORD size = GetModuleFileNameW(NULL, (wchar_t*) buffer.c_str(), (DWORD) buffer.size()); if (size == 0) { throw std::runtime_error("Could find location of the micromamba executable!"); @@ -140,19 +139,28 @@ namespace mamba { // Needs to be set system-wide & can only be run as admin ... - auto win_ver = util::windows_version(); + const auto win_ver = util::windows_version(); + LOG_DEBUG << fmt::format( + "Windows version : {}", + win_ver ? win_ver.value() : win_ver.error().message + ); + + static constexpr auto error_message_wrong_version = "Not setting long path registry key;" + "Windows version must be at least 10 with the fall 2016 \"Anniversary update\" or newer."; + if (!win_ver.has_value()) { - LOG_WARNING << "Not setting long path registry key; Windows version must be at least 10 " - "with the fall 2016 \"Anniversary update\" or newer."; + LOG_WARNING << "failed to acquire Windows version - " << error_message_wrong_version; return false; } + + auto split_out = util::split(win_ver.value(), "."); if (!(split_out.size() >= 3 && std::stoull(split_out[0]) >= 10 && std::stoull(split_out[2]) >= 14352)) { - LOG_WARNING << "Not setting long path registry key; Windows version must be at least 10 " - "with the fall 2016 \"Anniversary update\" or newer."; + LOG_WARNING << "Windows version found:" << win_ver.value() << " - " + << error_message_wrong_version; return false; } @@ -165,7 +173,8 @@ namespace mamba } catch (const winreg::RegException& /*e*/) { - LOG_INFO << "No LongPathsEnabled key detected."; + LOG_INFO << "No LongPathsEnabled key detected. (Windows version = " << win_ver.value() + << ")"; return false; } @@ -174,8 +183,9 @@ namespace mamba auto out = Console::stream(); fmt::print( out, - "{}", - fmt::styled("Windows long-path support already enabled.", palette.ignored) + "{} (Windows version = {})", + fmt::styled("Windows long-path support already enabled.", palette.ignored), + win_ver.value() ); return true; } diff --git a/libmamba/src/util/os_win.cpp b/libmamba/src/util/os_win.cpp index 2d10fdb06e..71acf931ba 100644 --- a/libmamba/src/util/os_win.cpp +++ b/libmamba/src/util/os_win.cpp @@ -218,7 +218,12 @@ namespace mamba::util // from python static const auto ver_output_regex = std::regex(R"((?:([\w ]+) ([\w.]+) .*\[.* ([\d.]+)\]))"); - if (auto rmatch = std::smatch(); std::regex_match(out, rmatch, ver_output_regex)) + // The output of the command could contain multiple unrelated lines, so we need to check + // every lines, which is why we need to search in a loop until reaching the end of the + // output. + std::smatch rmatch; + auto start_it = out.cbegin(); + while (std::regex_search(start_it, out.cend(), rmatch, ver_output_regex)) { std::string full_version = rmatch[3]; auto version_elems = util::split(full_version, "."); From dfcc7c0bf1f33505f39a4e0870d5c5d4d7ff019f Mon Sep 17 00:00:00 2001 From: Julien Jerphanion Date: Tue, 22 Oct 2024 15:20:21 +0200 Subject: [PATCH 084/126] fix: Export the environment prefix in specification (#3562) Signed-off-by: Julien Jerphanion --- micromamba/src/env.cpp | 5 ++++- micromamba/tests/test_env.py | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/micromamba/src/env.cpp b/micromamba/src/env.cpp index b3d8761b6f..b7573f8e1a 100644 --- a/micromamba/src/env.cpp +++ b/micromamba/src/env.cpp @@ -187,7 +187,7 @@ set_env_command(CLI::App* com, Configuration& config) if (from_history) { - dependencies << "- " << requested_specs_map[k].str() << "\n"; + dependencies << " - " << requested_specs_map[k].str() << "\n"; } else { @@ -222,6 +222,9 @@ set_env_command(CLI::App* com, Configuration& config) std::cout << "- " << c << "\n"; } std::cout << "dependencies:\n" << dependencies.str() << std::endl; + + std::cout << "prefix: " << ctx.prefix_params.target_prefix << std::endl; + std::cout.flush(); } } diff --git a/micromamba/tests/test_env.py b/micromamba/tests/test_env.py index 3dbae15fb5..19dc6c2a03 100644 --- a/micromamba/tests/test_env.py +++ b/micromamba/tests/test_env.py @@ -83,6 +83,7 @@ def test_env_export(export_env, explicit_flag, md5_flag, channel_subdir_flag): else: ret = yaml.safe_load(output) assert ret["name"] == export_env + assert "env-create-export" in ret["prefix"] assert set(ret["channels"]) == {"conda-forge"} assert "micromamba=0.24.0=0" in str(ret["dependencies"]) if md5_flag == "--md5": From d26c7f5632fc40a94768a93fe64a865ed39ba5fe Mon Sep 17 00:00:00 2001 From: Julien Jerphanion Date: Tue, 22 Oct 2024 16:32:41 +0200 Subject: [PATCH 085/126] fix: Support `conda env export` `no-builds` flag (#3563) Signed-off-by: Julien Jerphanion --- micromamba/src/env.cpp | 3 ++- micromamba/tests/test_env.py | 9 +++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/micromamba/src/env.cpp b/micromamba/src/env.cpp index b7573f8e1a..1524b6b889 100644 --- a/micromamba/src/env.cpp +++ b/micromamba/src/env.cpp @@ -114,7 +114,8 @@ set_env_command(CLI::App* com, Configuration& config) export_subcom->add_flag("-e,--explicit", explicit_format, "Use explicit format"); export_subcom->add_flag("--no-md5,!--md5", no_md5, "Disable md5"); - export_subcom->add_flag("--no-build,!--build", no_build, "Disable the build string in spec"); + export_subcom + ->add_flag("--no-build,--no-builds,!--build", no_build, "Disable the build string in spec"); export_subcom->add_flag("--channel-subdir", channel_subdir, "Enable channel/subdir in spec"); export_subcom->add_flag( "--from-history", diff --git a/micromamba/tests/test_env.py b/micromamba/tests/test_env.py index 19dc6c2a03..f0547bba01 100644 --- a/micromamba/tests/test_env.py +++ b/micromamba/tests/test_env.py @@ -73,7 +73,8 @@ def export_env(): @pytest.mark.parametrize("channel_subdir_flag", [None, "--channel-subdir"]) @pytest.mark.parametrize("md5_flag", [None, "--md5", "--no-md5"]) @pytest.mark.parametrize("explicit_flag", [None, "--explicit"]) -def test_env_export(export_env, explicit_flag, md5_flag, channel_subdir_flag): +@pytest.mark.parametrize("no_build_flag", [None, "--no-build", "--no-builds"]) +def test_env_export(export_env, no_build_flag, explicit_flag, md5_flag, channel_subdir_flag): flags = filter(None, [explicit_flag, md5_flag, channel_subdir_flag]) output = helpers.run_env("export", "-n", export_env, *flags) if explicit_flag: @@ -85,7 +86,11 @@ def test_env_export(export_env, explicit_flag, md5_flag, channel_subdir_flag): assert ret["name"] == export_env assert "env-create-export" in ret["prefix"] assert set(ret["channels"]) == {"conda-forge"} - assert "micromamba=0.24.0=0" in str(ret["dependencies"]) + assert ( + "micromamba=0.24.0\n" + if no_build_flag + else "micromamba=0.24.0=0" in str(ret["dependencies"]) + ) if md5_flag == "--md5": assert re.search(r"micromamba=0.24.0=0\[md5=[a-f0-9]{32}\]", str(ret["dependencies"])) if channel_subdir_flag: From d2d16517ed26221cb30ddcfbf8ed5a03088d65bb Mon Sep 17 00:00:00 2001 From: Julien Jerphanion Date: Tue, 22 Oct 2024 17:31:33 +0200 Subject: [PATCH 086/126] fix: JSON output for environment export (#3559) Signed-off-by: Julien Jerphanion Co-authored-by: Johan Mabille --- micromamba/src/env.cpp | 88 ++++++++++++++++++++++++++++++++++++ micromamba/tests/test_env.py | 34 +++++++++----- 2 files changed, 110 insertions(+), 12 deletions(-) diff --git a/micromamba/src/env.cpp b/micromamba/src/env.cpp index 1524b6b889..34c4512097 100644 --- a/micromamba/src/env.cpp +++ b/micromamba/src/env.cpp @@ -130,6 +130,16 @@ set_env_command(CLI::App* com, Configuration& config) config.load(); auto channel_context = mamba::ChannelContext::make_conda_compatible(ctx); + + auto json_format = config.at("json").get_cli_config(); + + // Raise a warning if `--json` and `--explicit` are used together. + if (json_format && explicit_format) + { + std::cerr << "Warning: `--json` and `--explicit` are used together but are incompatible. The `--json` flag will be ignored." + << std::endl; + } + if (explicit_format) { // TODO: handle error @@ -164,6 +174,83 @@ set_env_command(CLI::App* com, Configuration& config) std::cout << "\n"; } } + else if (json_format) + { + auto pd = PrefixData::create(ctx.prefix_params.target_prefix, channel_context).value(); + History& hist = pd.history(); + + const auto& versions_map = pd.records(); + auto requested_specs_map = hist.get_requested_specs_map(); + std::stringstream dependencies; + std::set channels; + + for (auto it = versions_map.begin(); it != versions_map.end(); ++it) + { + auto k = it->first; + auto v = it->second; + if (from_history && requested_specs_map.find(k) == requested_specs_map.end()) + { + continue; + } + + auto chans = channel_context.make_channel(v.channel); + + if (from_history) + { + dependencies << " \"" << requested_specs_map[k].str() << "\",\n"; + } + else + { + dependencies << " \""; + if (channel_subdir) + { + dependencies + // If the size is not one, it's a custom multi channel + << ((chans.size() == 1) ? chans.front().display_name() : v.channel) + << "/" << v.platform << "::"; + } + dependencies << v.name << "=" << v.version; + if (!no_build) + { + dependencies << "=" << v.build_string; + } + if (no_md5 == -1) + { + dependencies << "[md5=" << v.md5 << "]"; + } + auto last_dep = std::next(it) == versions_map.end(); + dependencies << "\"" << (last_dep ? "" : ",") << "\n"; + } + + for (const auto& chan : chans) + { + channels.insert(chan.display_name()); + } + } + std::cout << "{\n"; + + if (!channels.empty()) + { + std::cout << " \"channels\": [\n"; + for (auto channel_it = channels.begin(); channel_it != channels.end(); + ++channel_it) + { + auto last_channel = std::next(channel_it) == channels.end(); + std::cout << " \"" << *channel_it << "\"" << (last_channel ? "" : ",") + << "\n"; + } + std::cout << " ],\n"; + } + std::cout << " \"dependencies\": [\n" << dependencies.str() << " ],\n"; + + std::cout << " \"name\": \"" << get_env_name(ctx, ctx.prefix_params.target_prefix) + << "\",\n"; + std::cout << " \"prefix\": " << ctx.prefix_params.target_prefix << "\n"; + + std::cout << "}\n"; + + std::cout.flush(); + } else { auto pd = PrefixData::create(ctx.prefix_params.target_prefix, channel_context).value(); @@ -177,6 +264,7 @@ set_env_command(CLI::App* com, Configuration& config) auto requested_specs_map = hist.get_requested_specs_map(); std::stringstream dependencies; std::set channels; + for (const auto& [k, v] : versions_map) { if (from_history && requested_specs_map.find(k) == requested_specs_map.end()) diff --git a/micromamba/tests/test_env.py b/micromamba/tests/test_env.py index f0547bba01..a29dff8f3a 100644 --- a/micromamba/tests/test_env.py +++ b/micromamba/tests/test_env.py @@ -74,29 +74,39 @@ def export_env(): @pytest.mark.parametrize("md5_flag", [None, "--md5", "--no-md5"]) @pytest.mark.parametrize("explicit_flag", [None, "--explicit"]) @pytest.mark.parametrize("no_build_flag", [None, "--no-build", "--no-builds"]) -def test_env_export(export_env, no_build_flag, explicit_flag, md5_flag, channel_subdir_flag): - flags = filter(None, [explicit_flag, md5_flag, channel_subdir_flag]) +@pytest.mark.parametrize("json_flag", [None, "--json"]) +def test_env_export( + export_env, json_flag, no_build_flag, explicit_flag, md5_flag, channel_subdir_flag +): + if explicit_flag and json_flag: + # `--explicit` has precedence over `--json`, which is tested bellow. + # But we need to omit here to avoid `helpers.run_env` to parse the output as JSON and fail. + json_flag = None + + flags = filter(None, [no_build_flag, json_flag, explicit_flag, md5_flag, channel_subdir_flag]) output = helpers.run_env("export", "-n", export_env, *flags) if explicit_flag: assert "/micromamba-0.24.0-0." in output if md5_flag != "--no-md5": assert re.search("#[a-f0-9]{32}$", output.replace("\r", "")) else: - ret = yaml.safe_load(output) + if json_flag: + # Already parsed + ret = output + else: + ret = yaml.safe_load(output) assert ret["name"] == export_env assert "env-create-export" in ret["prefix"] assert set(ret["channels"]) == {"conda-forge"} - assert ( - "micromamba=0.24.0\n" - if no_build_flag - else "micromamba=0.24.0=0" in str(ret["dependencies"]) - ) - if md5_flag == "--md5": + micromamba_spec_prefix = "micromamba=0.24.0" if no_build_flag else "micromamba=0.24.0=0" + assert micromamba_spec_prefix in str(ret["dependencies"]) + if md5_flag == "--md5" and no_build_flag: + assert re.search(r"micromamba=0.24.0\[md5=[a-f0-9]{32}\]", str(ret["dependencies"])) + if md5_flag == "--md5" and no_build_flag is None: assert re.search(r"micromamba=0.24.0=0\[md5=[a-f0-9]{32}\]", str(ret["dependencies"])) + if channel_subdir_flag: - assert re.search( - r"conda-forge/[a-z0-9-]+::micromamba=0.24.0=0", str(ret["dependencies"]) - ) + assert re.search(r"conda-forge/[a-z0-9-]+::micromamba=0.24.0", str(ret["dependencies"])) def test_create(): From bd8c1d2e4d66fbaa52243120ff31d0a3d9a6a789 Mon Sep 17 00:00:00 2001 From: Julien Jerphanion Date: Wed, 23 Oct 2024 11:09:48 +0200 Subject: [PATCH 087/126] fix: Only register channels in the context once (#3521) Signed-off-by: Julien Jerphanion --- libmamba/CMakeLists.txt | 4 ++-- libmamba/src/api/install.cpp | 20 ++++++---------- libmamba/src/api/update.cpp | 11 ++------- libmamba/src/api/{pip_utils.cpp => utils.cpp} | 24 ++++++++++++++++++- libmamba/src/api/{pip_utils.hpp => utils.hpp} | 9 ++++--- 5 files changed, 40 insertions(+), 28 deletions(-) rename libmamba/src/api/{pip_utils.cpp => utils.cpp} (87%) rename libmamba/src/api/{pip_utils.hpp => utils.hpp} (80%) diff --git a/libmamba/CMakeLists.txt b/libmamba/CMakeLists.txt index 16716339ce..67c6fb7849 100644 --- a/libmamba/CMakeLists.txt +++ b/libmamba/CMakeLists.txt @@ -257,8 +257,8 @@ set( ${LIBMAMBA_SOURCE_DIR}/api/info.cpp ${LIBMAMBA_SOURCE_DIR}/api/install.cpp ${LIBMAMBA_SOURCE_DIR}/api/list.cpp - ${LIBMAMBA_SOURCE_DIR}/api/pip_utils.cpp - ${LIBMAMBA_SOURCE_DIR}/api/pip_utils.hpp + ${LIBMAMBA_SOURCE_DIR}/api/utils.cpp + ${LIBMAMBA_SOURCE_DIR}/api/utils.hpp ${LIBMAMBA_SOURCE_DIR}/api/remove.cpp ${LIBMAMBA_SOURCE_DIR}/api/repoquery.cpp ${LIBMAMBA_SOURCE_DIR}/api/shell.cpp diff --git a/libmamba/src/api/install.cpp b/libmamba/src/api/install.cpp index caec744866..083f42dbc0 100644 --- a/libmamba/src/api/install.cpp +++ b/libmamba/src/api/install.cpp @@ -4,6 +4,7 @@ // // The full license is in the file LICENSE, distributed with this software. +#include #include #include "mamba/api/channel_loader.hpp" @@ -26,7 +27,7 @@ #include "mamba/util/path_manip.hpp" #include "mamba/util/string.hpp" -#include "pip_utils.hpp" +#include "utils.hpp" namespace mamba { @@ -377,7 +378,7 @@ namespace mamba Context& ctx, ChannelContext& channel_context, const Configuration& config, - const std::vector& specs, + const std::vector& raw_specs, bool create_env, bool remove_prefix_on_failure, bool is_retry @@ -404,14 +405,7 @@ namespace mamba MultiPackageCache package_caches{ ctx.pkgs_dirs, ctx.validation_params }; - // add channels from specs - for (const auto& s : specs) - { - if (auto ms = specs::MatchSpec::parse(s); ms && ms->channel().has_value()) - { - ctx.channels.push_back(ms->channel()->str()); - } - } + populate_context_channels_from_specs(raw_specs, ctx); if (ctx.channels.empty() && !ctx.offline) { @@ -443,8 +437,8 @@ namespace mamba load_installed_packages_in_database(ctx, db, prefix_data); - auto request = create_install_request(prefix_data, specs, freeze_installed); - add_pins_to_request(request, ctx, prefix_data, specs, no_pin, no_py_pin); + auto request = create_install_request(prefix_data, raw_specs, freeze_installed); + add_pins_to_request(request, ctx, prefix_data, raw_specs, no_pin, no_py_pin); request.flags = ctx.solver_flags; { @@ -472,7 +466,7 @@ namespace mamba ctx, channel_context, config, - specs, + raw_specs, create_env, remove_prefix_on_failure, true diff --git a/libmamba/src/api/update.cpp b/libmamba/src/api/update.cpp index 26f679a48c..98b8d084c3 100644 --- a/libmamba/src/api/update.cpp +++ b/libmamba/src/api/update.cpp @@ -18,7 +18,7 @@ #include "mamba/solver/libsolv/solver.hpp" #include "mamba/solver/request.hpp" -#include "pip_utils.hpp" +#include "utils.hpp" namespace mamba { @@ -150,14 +150,7 @@ namespace mamba auto channel_context = ChannelContext::make_conda_compatible(ctx); - // add channels from specs - for (const auto& s : raw_update_specs) - { - if (auto ms = specs::MatchSpec::parse(s); ms && ms->channel().has_value()) - { - ctx.channels.push_back(ms->channel()->str()); - } - } + populate_context_channels_from_specs(raw_update_specs, ctx); solver::libsolv::Database db{ channel_context.params() }; add_spdlog_logger_to_database(db); diff --git a/libmamba/src/api/pip_utils.cpp b/libmamba/src/api/utils.cpp similarity index 87% rename from libmamba/src/api/pip_utils.cpp rename to libmamba/src/api/utils.cpp index f8a2a6e15b..8e3fc2fe3f 100644 --- a/libmamba/src/api/pip_utils.cpp +++ b/libmamba/src/api/utils.cpp @@ -19,7 +19,7 @@ #include "mamba/fs/filesystem.hpp" #include "mamba/util/environment.hpp" -#include "pip_utils.hpp" +#include "utils.hpp" namespace mamba { @@ -184,4 +184,26 @@ namespace mamba return command; } + + void + populate_context_channels_from_specs(const std::vector& raw_matchspecs, Context& context) + { + for (const auto& s : raw_matchspecs) + { + if (auto ms = specs::MatchSpec::parse(s); ms && ms->channel().has_value()) + { + auto channel_name = ms->channel()->str(); + auto channel_is_absent = std::find( + context.channels.begin(), + context.channels.end(), + channel_name + ) + == context.channels.end(); + if (channel_is_absent) + { + context.channels.push_back(channel_name); + } + } + } + } } diff --git a/libmamba/src/api/pip_utils.hpp b/libmamba/src/api/utils.hpp similarity index 80% rename from libmamba/src/api/pip_utils.hpp rename to libmamba/src/api/utils.hpp index 5e5e5861f9..89a2481b53 100644 --- a/libmamba/src/api/pip_utils.hpp +++ b/libmamba/src/api/utils.hpp @@ -4,8 +4,8 @@ // // The full license is in the file LICENSE, distributed with this software. -#ifndef MAMBA_PIP_UTILS_HPP -#define MAMBA_PIP_UTILS_HPP +#ifndef MAMBA_UTILS_HPP +#define MAMBA_UTILS_HPP #include #include @@ -39,6 +39,9 @@ namespace mamba pip::Update update ); + void + populate_context_channels_from_specs(const std::vector& raw_matchspecs, Context& context); + } -#endif // MAMBA_PIP_UTILS_HPP +#endif // MAMBA_UTILS_HPP From 47e962968d21123bc1f816e2686700d7b4f780c5 Mon Sep 17 00:00:00 2001 From: Hind-M <70631848+Hind-M@users.noreply.github.com> Date: Mon, 28 Oct 2024 09:43:29 +0100 Subject: [PATCH 088/126] Fix test on windows (#3555) --- libmamba/tests/src/specs/test_match_spec.cpp | 49 ++++++++++++++++++++ micromamba/tests/test_install.py | 33 ++++++++----- 2 files changed, 71 insertions(+), 11 deletions(-) diff --git a/libmamba/tests/src/specs/test_match_spec.cpp b/libmamba/tests/src/specs/test_match_spec.cpp index a0ce149f2d..a855779b5c 100644 --- a/libmamba/tests/src/specs/test_match_spec.cpp +++ b/libmamba/tests/src/specs/test_match_spec.cpp @@ -8,6 +8,7 @@ #include "mamba/specs/match_spec.hpp" #include "mamba/specs/package_info.hpp" +#include "mamba/util/build.hpp" #include "mamba/util/string.hpp" using namespace mamba; @@ -623,6 +624,54 @@ TEST_SUITE("specs::match_spec") } } + TEST_CASE("parse_url") + { + SUBCASE("https://conda.com/pkg-2-bld.conda") + { + auto ms = MatchSpec::parse_url("https://conda.com/pkg-2-bld.conda").value(); + CHECK(ms.is_file()); + CHECK_EQ(ms.name().str(), "pkg"); + CHECK_EQ(ms.version().str(), "==2"); + CHECK_EQ(ms.str(), "https://conda.com/pkg-2-bld.conda"); + CHECK_EQ(ms.build_string().str(), "bld"); + CHECK_EQ(ms.filename(), "pkg-2-bld.conda"); + } + + SUBCASE("/home/usr/mamba/micromamba/tests/data/cph_test_data-0.0.1-0.tar.bz2") + { + auto ms = MatchSpec::parse_url( + "/home/usr/mamba/micromamba/tests/data/cph_test_data-0.0.1-0.tar.bz2" + ) + .value(); + CHECK(ms.is_file()); + CHECK_EQ(ms.name().str(), "cph_test_data"); + CHECK_EQ(ms.version().str(), "==0.0.1"); + CHECK_EQ(ms.str(), "/home/usr/mamba/micromamba/tests/data/cph_test_data-0.0.1-0.tar.bz2"); + CHECK_EQ(ms.build_string().str(), "0"); + CHECK_EQ(ms.filename(), "cph_test_data-0.0.1-0.tar.bz2"); + } + + SUBCASE(R"(D:\a\mamba\mamba\micromamba\tests\data\cph_test_data-0.0.1-0.tar.bz2)") + { + if (util::on_win) + { + auto ms = MatchSpec::parse_url( + R"(D:\a\mamba\mamba\micromamba\tests\data\cph_test_data-0.0.1-0.tar.bz2)" + ) + .value(); + CHECK(ms.is_file()); + CHECK_EQ(ms.name().str(), "cph_test_data"); + CHECK_EQ(ms.version().str(), "==0.0.1"); + CHECK_EQ( + ms.str(), + "D:/a/mamba/mamba/micromamba/tests/data/cph_test_data-0.0.1-0.tar.bz2" + ); + CHECK_EQ(ms.build_string().str(), "0"); + CHECK_EQ(ms.filename(), "cph_test_data-0.0.1-0.tar.bz2"); + } + } + } + TEST_CASE("Conda discrepancies") { SUBCASE("python=3.7=bld") diff --git a/micromamba/tests/test_install.py b/micromamba/tests/test_install.py index 3cd3feaf67..2db7955afa 100644 --- a/micromamba/tests/test_install.py +++ b/micromamba/tests/test_install.py @@ -614,17 +614,6 @@ def test_no_reinstall(self, existing_cache): reinstall_res = helpers.install("xtensor", "--json") assert "actions" not in reinstall_res - @pytest.mark.skipif( - sys.platform == "win32", - reason="Set info (e.g 'name') is wrong (to be fixed)", - ) - def test_install_local_package(self): - """Attempts to install a .tar.bz2 package from a local directory.""" - file_path = Path(__file__).parent / "data" / "cph_test_data-0.0.1-0.tar.bz2" - - res = helpers.install(f"file://{file_path}", "--json", default_channel=False) - assert "cph_test_data" in {pkg["name"] for pkg in res["actions"]["LINK"]} - def test_install_local_package_relative_path(self): """Attempts to install a locally built package from a relative local path.""" spec = "./micromamba/tests/test-server/repo::test-package" @@ -676,6 +665,28 @@ def test_install_check_dirs(tmp_home, tmp_root_prefix): assert os.path.isdir(env_prefix / "lib" / "python3.8" / "site-packages") +def test_install_local_package(tmp_home, tmp_root_prefix): + env_name = "myenv" + tmp_root_prefix / "envs" / env_name + + helpers.create("-n", env_name, default_channel=False) + + """Attempts to install a .tar.bz2 package from a local directory.""" + file_path = Path(__file__).parent / "data" / "cph_test_data-0.0.1-0.tar.bz2" + res = helpers.install("-n", env_name, file_path, "--json", default_channel=False) + + assert len(res["actions"]["LINK"]) == 1 + pkg = res["actions"]["LINK"][0] + + assert pkg["name"] == "cph_test_data" + assert pkg["version"] == "0.0.1" + assert pkg["fn"] == "cph_test_data-0.0.1-0.tar.bz2" + assert pkg["channel"].startswith("file:///") + assert pkg["channel"].endswith("data") + assert pkg["url"].startswith("file:///") + assert pkg["url"].endswith("cph_test_data-0.0.1-0.tar.bz2") + + @pytest.mark.skipif( sys.platform == "darwin" and platform.machine() == "arm64", reason="Python 3.7.9 not available", From 5bfdd90adf5a714f24f5a1d9ae4f71aee400125e Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Mon, 28 Oct 2024 06:58:57 -0400 Subject: [PATCH 089/126] chore: some CMake cleanup (#3564) Signed-off-by: Henry Schreiner --- CMakeLists.txt | 2 -- .../source/developer_zone/dev_environment.rst | 2 +- .../installation/micromamba-installation.rst | 2 +- libmamba/CMakeLists.txt | 20 +++++++++---------- libmambapy/CMakeLists.txt | 10 +++------- 5 files changed, 15 insertions(+), 21 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 9ff485336a..972f95df1b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,8 +5,6 @@ # The full license is in the file LICENSE, distributed with this software. cmake_minimum_required(VERSION 3.16) -cmake_policy(SET CMP0025 NEW) # Introduced in cmake 3.0 -cmake_policy(SET CMP0077 NEW) # Introduced in cmake 3.13 project(mamba) diff --git a/docs/source/developer_zone/dev_environment.rst b/docs/source/developer_zone/dev_environment.rst index 59a4315320..371207e63d 100644 --- a/docs/source/developer_zone/dev_environment.rst +++ b/docs/source/developer_zone/dev_environment.rst @@ -37,7 +37,7 @@ Install development dependencies .. code:: bash micromamba create -n mamba -c conda-forge -f dev/environment-dev.yml - micromamba activate -n mamba + micromamba activate mamba Compile ``libmamba`` and other artifacts **************************************** diff --git a/docs/source/installation/micromamba-installation.rst b/docs/source/installation/micromamba-installation.rst index 5019083921..64d4b9148c 100644 --- a/docs/source/installation/micromamba-installation.rst +++ b/docs/source/installation/micromamba-installation.rst @@ -203,7 +203,7 @@ To build from source, install the development dependencies, using a Conda compat .. code-block:: bash micromamba create -n mamba --file dev/environment-micromamba-static.yml - micromamba activate -n mamba + micromamba activate mamba Use CMake from this environment to drive the build: diff --git a/libmamba/CMakeLists.txt b/libmamba/CMakeLists.txt index 67c6fb7849..faf54a113e 100644 --- a/libmamba/CMakeLists.txt +++ b/libmamba/CMakeLists.txt @@ -405,15 +405,15 @@ set( # Targets and link # ================ -find_package(fmt REQUIRED) -find_package(spdlog REQUIRED) -find_package(tl-expected REQUIRED) -find_package(nlohmann_json REQUIRED) -find_package(simdjson REQUIRED) -find_package(yaml-cpp REQUIRED) -find_package(reproc REQUIRED) -find_package(reproc++ REQUIRED) -find_package(Libsolv REQUIRED) +find_package(fmt CONFIG REQUIRED) +find_package(spdlog CONFIG REQUIRED) +find_package(tl-expected CONFIG REQUIRED) +find_package(nlohmann_json CONFIG REQUIRED) +find_package(simdjson CONFIG REQUIRED) +find_package(yaml-cpp CONFIG REQUIRED) +find_package(reproc CONFIG REQUIRED) +find_package(reproc++ CONFIG REQUIRED) +find_package(Libsolv MODULE REQUIRED) add_subdirectory(ext/solv-cpp) macro(libmamba_create_target target_name linkage output_name) @@ -539,7 +539,7 @@ macro(libmamba_create_target target_name linkage output_name) set(CMAKE_PREFIX_PATH "$ENV{VCPKG_ROOT}/installed/x64-windows-static-md/") # For Windows we have a vcpkg based build system right now. - find_package(LibArchive REQUIRED) + find_package(LibArchive MODULE REQUIRED) find_package(CURL CONFIG REQUIRED) find_library(LIBLZMA_LIBRARIES lzma REQUIRED) find_library(LZ4_LIBRARY NAMES lz4) diff --git a/libmambapy/CMakeLists.txt b/libmambapy/CMakeLists.txt index 5aadf84c40..e644962076 100644 --- a/libmambapy/CMakeLists.txt +++ b/libmambapy/CMakeLists.txt @@ -7,20 +7,16 @@ cmake_minimum_required(VERSION 3.18.2) include("../cmake/CompilerWarnings.cmake") -cmake_policy(SET CMP0025 NEW) -cmake_policy(SET CMP0077 NEW) -cmake_policy(SET CMP0057 NEW) - project(libmambapy) if(NOT TARGET mamba::libmamba) - find_package(libmamba REQUIRED) + find_package(libmamba CONFIG REQUIRED) set(libmamba_target mamba::libmamba-dyn) else() set(libmamba_target mamba::libmamba) endif() -find_package(Python COMPONENTS Interpreter Development) +find_package(Python COMPONENTS Interpreter Development.Module) find_package(pybind11 REQUIRED) pybind11_add_module( @@ -49,7 +45,7 @@ target_compile_features(bindings PRIVATE cxx_std_17) if(SKBUILD) install(TARGETS bindings DESTINATION ${MAMBA_INSTALL_PYTHON_EXT_LIBDIR}) else() - # WARNING: this default should probably not be used as it is but set extranlly by a proper + # WARNING: this default should probably not be used as it is but set externally by a proper # Python packager tool set( MAMBA_INSTALL_PYTHON_EXT_LIBDIR From 0075a24e4c68d447340e67bd85ba824c0e389bce Mon Sep 17 00:00:00 2001 From: Hind-M <70631848+Hind-M@users.noreply.github.com> Date: Wed, 30 Oct 2024 10:20:25 +0100 Subject: [PATCH 090/126] pip packages support with `list` (#3565) --- libmamba/include/mamba/core/activation.hpp | 2 - libmamba/include/mamba/core/prefix_data.hpp | 8 +- libmamba/include/mamba/specs/package_info.hpp | 1 + libmamba/include/mamba/util/environment.hpp | 6 ++ libmamba/src/api/install.cpp | 1 - libmamba/src/api/list.cpp | 41 ++++--- libmamba/src/api/utils.cpp | 5 +- libmamba/src/core/activation.cpp | 23 +--- libmamba/src/core/prefix_data.cpp | 102 +++++++++++++++++- libmamba/src/core/transaction.cpp | 2 - libmamba/src/specs/package_info.cpp | 8 ++ libmamba/src/util/environment.cpp | 17 +++ micromamba/tests/test_list.py | 35 ++++++ 13 files changed, 208 insertions(+), 43 deletions(-) diff --git a/libmamba/include/mamba/core/activation.hpp b/libmamba/include/mamba/core/activation.hpp index fc6569b4bd..e2ad98ab20 100644 --- a/libmamba/include/mamba/core/activation.hpp +++ b/libmamba/include/mamba/core/activation.hpp @@ -258,8 +258,6 @@ namespace mamba fs::u8path hook_source_path() override; }; - std::vector get_path_dirs(const fs::u8path& prefix); - } // namespace mamba #endif diff --git a/libmamba/include/mamba/core/prefix_data.hpp b/libmamba/include/mamba/core/prefix_data.hpp index ce9919351d..3caacb6838 100644 --- a/libmamba/include/mamba/core/prefix_data.hpp +++ b/libmamba/include/mamba/core/prefix_data.hpp @@ -28,9 +28,12 @@ namespace mamba create(const fs::u8path& prefix_path, ChannelContext& channel_context); void add_packages(const std::vector& packages); - const package_map& records() const; void load_single_record(const fs::u8path& path); + const package_map& records() const; + const package_map& pip_records() const; + package_map all_pkg_mgr_records() const; + History& history(); const fs::u8path& path() const; std::vector sorted_records() const; @@ -44,8 +47,11 @@ namespace mamba PrefixData(const fs::u8path& prefix_path, ChannelContext& channel_context); + void load_site_packages(); + History m_history; package_map m_package_records; + package_map m_pip_package_records; fs::u8path m_prefix_path; ChannelContext& m_channel_context; diff --git a/libmamba/include/mamba/specs/package_info.hpp b/libmamba/include/mamba/specs/package_info.hpp index 9ee9fd783b..d1afbe4bc4 100644 --- a/libmamba/include/mamba/specs/package_info.hpp +++ b/libmamba/include/mamba/specs/package_info.hpp @@ -68,6 +68,7 @@ namespace mamba::specs PackageInfo() = default; explicit PackageInfo(std::string name); PackageInfo(std::string name, std::string version, std::string build_string, std::size_t build_number); + PackageInfo(std::string name, std::string version, std::string build_string, std::string channel); [[nodiscard]] auto json_signable() const -> nlohmann::json; [[nodiscard]] auto str() const -> std::string; diff --git a/libmamba/include/mamba/util/environment.hpp b/libmamba/include/mamba/util/environment.hpp index 483af92a79..dc54646060 100644 --- a/libmamba/include/mamba/util/environment.hpp +++ b/libmamba/include/mamba/util/environment.hpp @@ -11,6 +11,7 @@ #include #include #include +#include #include "mamba/fs/filesystem.hpp" #include "mamba/util/build.hpp" @@ -93,6 +94,11 @@ namespace mamba::util */ [[nodiscard]] constexpr auto pathsep() -> char; + /** + * Return directories of the given prefix path. + */ + [[nodiscard]] auto get_path_dirs(const fs::u8path& prefix) -> std::vector; + /** * Return the full path of a program from its name. */ diff --git a/libmamba/src/api/install.cpp b/libmamba/src/api/install.cpp index 083f42dbc0..ea996377c8 100644 --- a/libmamba/src/api/install.cpp +++ b/libmamba/src/api/install.cpp @@ -10,7 +10,6 @@ #include "mamba/api/channel_loader.hpp" #include "mamba/api/configuration.hpp" #include "mamba/api/install.hpp" -#include "mamba/core/activation.hpp" #include "mamba/core/channel_context.hpp" #include "mamba/core/context.hpp" #include "mamba/core/env_lockfile.hpp" diff --git a/libmamba/src/api/list.cpp b/libmamba/src/api/list.cpp index 470555d9e5..35e762bd77 100644 --- a/libmamba/src/api/list.cpp +++ b/libmamba/src/api/list.cpp @@ -67,14 +67,16 @@ namespace mamba { regex = '^' + regex + '$'; } + std::regex spec_pat(regex); + auto all_records = std::move(prefix_data.all_pkg_mgr_records()); if (ctx.output_params.json) { auto jout = nlohmann::json::array(); std::vector keys; - for (const auto& pkg : prefix_data.records()) + for (const auto& pkg : all_records) { keys.push_back(pkg.first); } @@ -83,24 +85,33 @@ namespace mamba for (const auto& key : keys) { auto obj = nlohmann::json(); - const auto& pkg_info = prefix_data.records().find(key)->second; + const auto& pkg_info = all_records.find(key)->second; if (regex.empty() || std::regex_search(pkg_info.name, spec_pat)) { auto channels = channel_context.make_channel(pkg_info.package_url); assert(channels.size() == 1); // A URL can only resolve to one channel - obj["base_url"] = strip_from_filename_and_platform( - channels.front().url().str(specs::CondaURL::Credentials::Remove), - pkg_info.filename, - pkg_info.platform - ); + + if (pkg_info.package_url.empty() && (pkg_info.channel == "pypi")) + { + obj["base_url"] = "https://pypi.org/"; + obj["channel"] = pkg_info.channel; + } + else + { + obj["base_url"] = strip_from_filename_and_platform( + channels.front().url().str(specs::CondaURL::Credentials::Remove), + pkg_info.filename, + pkg_info.platform + ); + obj["channel"] = strip_from_filename_and_platform( + channels.front().display_name(), + pkg_info.filename, + pkg_info.platform + ); + } obj["build_number"] = pkg_info.build_number; obj["build_string"] = pkg_info.build_string; - obj["channel"] = strip_from_filename_and_platform( - channels.front().display_name(), - pkg_info.filename, - pkg_info.platform - ); obj["dist_name"] = pkg_info.str(); obj["name"] = pkg_info.name; obj["platform"] = pkg_info.platform; @@ -121,7 +132,7 @@ namespace mamba auto requested_specs = prefix_data.history().get_requested_specs_map(); // order list of packages from prefix_data by alphabetical order - for (const auto& package : prefix_data.records()) + for (const auto& package : all_records) { if (regex.empty() || std::regex_search(package.second.name, spec_pat)) { @@ -132,6 +143,10 @@ namespace mamba { formatted_pkgs.channel = ""; } + else if (package.second.channel == "pypi") + { + formatted_pkgs.channel = package.second.channel; + } else { auto channels = channel_context.make_channel(package.second.channel); diff --git a/libmamba/src/api/utils.cpp b/libmamba/src/api/utils.cpp index 8e3fc2fe3f..3500da7c68 100644 --- a/libmamba/src/api/utils.cpp +++ b/libmamba/src/api/utils.cpp @@ -12,8 +12,7 @@ #include // TODO includes to be removed after moving some functions/structs around -#include "mamba/api/install.hpp" // other_pkg_mgr_spec -#include "mamba/core/activation.hpp" // get_path_dirs +#include "mamba/api/install.hpp" // other_pkg_mgr_spec #include "mamba/core/context.hpp" #include "mamba/core/util.hpp" #include "mamba/fs/filesystem.hpp" @@ -33,7 +32,7 @@ namespace mamba ) { const auto get_python_path = [&] - { return util::which_in("python", get_path_dirs(target_prefix)).string(); }; + { return util::which_in("python", util::get_path_dirs(target_prefix)).string(); }; command_args cmd = { get_python_path(), "-m", "pip", "install" }; command_args cmd_extension = { "-r", spec_file, "--no-input", "--quiet" }; diff --git a/libmamba/src/core/activation.cpp b/libmamba/src/core/activation.cpp index f18485bab3..46169e7fbb 100644 --- a/libmamba/src/core/activation.cpp +++ b/libmamba/src/core/activation.cpp @@ -208,23 +208,6 @@ namespace mamba } } - std::vector get_path_dirs(const fs::u8path& prefix) - { - if (util::on_win) - { - return { prefix, - prefix / "Library" / "mingw-w64" / "bin", - prefix / "Library" / "usr" / "bin", - prefix / "Library" / "bin", - prefix / "Scripts", - prefix / "bin" }; - } - else - { - return { prefix / "bin" }; - } - } - std::vector Activator::get_PATH() { std::vector path; @@ -271,7 +254,7 @@ namespace mamba // TODO check if path_conversion does something useful here. // path_list[0:0] = list(self.path_conversion(self._get_path_dirs(prefix))) - std::vector final_path = get_path_dirs(prefix); + std::vector final_path = util::get_path_dirs(prefix); final_path.insert(final_path.end(), path_list.begin(), path_list.end()); final_path.erase(std::unique(final_path.begin(), final_path.end()), final_path.end()); std::string result = util::join(util::pathsep(), final_path).string(); @@ -285,7 +268,7 @@ namespace mamba std::vector current_path = get_PATH(); assert(!old_prefix.empty()); - std::vector old_prefix_dirs = get_path_dirs(old_prefix); + std::vector old_prefix_dirs = util::get_path_dirs(old_prefix); // remove all old paths std::vector cleaned_path; @@ -312,7 +295,7 @@ namespace mamba std::vector final_path; if (!new_prefix.empty()) { - final_path = get_path_dirs(new_prefix); + final_path = util::get_path_dirs(new_prefix); final_path.insert(final_path.end(), current_path.begin(), current_path.end()); // remove duplicates diff --git a/libmamba/src/core/prefix_data.cpp b/libmamba/src/core/prefix_data.cpp index 9c1b8c7c9b..8e5b6ad525 100644 --- a/libmamba/src/core/prefix_data.cpp +++ b/libmamba/src/core/prefix_data.cpp @@ -9,11 +9,14 @@ #include #include +#include + #include "mamba/core/channel_context.hpp" #include "mamba/core/output.hpp" #include "mamba/core/prefix_data.hpp" #include "mamba/core/util.hpp" #include "mamba/specs/conda_url.hpp" +#include "mamba/util/environment.hpp" #include "mamba/util/graph.hpp" #include "mamba/util/string.hpp" @@ -56,6 +59,8 @@ namespace mamba } } } + // Load packages installed with pip + load_site_packages(); } void PrefixData::add_packages(const std::vector& packages) @@ -73,6 +78,22 @@ namespace mamba return m_package_records; } + const PrefixData::package_map& PrefixData::pip_records() const + { + return m_pip_package_records; + } + + PrefixData::package_map PrefixData::all_pkg_mgr_records() const + { + PrefixData::package_map merged_records = m_package_records; + // Note that if the same key (pkg name) is present in both `m_package_records` and + // `m_pip_package_records`, the latter is not considered + // (this may be modified to be completely independent in the future) + merged_records.insert(m_pip_package_records.begin(), m_pip_package_records.end()); + + return merged_records; + } + std::vector PrefixData::sorted_records() const { // TODO add_pip_as_python_dependency @@ -166,10 +187,89 @@ namespace mamba auto channels = m_channel_context.make_channel(prec.channel); // If someone wrote multichannel names in repodata_record, we don't know which one is the - // correct URL. This is must never happen! + // correct URL. This must never happen! assert(channels.size() == 1); using Credentials = specs::CondaURL::Credentials; prec.channel = channels.front().platform_url(prec.platform).str(Credentials::Remove); m_package_records.insert({ prec.name, std::move(prec) }); } + + // Load python packages installed with pip in the site-packages of the prefix. + void PrefixData::load_site_packages() + { + LOG_INFO << "Loading site packages"; + + // Look for `pip` package and return if it doesn't exist + auto python_pkg_record = m_package_records.find("pip"); + if (python_pkg_record == m_package_records.end()) + { + LOG_DEBUG << "`pip` not found"; + return; + } + + // Run `pip freeze` + std::string out, err; + + const auto get_python_path = [&] + { return util::which_in("python", util::get_path_dirs(m_prefix_path)).string(); }; + + const auto args = std::array{ get_python_path(), + "-m", + "pip", + "inspect", + "--local" }; + auto [status, ec] = reproc::run( + args, + reproc::options{}, + reproc::sink::string(out), + reproc::sink::string(err) + ); + if (ec) + { + throw std::runtime_error(ec.message()); + } + + // Nothing installed with `pip` + if (out.empty()) + { + LOG_DEBUG << "Nothing installed with `pip`"; + return; + } + + nlohmann::json j = nlohmann::json::parse(out); + + if (j.contains("installed") && j["installed"].is_array()) + { + for (const auto& package : j["installed"]) + { + // Get the package metadata, if requested and installed with `pip` + if (package.contains("requested") && package.contains("installer") + && package["requested"] == true && package["installer"] == "pip") + { + if (package.contains("metadata")) + { + // NOTE As checking the presence of all used keys in the json object can be + // cumbersome and might affect the code readability, the elements where the + // check with `contains` is skipped are considered mandatory. If a bug is + // ever to occur in the future, checking the relevant key with `contains` + // should be introduced then. + auto prec = specs::PackageInfo( + package["metadata"]["name"], + package["metadata"]["version"], + "pypi_0", + "pypi" + ); + // Set platform by concatenating `sys_platform` and `platform_machine` to + // have something equivalent to `conda-forge` + if (j.contains("environment")) + { + prec.platform = j["environment"]["sys_platform"].get() + "-" + + j["environment"]["platform_machine"].get(); + } + m_pip_package_records.insert({ prec.name, std::move(prec) }); + } + } + } + } + } } // namespace mamba diff --git a/libmamba/src/core/transaction.cpp b/libmamba/src/core/transaction.cpp index cf89256f7f..e0f22dce41 100644 --- a/libmamba/src/core/transaction.cpp +++ b/libmamba/src/core/transaction.cpp @@ -362,8 +362,6 @@ namespace mamba bool MTransaction::execute(const Context& ctx, ChannelContext& channel_context, PrefixData& prefix) { - using Solution = solver::Solution; - // JSON output // back to the top level if any action was required if (!empty()) diff --git a/libmamba/src/specs/package_info.cpp b/libmamba/src/specs/package_info.cpp index dd4003bc33..527956bd1c 100644 --- a/libmamba/src/specs/package_info.cpp +++ b/libmamba/src/specs/package_info.cpp @@ -156,6 +156,14 @@ namespace mamba::specs { } + PackageInfo::PackageInfo(std::string n, std::string v, std::string b, std::string c) + : name(std::move(n)) + , version(std::move(v)) + , build_string(std::move(b)) + , channel(std::move(c)) + { + } + namespace { template diff --git a/libmamba/src/util/environment.cpp b/libmamba/src/util/environment.cpp index c6e2daa29b..f5046eade4 100644 --- a/libmamba/src/util/environment.cpp +++ b/libmamba/src/util/environment.cpp @@ -408,6 +408,23 @@ namespace mamba::util } } + auto get_path_dirs(const fs::u8path& prefix) -> std::vector + { + if (on_win) + { + return { prefix, + prefix / "Library" / "mingw-w64" / "bin", + prefix / "Library" / "usr" / "bin", + prefix / "Library" / "bin", + prefix / "Scripts", + prefix / "bin" }; + } + else + { + return { prefix / "bin" }; + } + } + auto which(std::string_view exe) -> fs::u8path { if (auto paths = get_env("PATH")) diff --git a/micromamba/tests/test_list.py b/micromamba/tests/test_list.py index 1865ed7dab..bc6e8bf37e 100644 --- a/micromamba/tests/test_list.py +++ b/micromamba/tests/test_list.py @@ -1,4 +1,6 @@ +import platform import subprocess +import sys import pytest @@ -40,6 +42,39 @@ def test_list_name(tmp_home, tmp_root_prefix, tmp_xtensor_env, quiet_flag): assert full_names == ["xtensor"] +env_yaml_content_to_install_numpy_with_pip = """ +channels: +- conda-forge +dependencies: +- pip +- pip: + - numpy==1.26.4 +""" + + +@pytest.mark.parametrize("shared_pkgs_dirs", [True], indirect=True) +def test_list_with_pip(tmp_home, tmp_root_prefix, tmp_path): + env_name = "env-list_with_pip" + tmp_root_prefix / "envs" / env_name + + env_file_yml = tmp_path / "test_env_yaml_content_to_install_numpy_with_pip.yaml" + env_file_yml.write_text(env_yaml_content_to_install_numpy_with_pip) + + 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"] == "numpy" + and package["version"] == "1.26.4" + 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): From b94b30e941a682eafbba1ac3f524979e7c0c1d80 Mon Sep 17 00:00:00 2001 From: Hind-M <70631848+Hind-M@users.noreply.github.com> Date: Wed, 30 Oct 2024 10:20:58 +0100 Subject: [PATCH 091/126] Fix doc (#3568) --- docs/source/usage/solver.rst | 4 +++- docs/source/usage/specs.rst | 6 ++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/docs/source/usage/solver.rst b/docs/source/usage/solver.rst index 91a045655e..3c3f6866d8 100644 --- a/docs/source/usage/solver.rst +++ b/docs/source/usage/solver.rst @@ -41,8 +41,10 @@ The first way to add a repository is from a list of |PackageInfo| using import libmambapy + channel_alias = libmambapy.specs.CondaURL.parse("https://conda.anaconda.org") + db = libmambapy.solver.libsolv.Database( - libmambapy.specs.ChannelResolveParams(channel_alias="https://conda.anaconda.org") + libmambapy.specs.ChannelResolveParams(channel_alias=channel_alias) ) repo1 = db.add_repo_from_packages( diff --git a/docs/source/usage/specs.rst b/docs/source/usage/specs.rst index c154da9bae..83580d3815 100644 --- a/docs/source/usage/specs.rst +++ b/docs/source/usage/specs.rst @@ -151,11 +151,12 @@ All parameters that influence this resolution must be provided explicitly. .. code:: python import libmambapy.specs as specs + import libmambapy.specs.CondaURL as CondaURL uc = specs.UnresolvedChannel.parse("conda-forge[prius-avx42]") chan, *_ = specs.Channel.resolve( uc, - channel_alias="https://repo.mamba.pm" + channel_alias=CondaURL.parse("https://repo.mamba.pm") # ... ) @@ -168,11 +169,12 @@ There are no hard-coded names: .. code:: python import libmambapy.specs as specs + import libmambapy.specs.CondaURL as CondaURL uc = specs.UnresolvedChannel.parse("defaults") chan, *_ = specs.Channel.resolve( uc, - channel_alias="https://repo.mamba.pm" + channel_alias=CondaURL.parse("https://repo.mamba.pm") # ... ) From 94bb087acb9e2f8c6e3f2579061f31664398c1d1 Mon Sep 17 00:00:00 2001 From: Hind-M <70631848+Hind-M@users.noreply.github.com> Date: Wed, 30 Oct 2024 14:50:16 +0100 Subject: [PATCH 092/126] Fix locking error (#3572) --- libmamba/src/core/prefix_data.cpp | 2 +- libmamba/src/core/util.cpp | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/libmamba/src/core/prefix_data.cpp b/libmamba/src/core/prefix_data.cpp index 8e5b6ad525..68861b4a42 100644 --- a/libmamba/src/core/prefix_data.cpp +++ b/libmamba/src/core/prefix_data.cpp @@ -207,7 +207,7 @@ namespace mamba return; } - // Run `pip freeze` + // Run `pip inspect` std::string out, err; const auto get_python_path = [&] diff --git a/libmamba/src/core/util.cpp b/libmamba/src/core/util.cpp index 30bf08bc58..ac4fe48135 100644 --- a/libmamba/src/core/util.cpp +++ b/libmamba/src/core/util.cpp @@ -722,9 +722,18 @@ namespace mamba , m_locked(false) { std::error_code ec; + + // Check if `path` exists if (!fs::exists(path, ec)) { - throw_lock_error(fmt::format("Could not lock non-existing path '{}'", path.string())); + // If `path` doesn't exist, consider creating the directory + // (and its parents if they don't exist) + if (!fs::create_directories(path, ec)) + { + throw_lock_error( + fmt::format("Could not create directory '{}': {}", path.string(), ec.message()) + ); + } } if (fs::is_directory(path)) From c511d5c9f71165c0af75d916b46355a980e292f8 Mon Sep 17 00:00:00 2001 From: Johan Mabille Date: Tue, 5 Nov 2024 21:41:04 +0100 Subject: [PATCH 093/126] release libmamba 2.0.3, libmambapy 2.0.3, micromamba 2.0.3 --- CHANGELOG.md | 41 ++++++++++++++++++++++++++++ libmamba/CHANGELOG.md | 35 ++++++++++++++++++++++++ libmamba/include/mamba/version.hpp | 2 +- libmambapy/CHANGELOG.md | 15 ++++++++++ libmambapy/src/libmambapy/version.py | 2 +- micromamba/CHANGELOG.md | 29 ++++++++++++++++++++ micromamba/src/version.hpp | 2 +- 7 files changed, 123 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7c20c6f2cd..a346835784 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,44 @@ +2024.11.05 +========== + +Releases: libmamba 2.0.3, libmambapy 2.0.3, micromamba 2.0.3 + +Enhancements: + +- [libmamba, micromamba] pip packages support with `list` by @Hind-M in https://github.com/mamba-org/mamba/pull/3565 +- [libmamba, libmambapy] chore: some CMake cleanup by @henryiii in https://github.com/mamba-org/mamba/pull/3564 +- [libmamba] Replaced rstrip reimplementation with call to remove_suffix by @JohanMabille in https://github.com/mamba-org/mamba/pull/3508 + +Bug fixes: + +- [libmamba] Fix locking error by @Hind-M in https://github.com/mamba-org/mamba/pull/3572 +- [libmamba, micromamba] Fix test on windows by @Hind-M in https://github.com/mamba-org/mamba/pull/3555 +- [libmamba] fix: Only register channels in the context once by @jjerphan in https://github.com/mamba-org/mamba/pull/3521 +- [micromamba] fix: JSON output for environment export by @jjerphan in https://github.com/mamba-org/mamba/pull/3559 +- [micromamba] fix: Support `conda env export` `no-builds` flag by @jjerphan in https://github.com/mamba-org/mamba/pull/3563 +- [micromamba] fix: Export the environment prefix in specification by @jjerphan in https://github.com/mamba-org/mamba/pull/3562 +- [libmamba] windows shell init files use executable name by @Klaim in https://github.com/mamba-org/mamba/pull/3546 +- [libmamba, micromamba] Fix relative path in local channel by @Hind-M in https://github.com/mamba-org/mamba/pull/3540 +- [libmamba, micromamba] Correctly rename test to be run by @Hind-M in https://github.com/mamba-org/mamba/pull/3545 +- [libmamba, micromamba] Create empty base prefix with `env update` by @Hind-M in https://github.com/mamba-org/mamba/pull/3519 +- [libmamba, micromamba] fix: Use POSIX-compliant scripts by @jjerphan in https://github.com/mamba-org/mamba/pull/3522 +- [libmamba, micromamba] maint: Clarify `env` subcommand documentation in help menu (cont'd) by @jjerphan in https://github.com/mamba-org/mamba/pull/3539 +- [libmamba] fix: Handle space in `mamba` and `micromamba` executable absolute paths by @NewUserHa in https://github.com/mamba-org/mamba/pull/3525 +- [libmamba, micromamba] maint: Clarify `env` subcommand documentation in help menu by @jjerphan in https://github.com/mamba-org/mamba/pull/3502 +- [micromamba] fix: Adapt `test_env_update_pypi_with_conda_forge` by @jjerphan in https://github.com/mamba-org/mamba/pull/3537 +- [libmamba] Add recommendation if error with root prefix by @Hind-M in https://github.com/mamba-org/mamba/pull/3513 +- [libmamba] fix: Ignore inline comment in environment specification by @jjerphan in https://github.com/mamba-org/mamba/pull/3512 +- [libmamba] Replace `[System.IO.Path]::GetFileNameWithoutExtension` with `-replace` by @mleistner-bgr in https://github.com/mamba-org/mamba/pull/3510 +- [libmamba] Fix warnings and co by @Hind-M in https://github.com/mamba-org/mamba/pull/3507 + +CI fixes and doc: + +- [all] Fix doc by @Hind-M in https://github.com/mamba-org/mamba/pull/3568 +- [all] [windows-vcpkg] Replace deprecated openssl with crypto feature with latest libarchive by @Hind-M in https://github.com/mamba-org/mamba/pull/3556 +- [all] maint: Unpin libcurl<8.10 by @jjerphan in https://github.com/mamba-org/mamba/pull/3548 +- [all] dev: Remove the use of Taskfile by @jjerphan in https://github.com/mamba-org/mamba/pull/3544 +- [all] Upgraded CI to micromamba 2.0.2 by @JohanMabille in https://github.com/mamba-org/mamba/pull/3497 + 2024.10.02 ========== diff --git a/libmamba/CHANGELOG.md b/libmamba/CHANGELOG.md index 0629d44602..7164b86184 100644 --- a/libmamba/CHANGELOG.md +++ b/libmamba/CHANGELOG.md @@ -1,3 +1,38 @@ +libmamba 2.0.3 (November 05, 2024) +================================== + +Enhancements: + +- pip packages support with `list` by @Hind-M in https://github.com/mamba-org/mamba/pull/3565 +- chore: some CMake cleanup by @henryiii in https://github.com/mamba-org/mamba/pull/3564 +- Replaced rstrip reimplementation with call to remove_suffix by @JohanMabille in https://github.com/mamba-org/mamba/pull/3508 + +Bug fixes: + +- Fix locking error by @Hind-M in https://github.com/mamba-org/mamba/pull/3572 +- Fix test on windows by @Hind-M in https://github.com/mamba-org/mamba/pull/3555 +- fix: Only register channels in the context once by @jjerphan in https://github.com/mamba-org/mamba/pull/3521 +- windows shell init files use executable name by @Klaim in https://github.com/mamba-org/mamba/pull/3546 +- Fix relative path in local channel by @Hind-M in https://github.com/mamba-org/mamba/pull/3540 +- Correctly rename test to be run by @Hind-M in https://github.com/mamba-org/mamba/pull/3545 +- Create empty base prefix with `env update` by @Hind-M in https://github.com/mamba-org/mamba/pull/3519 +- fix: Use POSIX-compliant scripts by @jjerphan in https://github.com/mamba-org/mamba/pull/3522 +- maint: Clarify `env` subcommand documentation in help menu (cont'd) by @jjerphan in https://github.com/mamba-org/mamba/pull/3539 +- fix: Handle space in `mamba` and `micromamba` executable absolute paths by @NewUserHa in https://github.com/mamba-org/mamba/pull/3525 +- maint: Clarify `env` subcommand documentation in help menu by @jjerphan in https://github.com/mamba-org/mamba/pull/3502 +- Add recommendation if error with root prefix by @Hind-M in https://github.com/mamba-org/mamba/pull/3513 +- fix: Ignore inline comment in environment specification by @jjerphan in https://github.com/mamba-org/mamba/pull/3512 +- Replace `[System.IO.Path]::GetFileNameWithoutExtension` with `-replace` by @mleistner-bgr in https://github.com/mamba-org/mamba/pull/3510 +- Fix warnings and co by @Hind-M in https://github.com/mamba-org/mamba/pull/3507 + +CI fixes and doc: + +- Fix doc by @Hind-M in https://github.com/mamba-org/mamba/pull/3568 +- [windows-vcpkg] Replace deprecated openssl with crypto feature with latest libarchive by @Hind-M in https://github.com/mamba-org/mamba/pull/3556 +- maint: Unpin libcurl<8.10 by @jjerphan in https://github.com/mamba-org/mamba/pull/3548 +- dev: Remove the use of Taskfile by @jjerphan in https://github.com/mamba-org/mamba/pull/3544 +- Upgraded CI to micromamba 2.0.2 by @JohanMabille in https://github.com/mamba-org/mamba/pull/3497 + libmamba 2.0.2 (October 02, 2024) ================================= diff --git a/libmamba/include/mamba/version.hpp b/libmamba/include/mamba/version.hpp index 5fc55bdf0e..1e10f3b18d 100644 --- a/libmamba/include/mamba/version.hpp +++ b/libmamba/include/mamba/version.hpp @@ -12,7 +12,7 @@ #define LIBMAMBA_VERSION_MAJOR 2 #define LIBMAMBA_VERSION_MINOR 0 -#define LIBMAMBA_VERSION_PATCH 2 +#define LIBMAMBA_VERSION_PATCH 3 // Binary version #define LIBMAMBA_BINARY_CURRENT 2 diff --git a/libmambapy/CHANGELOG.md b/libmambapy/CHANGELOG.md index 44e12d8df4..170a92b7c9 100644 --- a/libmambapy/CHANGELOG.md +++ b/libmambapy/CHANGELOG.md @@ -1,3 +1,18 @@ +libmambapy 2.0.3 (November 05, 2024) +==================================== + +Enhancements: + +- chore: some CMake cleanup by @henryiii in https://github.com/mamba-org/mamba/pull/3564 + +CI fixes and doc: + +- Fix doc by @Hind-M in https://github.com/mamba-org/mamba/pull/3568 +- [windows-vcpkg] Replace deprecated openssl with crypto feature with latest libarchive by @Hind-M in https://github.com/mamba-org/mamba/pull/3556 +- maint: Unpin libcurl<8.10 by @jjerphan in https://github.com/mamba-org/mamba/pull/3548 +- dev: Remove the use of Taskfile by @jjerphan in https://github.com/mamba-org/mamba/pull/3544 +- Upgraded CI to micromamba 2.0.2 by @JohanMabille in https://github.com/mamba-org/mamba/pull/3497 + libmambapy 2.0.2 (October 02, 2024) =================================== diff --git a/libmambapy/src/libmambapy/version.py b/libmambapy/src/libmambapy/version.py index b9d07545a4..a83465be8b 100644 --- a/libmambapy/src/libmambapy/version.py +++ b/libmambapy/src/libmambapy/version.py @@ -1,2 +1,2 @@ -version_info = ("2", "0", "2") +version_info = ("2", "0", "3") __version__ = ".".join(map(str, version_info)) diff --git a/micromamba/CHANGELOG.md b/micromamba/CHANGELOG.md index f6e57cac01..fd09ac2510 100644 --- a/micromamba/CHANGELOG.md +++ b/micromamba/CHANGELOG.md @@ -1,3 +1,32 @@ +micromamba 2.0.3 (November 05, 2024) +==================================== + +Enhancements: + +- pip packages support with `list` by @Hind-M in https://github.com/mamba-org/mamba/pull/3565 + +Bug fixes: + +- Fix test on windows by @Hind-M in https://github.com/mamba-org/mamba/pull/3555 +- fix: JSON output for environment export by @jjerphan in https://github.com/mamba-org/mamba/pull/3559 +- fix: Support `conda env export` `no-builds` flag by @jjerphan in https://github.com/mamba-org/mamba/pull/3563 +- fix: Export the environment prefix in specification by @jjerphan in https://github.com/mamba-org/mamba/pull/3562 +- Fix relative path in local channel by @Hind-M in https://github.com/mamba-org/mamba/pull/3540 +- Correctly rename test to be run by @Hind-M in https://github.com/mamba-org/mamba/pull/3545 +- Create empty base prefix with `env update` by @Hind-M in https://github.com/mamba-org/mamba/pull/3519 +- fix: Use POSIX-compliant scripts by @jjerphan in https://github.com/mamba-org/mamba/pull/3522 +- maint: Clarify `env` subcommand documentation in help menu (cont'd) by @jjerphan in https://github.com/mamba-org/mamba/pull/3539 +- maint: Clarify `env` subcommand documentation in help menu by @jjerphan in https://github.com/mamba-org/mamba/pull/3502 +- fix: Adapt `test_env_update_pypi_with_conda_forge` by @jjerphan in https://github.com/mamba-org/mamba/pull/3537 + +CI fixes and doc: + +- Fix doc by @Hind-M in https://github.com/mamba-org/mamba/pull/3568 +- [windows-vcpkg] Replace deprecated openssl with crypto feature with latest libarchive by @Hind-M in https://github.com/mamba-org/mamba/pull/3556 +- maint: Unpin libcurl<8.10 by @jjerphan in https://github.com/mamba-org/mamba/pull/3548 +- dev: Remove the use of Taskfile by @jjerphan in https://github.com/mamba-org/mamba/pull/3544 +- Upgraded CI to micromamba 2.0.2 by @JohanMabille in https://github.com/mamba-org/mamba/pull/3497 + micromamba 2.0.2 (October 02, 2024) =================================== diff --git a/micromamba/src/version.hpp b/micromamba/src/version.hpp index 0600c7c9ef..418052e2bb 100644 --- a/micromamba/src/version.hpp +++ b/micromamba/src/version.hpp @@ -12,7 +12,7 @@ #define UMAMBA_VERSION_MAJOR 2 #define UMAMBA_VERSION_MINOR 0 -#define UMAMBA_VERSION_PATCH 2 +#define UMAMBA_VERSION_PATCH 3 // Binary version #define UMAMBA_BINARY_CURRENT 1 From a638f702e2d6d4e2d4baeb1beb25b5ecf1850ce3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Klaim=20=28Jo=C3=ABl=20Lamotte=29?= <142265+Klaim@users.noreply.github.com> Date: Thu, 7 Nov 2024 17:32:48 +0100 Subject: [PATCH 094/126] Adds logs clarifying the source of the error "could not load prefix data (#3581) --- libmamba/src/api/install.cpp | 4 +++- libmamba/src/api/list.cpp | 4 +++- libmamba/src/api/remove.cpp | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/libmamba/src/api/install.cpp b/libmamba/src/api/install.cpp index ea996377c8..ff33bcfa70 100644 --- a/libmamba/src/api/install.cpp +++ b/libmamba/src/api/install.cpp @@ -596,7 +596,9 @@ namespace mamba if (!exp_prefix_data) { // TODO: propagate tl::expected mechanism - throw std::runtime_error("could not load prefix data"); + throw std::runtime_error( + fmt::format("could not load prefix data: {}", exp_prefix_data.error().what()) + ); } PrefixData& prefix_data = exp_prefix_data.value(); diff --git a/libmamba/src/api/list.cpp b/libmamba/src/api/list.cpp index 35e762bd77..8d63220654 100644 --- a/libmamba/src/api/list.cpp +++ b/libmamba/src/api/list.cpp @@ -59,7 +59,9 @@ namespace mamba if (!sprefix_data) { // TODO: propagate tl::expected mechanism - throw std::runtime_error("could not load prefix data"); + throw std::runtime_error( + fmt::format("could not load prefix data: {}", sprefix_data.error().what()) + ); } PrefixData& prefix_data = sprefix_data.value(); diff --git a/libmamba/src/api/remove.cpp b/libmamba/src/api/remove.cpp index 4e831af3b8..1ec6358c9f 100644 --- a/libmamba/src/api/remove.cpp +++ b/libmamba/src/api/remove.cpp @@ -46,7 +46,9 @@ namespace mamba if (!sprefix_data) { // TODO: propagate tl::expected mechanism - throw std::runtime_error("could not load prefix data"); + throw std::runtime_error( + fmt::format("could not load prefix data: {}", sprefix_data.error().what()) + ); } PrefixData& prefix_data = sprefix_data.value(); for (const auto& package : prefix_data.records()) From 554d9264dab4450a2783e40f74f6c135588d3ee6 Mon Sep 17 00:00:00 2001 From: ChaonengQuan <46586569+ChaonengQuan@users.noreply.github.com> Date: Tue, 12 Nov 2024 01:16:22 -0800 Subject: [PATCH 095/126] fix: Skip misformatted configuration files (#3580) Co-authored-by: Julien Jerphanion Co-authored-by: Chaoneng Quan --- libmamba/src/api/configuration.cpp | 8 ++++++++ libmamba/tests/src/core/test_configuration.cpp | 9 +++++++++ 2 files changed, 17 insertions(+) diff --git a/libmamba/src/api/configuration.cpp b/libmamba/src/api/configuration.cpp index 110a302efd..d065e396e9 100644 --- a/libmamba/src/api/configuration.cpp +++ b/libmamba/src/api/configuration.cpp @@ -2338,6 +2338,14 @@ namespace mamba strStream << inFile.rdbuf(); std::string s = strStream.str(); config = YAML::Load(expandvars(s)); + if (config.IsScalar()) + { + LOG_WARNING << fmt::format( + "The configuration file at {} is misformatted or corrupted. Skipping file.", + file.string() + ); + return YAML::Node(); + } } catch (const std::exception& ex) { diff --git a/libmamba/tests/src/core/test_configuration.cpp b/libmamba/tests/src/core/test_configuration.cpp index a221f0f6d3..60baf04254 100644 --- a/libmamba/tests/src/core/test_configuration.cpp +++ b/libmamba/tests/src/core/test_configuration.cpp @@ -918,6 +918,15 @@ namespace mamba util::unset_env("MAMBA_CHANNEL_PRIORITY"); } + TEST_CASE_FIXTURE(Configuration, "skip_misformatted_config_file") + { + std::string rc = "invalid_scalar_value"; + load_test_config(rc); + CHECK_EQ(config.sources().size(), 1); + CHECK_EQ(config.valid_sources().size(), 0); + CHECK_EQ(config.dump(), ""); + } + TEST_CASE_FIXTURE(Configuration, "pinned_packages") { std::string rc1 = unindent(R"( From 48df20618f09c6f07d19037176ce9b88d769fc94 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Klaim=20=28Jo=C3=ABl=20Lamotte=29?= <142265+Klaim@users.noreply.github.com> Date: Tue, 12 Nov 2024 10:27:10 +0100 Subject: [PATCH 096/126] Fix: json parsing error due to wrong encoding of Python output (#3584) --- .github/workflows/static_build.yml | 19 +++++++++++++++++++ libmamba/src/core/prefix_data.cpp | 7 ++++++- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/.github/workflows/static_build.yml b/.github/workflows/static_build.yml index 86039d1898..f839c1ca85 100644 --- a/.github/workflows/static_build.yml +++ b/.github/workflows/static_build.yml @@ -99,6 +99,16 @@ jobs: "micromamba-feedstock/build_artifacts/${{ matrix.platform }}-${{ matrix.arch }}/"micromamba-*.tar.bz2 "pkg/" mkdir -p "${{ github.workspace }}/artifacts" cp pkg/bin/micromamba "${{ github.workspace }}/artifacts" + + - name: Test basic commands + if: ${{ ${{ matrix.arch }} != 'aarch64' && ${{ matrix.arch }} != 'ppc64le' }} + run: | + mkdir test_prefix + ${{ github.workspace }}/artifacts/micromamba --version + ${{ github.workspace }}/artifacts/micromamba --help + ${{ github.workspace }}/artifacts/micromamba env create -y -n testenv -r ./test_prefix "python<3.13" + ${{ github.workspace }}/artifacts/micromamba list -n testenv -r ./test_prefix --log-level 1 + - name: Archive conda-build artifact if: failure() run: tar -czf ${{ github.workspace }}/micromamba-conda-build-failed-${{ matrix.platform }}-${{ matrix.arch }}.tar.gz $MAMBA_ROOT_PREFIX/envs/mambabuild/conda-bld/micromamba_* @@ -181,6 +191,15 @@ jobs: - name: Archive-build artifact if: failure() run: tar -czf ${{ github.workspace }}/micromamba-build-failed-win-64.tar.gz ${{ github.workspace }}/build/ + + - name: Test basic commands + run: | + mkdir test_prefix + ${{ github.workspace }}/build/micromamba/micromamba.exe --version + ${{ github.workspace }}/build/micromamba/micromamba.exe --help + ${{ github.workspace }}/build/micromamba/micromamba.exe env create -y -n testenv -r ./test_prefix "python<3.13" + ${{ github.workspace }}/build/micromamba/micromamba.exe list -n testenv -r ./test_prefix --log-level 1 + - name: Upload build artifacts uses: actions/upload-artifact@v4 if: failure() diff --git a/libmamba/src/core/prefix_data.cpp b/libmamba/src/core/prefix_data.cpp index 68861b4a42..807a03d028 100644 --- a/libmamba/src/core/prefix_data.cpp +++ b/libmamba/src/core/prefix_data.cpp @@ -218,9 +218,14 @@ namespace mamba "pip", "inspect", "--local" }; + + const std::vector> env{ { "PYTHONIOENCODING", "utf-8" } }; + reproc::options run_options; + run_options.env.extra = reproc::env{ env }; + auto [status, ec] = reproc::run( args, - reproc::options{}, + run_options, reproc::sink::string(out), reproc::sink::string(err) ); From e1bdc942afe5b3cbe2e16722696ffbefc6a622a9 Mon Sep 17 00:00:00 2001 From: Hind Montassif Date: Tue, 12 Nov 2024 11:56:23 +0100 Subject: [PATCH 097/126] release libmamba 2.0.4alpha0, libmambapy 2.0.4alpha0, micromamba 2.0.4alpha0 --- CHANGELOG.md | 14 ++++++++++++++ libmamba/CHANGELOG.md | 12 ++++++++++++ libmamba/include/mamba/version.hpp | 2 +- libmambapy/CHANGELOG.md | 4 ++++ libmambapy/src/libmambapy/version.py | 2 +- micromamba/CHANGELOG.md | 4 ++++ micromamba/src/version.hpp | 2 +- 7 files changed, 37 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a346835784..47c4e60449 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,17 @@ +2024.11.12 +========== + +Releases: libmamba 2.0.4alpha0, libmambapy 2.0.4alpha0, micromamba 2.0.4alpha0 + +Enhancements: + +- [libmamba] Fix: json parsing error due to wrong encoding of Python output by @Klaim in https://github.com/mamba-org/mamba/pull/3584 +- [libmamba] Adds logs clarifying the source of the error "could not load prefix data by @Klaim in https://github.com/mamba-org/mamba/pull/3581 + +Bug fixes: + +- [libmamba] fix: Skip misformatted configuration files by @ChaonengQuan in https://github.com/mamba-org/mamba/pull/3580 + 2024.11.05 ========== diff --git a/libmamba/CHANGELOG.md b/libmamba/CHANGELOG.md index 7164b86184..2cd202ab6f 100644 --- a/libmamba/CHANGELOG.md +++ b/libmamba/CHANGELOG.md @@ -1,3 +1,15 @@ +libmamba 2.0.4alpha0 (November 12, 2024) +======================================== + +Enhancements: + +- Fix: json parsing error due to wrong encoding of Python output by @Klaim in https://github.com/mamba-org/mamba/pull/3584 +- Adds logs clarifying the source of the error "could not load prefix data by @Klaim in https://github.com/mamba-org/mamba/pull/3581 + +Bug fixes: + +- fix: Skip misformatted configuration files by @ChaonengQuan in https://github.com/mamba-org/mamba/pull/3580 + libmamba 2.0.3 (November 05, 2024) ================================== diff --git a/libmamba/include/mamba/version.hpp b/libmamba/include/mamba/version.hpp index 1e10f3b18d..2f765bbb99 100644 --- a/libmamba/include/mamba/version.hpp +++ b/libmamba/include/mamba/version.hpp @@ -12,7 +12,7 @@ #define LIBMAMBA_VERSION_MAJOR 2 #define LIBMAMBA_VERSION_MINOR 0 -#define LIBMAMBA_VERSION_PATCH 3 +#define LIBMAMBA_VERSION_PATCH 4 // Binary version #define LIBMAMBA_BINARY_CURRENT 2 diff --git a/libmambapy/CHANGELOG.md b/libmambapy/CHANGELOG.md index 170a92b7c9..dd3f0efd45 100644 --- a/libmambapy/CHANGELOG.md +++ b/libmambapy/CHANGELOG.md @@ -1,3 +1,7 @@ +libmambapy 2.0.4alpha0 (November 12, 2024) +========================================== + + libmambapy 2.0.3 (November 05, 2024) ==================================== diff --git a/libmambapy/src/libmambapy/version.py b/libmambapy/src/libmambapy/version.py index a83465be8b..bba7506976 100644 --- a/libmambapy/src/libmambapy/version.py +++ b/libmambapy/src/libmambapy/version.py @@ -1,2 +1,2 @@ -version_info = ("2", "0", "3") +version_info = ("2", "0", "4") __version__ = ".".join(map(str, version_info)) diff --git a/micromamba/CHANGELOG.md b/micromamba/CHANGELOG.md index fd09ac2510..2c578ec79b 100644 --- a/micromamba/CHANGELOG.md +++ b/micromamba/CHANGELOG.md @@ -1,3 +1,7 @@ +micromamba 2.0.4alpha0 (November 12, 2024) +========================================== + + micromamba 2.0.3 (November 05, 2024) ==================================== diff --git a/micromamba/src/version.hpp b/micromamba/src/version.hpp index 418052e2bb..5c9021739e 100644 --- a/micromamba/src/version.hpp +++ b/micromamba/src/version.hpp @@ -12,7 +12,7 @@ #define UMAMBA_VERSION_MAJOR 2 #define UMAMBA_VERSION_MINOR 0 -#define UMAMBA_VERSION_PATCH 3 +#define UMAMBA_VERSION_PATCH 4 // Binary version #define UMAMBA_BINARY_CURRENT 1 From 4535562cb8ce3c63dc89a6e77f87f6ed26568e31 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Tue, 12 Nov 2024 13:06:58 +0000 Subject: [PATCH 098/126] fix: Correct `mamba env export --json --from-history` (#3590) --- micromamba/src/env.cpp | 16 +++++++++------- micromamba/tests/test_env.py | 14 ++++++++++++++ 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/micromamba/src/env.cpp b/micromamba/src/env.cpp index 34c4512097..f46a8f6158 100644 --- a/micromamba/src/env.cpp +++ b/micromamba/src/env.cpp @@ -184,24 +184,25 @@ set_env_command(CLI::App* com, Configuration& config) std::stringstream dependencies; std::set channels; - for (auto it = versions_map.begin(); it != versions_map.end(); ++it) + bool first_dependency_printed = false; + for (const auto& [k, v] : versions_map) { - auto k = it->first; - auto v = it->second; if (from_history && requested_specs_map.find(k) == requested_specs_map.end()) { continue; } + dependencies << (first_dependency_printed ? ",\n" : "") << " \""; + first_dependency_printed = true; + auto chans = channel_context.make_channel(v.channel); if (from_history) { - dependencies << " \"" << requested_specs_map[k].str() << "\",\n"; + dependencies << requested_specs_map[k].str() << "\""; } else { - dependencies << " \""; if (channel_subdir) { dependencies @@ -218,8 +219,7 @@ set_env_command(CLI::App* com, Configuration& config) { dependencies << "[md5=" << v.md5 << "]"; } - auto last_dep = std::next(it) == versions_map.end(); - dependencies << "\"" << (last_dep ? "" : ",") << "\n"; + dependencies << "\""; } for (const auto& chan : chans) @@ -227,6 +227,8 @@ set_env_command(CLI::App* com, Configuration& config) channels.insert(chan.display_name()); } } + dependencies << (first_dependency_printed ? "\n" : ""); + std::cout << "{\n"; if (!channels.empty()) diff --git a/micromamba/tests/test_env.py b/micromamba/tests/test_env.py index a29dff8f3a..19e2ac878e 100644 --- a/micromamba/tests/test_env.py +++ b/micromamba/tests/test_env.py @@ -70,6 +70,20 @@ def export_env(): return env_name +@pytest.mark.parametrize("json_flag", [None, "--json"]) +def test_env_export_from_history(json_flag, export_env): + flags = filter(None, [json_flag]) + output = helpers.run_env("export", "-n", export_env, "--from-history", *flags) + + # json is already parsed + ret = output if json_flag else yaml.safe_load(output) + assert ret["name"] == export_env + assert export_env in ret["prefix"] + assert set(ret["channels"]) == {"conda-forge"} + micromamba_spec_prefix = "micromamba=0.24.0" + assert [micromamba_spec_prefix] == ret["dependencies"] + + @pytest.mark.parametrize("channel_subdir_flag", [None, "--channel-subdir"]) @pytest.mark.parametrize("md5_flag", [None, "--md5", "--no-md5"]) @pytest.mark.parametrize("explicit_flag", [None, "--explicit"]) From 27b6794ccb83b687421757570b1005b240197f00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Klaim=20=28Jo=C3=ABl=20Lamotte=29?= <142265+Klaim@users.noreply.github.com> Date: Tue, 12 Nov 2024 14:18:40 +0100 Subject: [PATCH 099/126] fixed incorrect syntax in static_build.yml (#3592) --- .github/workflows/static_build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/static_build.yml b/.github/workflows/static_build.yml index f839c1ca85..9d2c32a9a5 100644 --- a/.github/workflows/static_build.yml +++ b/.github/workflows/static_build.yml @@ -101,7 +101,7 @@ jobs: cp pkg/bin/micromamba "${{ github.workspace }}/artifacts" - name: Test basic commands - if: ${{ ${{ matrix.arch }} != 'aarch64' && ${{ matrix.arch }} != 'ppc64le' }} + if: ${{ matrix.arch != 'aarch64' && matrix.arch != 'ppc64le' }} run: | mkdir test_prefix ${{ github.workspace }}/artifacts/micromamba --version From 538ab0b4763d4ff3c7af6adb737e49b95ff3575b Mon Sep 17 00:00:00 2001 From: Hind Montassif Date: Tue, 12 Nov 2024 15:24:25 +0100 Subject: [PATCH 100/126] release libmamba 2.0.4alpha1, libmambapy 2.0.4alpha1, micromamba 2.0.4alpha1 --- CHANGELOG.md | 10 ++++++++++ libmamba/CHANGELOG.md | 7 +++++++ libmambapy/CHANGELOG.md | 7 +++++++ micromamba/CHANGELOG.md | 8 ++++++++ 4 files changed, 32 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 47c4e60449..19c34c1f9e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ +2024.11.12-0 +============ + +Releases: libmamba 2.0.4alpha1, libmambapy 2.0.4alpha1, micromamba 2.0.4alpha1 + +Bug fixes: + +- [all] fixed incorrect syntax in static_build.yml by @Klaim in https://github.com/mamba-org/mamba/pull/3592 +- [micromamba] fix: Correct `mamba env export --json --from-history` by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3590 + 2024.11.12 ========== diff --git a/libmamba/CHANGELOG.md b/libmamba/CHANGELOG.md index 2cd202ab6f..0ef8725ed0 100644 --- a/libmamba/CHANGELOG.md +++ b/libmamba/CHANGELOG.md @@ -1,3 +1,10 @@ +libmamba 2.0.4alpha1 (November 12, 2024) +======================================== + +Bug fixes: + +- fixed incorrect syntax in static_build.yml by @Klaim in https://github.com/mamba-org/mamba/pull/3592 + libmamba 2.0.4alpha0 (November 12, 2024) ======================================== diff --git a/libmambapy/CHANGELOG.md b/libmambapy/CHANGELOG.md index dd3f0efd45..ca095fd685 100644 --- a/libmambapy/CHANGELOG.md +++ b/libmambapy/CHANGELOG.md @@ -1,3 +1,10 @@ +libmambapy 2.0.4alpha1 (November 12, 2024) +========================================== + +Bug fixes: + +- fixed incorrect syntax in static_build.yml by @Klaim in https://github.com/mamba-org/mamba/pull/3592 + libmambapy 2.0.4alpha0 (November 12, 2024) ========================================== diff --git a/micromamba/CHANGELOG.md b/micromamba/CHANGELOG.md index 2c578ec79b..72c3659437 100644 --- a/micromamba/CHANGELOG.md +++ b/micromamba/CHANGELOG.md @@ -1,3 +1,11 @@ +micromamba 2.0.4alpha1 (November 12, 2024) +========================================== + +Bug fixes: + +- fixed incorrect syntax in static_build.yml by @Klaim in https://github.com/mamba-org/mamba/pull/3592 +- fix: Correct `mamba env export --json --from-history` by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3590 + micromamba 2.0.4alpha0 (November 12, 2024) ========================================== From af276aeedbb0f63a40ff500832425335d88029b9 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Tue, 12 Nov 2024 17:04:03 +0000 Subject: [PATCH 101/126] Force spinx v6 in readthedocs (#3586) --- docs/environment.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/environment.yml b/docs/environment.yml index e4d63c0a37..4696a7607d 100644 --- a/docs/environment.yml +++ b/docs/environment.yml @@ -4,7 +4,7 @@ channels: dependencies: - myst-parser - six - - sphinx < 7 + - sphinx=6.* - sphinx-book-theme - doxygen - breathe From 0f4ad44c2e6ea11825c8ea3c4e92cf9bbf633086 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Thu, 14 Nov 2024 09:27:18 +0000 Subject: [PATCH 102/126] Update pre-commit hooks except clang-format (#3599) --- .pre-commit-config.yaml | 10 +++++----- docs/source/usage/specs.rst | 6 +++--- libmamba/include/mamba/util/string.hpp | 2 +- libmamba/src/core/singletons.cpp | 2 +- micromamba/tests/test_env.py | 2 +- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 53f4cab039..8aab8fd3e5 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,7 @@ exclude: libmamba/tests/data/repodata_json_cache* repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.5.0 + rev: v5.0.0 hooks: - id: trailing-whitespace - id: end-of-file-fixer @@ -23,16 +23,16 @@ repos: - id: rst-directive-colons - id: rst-inline-touching-normal - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.3.4 + rev: v0.7.3 hooks: - id: ruff args: [ --fix ] - id: ruff-format - repo: https://github.com/asottile/blacken-docs - rev: 1.16.0 + rev: 1.19.1 hooks: - id: blacken-docs - additional_dependencies: [black==22.3.0] + additional_dependencies: [black==24.10.0] - repo: https://github.com/pre-commit/mirrors-clang-format rev: v18.1.2 hooks: @@ -44,7 +44,7 @@ repos: hooks: - id: cmake-format - repo: https://github.com/Quantco/pre-commit-mirrors-typos - rev: 1.20.8 + rev: 1.27.3 hooks: - id: typos-conda exclude: (CHANGELOG.md) diff --git a/docs/source/usage/specs.rst b/docs/source/usage/specs.rst index 83580d3815..835dddebac 100644 --- a/docs/source/usage/specs.rst +++ b/docs/source/usage/specs.rst @@ -141,7 +141,7 @@ Dynamic platforms (as in not known by Mamba) can only be detected with the ``[]` Channel ------- The |Channel| are represented by a |CondaURL| and a set of platform filters. -A display name is also available, but is not considered a stable identifiaction form of the +A display name is also available, but is not considered a stable identification form of the channel, since it depends on the many configuration parameters, such as the channel alias. We construct a |Channel| by *resolving* a |UnresolvedChannel|. @@ -156,7 +156,7 @@ All parameters that influence this resolution must be provided explicitly. uc = specs.UnresolvedChannel.parse("conda-forge[prius-avx42]") chan, *_ = specs.Channel.resolve( uc, - channel_alias=CondaURL.parse("https://repo.mamba.pm") + channel_alias=CondaURL.parse("https://repo.mamba.pm"), # ... ) @@ -174,7 +174,7 @@ There are no hard-coded names: uc = specs.UnresolvedChannel.parse("defaults") chan, *_ = specs.Channel.resolve( uc, - channel_alias=CondaURL.parse("https://repo.mamba.pm") + channel_alias=CondaURL.parse("https://repo.mamba.pm"), # ... ) diff --git a/libmamba/include/mamba/util/string.hpp b/libmamba/include/mamba/util/string.hpp index 8a52099e96..4d8a1bb4a0 100644 --- a/libmamba/include/mamba/util/string.hpp +++ b/libmamba/include/mamba/util/string.hpp @@ -314,7 +314,7 @@ namespace mamba::util * Execute the function @p func on each element of a tuncated join iteration. * * The join iteration of an iterator pair (@p first, @p last) with a separator @p sep - * and a trunction symbol @p etc is define by the join iteration of either all the elements + * and a truncation symbol @p etc is define by the join iteration of either all the elements * in the iterator pair if they are less than @p threshold, a limited number of elements, with * middle elements represented by @p etc. * defined by iterating through the ``n`` elements of the iterator pair, interleaving the diff --git a/libmamba/src/core/singletons.cpp b/libmamba/src/core/singletons.cpp index d1bc6be4cf..aedcc3b79a 100644 --- a/libmamba/src/core/singletons.cpp +++ b/libmamba/src/core/singletons.cpp @@ -152,7 +152,7 @@ namespace mamba Console& Console::instance() { - if (!main_console) // NOTE: this is a temptative check, not a perfect one, it is possible + if (!main_console) // NOTE: this is a tentative check, not a perfect one, it is possible // `main_console` becomes null after the if scope and before returning. // A perfect check would involve locking a mutex, we want to avoid that // here. diff --git a/micromamba/tests/test_env.py b/micromamba/tests/test_env.py index 19e2ac878e..b1c8f112db 100644 --- a/micromamba/tests/test_env.py +++ b/micromamba/tests/test_env.py @@ -374,7 +374,7 @@ def test_env_update_pypi_with_conda_forge(tmp_home, tmp_root_prefix, tmp_path): env_file_yml = tmp_path / "test_env_update_pip_pkg_version_with_conda_forge.yaml" env_file_yml.write_text(env_yaml_content_to_update_pip_pkg_version_from_conda_forge) - # Update numpy from conda-forge is not suppposed to be done + # Update numpy from conda-forge is not supposed to be done res = helpers.run_env("update", "-p", env_prefix, "-f", env_file_yml, "-y", "--json") assert res["success"] From 7623caa96c7165ede27366118c6135ac9dec2667 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Thu, 14 Nov 2024 11:49:13 +0000 Subject: [PATCH 103/126] Remove Taskfile from `environment-dev-extra.yml` (#3597) --- dev/environment-dev-extra.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/dev/environment-dev-extra.yml b/dev/environment-dev-extra.yml index 5c7a7b00c4..70dcebae20 100644 --- a/dev/environment-dev-extra.yml +++ b/dev/environment-dev-extra.yml @@ -24,5 +24,3 @@ dependencies: - ipdb # Github CLI tool - gh - # Taskfile for running scripts - - go-task From 64670007480a580b66e95d190dd29beb33899685 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Thu, 14 Nov 2024 12:27:08 +0000 Subject: [PATCH 104/126] Fix some warnings (#3595) --- libmamba/include/mamba/core/output.hpp | 6 ++-- .../mamba/solver/libsolv/unsolvable.hpp | 2 +- libmamba/src/api/list.cpp | 2 +- libmamba/src/core/output.cpp | 17 ++--------- libmamba/src/core/progress_bar_impl.cpp | 5 +--- libmamba/src/core/shell_init.cpp | 2 +- libmamba/src/download/downloader.cpp | 2 +- libmamba/tests/src/download/test_mirror.cpp | 30 +++++++++++++++---- 8 files changed, 33 insertions(+), 33 deletions(-) diff --git a/libmamba/include/mamba/core/output.hpp b/libmamba/include/mamba/core/output.hpp index 6e7c9c97ba..ae13e43072 100644 --- a/libmamba/include/mamba/core/output.hpp +++ b/libmamba/include/mamba/core/output.hpp @@ -170,7 +170,7 @@ namespace mamba { public: - MessageLogger(const char* file, int line, log_level level); + MessageLogger(log_level level); ~MessageLogger(); std::stringstream& stream(); @@ -181,8 +181,6 @@ namespace mamba private: - std::string m_file; - int m_line; log_level m_level; std::stringstream m_stream; @@ -199,7 +197,7 @@ namespace mamba #undef LOG_ERROR #undef LOG_CRITICAL -#define LOG(severity) mamba::MessageLogger(__FILE__, __LINE__, severity).stream() +#define LOG(severity) mamba::MessageLogger(severity).stream() #define LOG_TRACE LOG(mamba::log_level::trace) #define LOG_DEBUG LOG(mamba::log_level::debug) #define LOG_INFO LOG(mamba::log_level::info) diff --git a/libmamba/include/mamba/solver/libsolv/unsolvable.hpp b/libmamba/include/mamba/solver/libsolv/unsolvable.hpp index 7f70d19a05..cee3ef60ae 100644 --- a/libmamba/include/mamba/solver/libsolv/unsolvable.hpp +++ b/libmamba/include/mamba/solver/libsolv/unsolvable.hpp @@ -21,7 +21,7 @@ namespace solv namespace mamba { - class Palette; + struct Palette; } namespace mamba::solver::libsolv diff --git a/libmamba/src/api/list.cpp b/libmamba/src/api/list.cpp index 8d63220654..48df94d8be 100644 --- a/libmamba/src/api/list.cpp +++ b/libmamba/src/api/list.cpp @@ -71,7 +71,7 @@ namespace mamba } std::regex spec_pat(regex); - auto all_records = std::move(prefix_data.all_pkg_mgr_records()); + auto all_records = prefix_data.all_pkg_mgr_records(); if (ctx.output_params.json) { diff --git a/libmamba/src/core/output.cpp b/libmamba/src/core/output.cpp index 7c92973bb1..37235b6dc0 100644 --- a/libmamba/src/core/output.cpp +++ b/libmamba/src/core/output.cpp @@ -472,17 +472,6 @@ namespace mamba return *(p_data->p_progress_bar_manager); } - std::string strip_file_prefix(const std::string& file) - { -#ifdef _WIN32 - char sep = '\\'; -#else - char sep = '/'; -#endif - size_t pos = file.rfind(sep); - return pos != std::string::npos ? file.substr(pos + 1, std::string::npos) : file; - } - void Console::json_print() { print(p_data->json_log.unflatten().dump(4), true); @@ -557,10 +546,8 @@ namespace mamba static std::vector> m_buffer; }; - MessageLogger::MessageLogger(const char* file, int line, log_level level) - : m_file(strip_file_prefix(file)) - , m_line(line) - , m_level(level) + MessageLogger::MessageLogger(log_level level) + : m_level(level) , m_stream() { } diff --git a/libmamba/src/core/progress_bar_impl.cpp b/libmamba/src/core/progress_bar_impl.cpp index 7304de5aee..3d2a217eba 100644 --- a/libmamba/src/core/progress_bar_impl.cpp +++ b/libmamba/src/core/progress_bar_impl.cpp @@ -1902,8 +1902,7 @@ namespace mamba { for (auto& [label, bars] : m_labels) { - std::size_t current = 0, total = 0, in_progress = 0, speed = 0, active_count = 0, - total_count = 0; + std::size_t current = 0, total = 0, in_progress = 0, speed = 0; bool any_spinner = false; bool any_started = false; std::vector start_times = {}; @@ -1916,7 +1915,6 @@ namespace mamba { current += bar->current(); total += bar->total(); - ++total_count; if (!bar->unset()) { @@ -1926,7 +1924,6 @@ namespace mamba { speed += bar->speed(); in_progress += (bar->total() - bar->current()); - ++active_count; aggregate_bar_ptr->add_active_task(bar->prefix()); any_started = true; } diff --git a/libmamba/src/core/shell_init.cpp b/libmamba/src/core/shell_init.cpp index af63dbc0d3..0193aeb52f 100644 --- a/libmamba/src/core/shell_init.cpp +++ b/libmamba/src/core/shell_init.cpp @@ -749,7 +749,7 @@ namespace mamba { const ShellInitPathsWindowsCmd paths{ root_prefix }; - for (const auto directory : paths.every_generated_directories_paths()) + for (const auto& directory : paths.every_generated_directories_paths()) { // Maybe the prefix isn't writable. No big deal, just keep going. std::error_code maybe_error [[maybe_unused]]; diff --git a/libmamba/src/download/downloader.cpp b/libmamba/src/download/downloader.cpp index b6c6bf5c3d..2273bfdd48 100644 --- a/libmamba/src/download/downloader.cpp +++ b/libmamba/src/download/downloader.cpp @@ -962,7 +962,7 @@ namespace mamba::download { new_mirror = find_mirror( m_mirror_set, - [this, iteration](const auto& mirror) { + [iteration](const auto& mirror) { return iteration > mirror->failed_transfers() && mirror->can_accept_more_connections(); } diff --git a/libmamba/tests/src/download/test_mirror.cpp b/libmamba/tests/src/download/test_mirror.cpp index 15c9f5f60c..eb44ccaef2 100644 --- a/libmamba/tests/src/download/test_mirror.cpp +++ b/libmamba/tests/src/download/test_mirror.cpp @@ -58,7 +58,10 @@ namespace mamba::download TEST_CASE("PassThroughMirror") { std::unique_ptr mir = make_mirror(""); - CHECK_EQ(typeid(*mir), typeid(PassThroughMirror)); + // `mir_ref` is used here to provide an explicit expression to `typeid` + // and avoid expression with side effects evaluation warning + auto& mir_ref = *mir; + CHECK_EQ(typeid(mir_ref), typeid(PassThroughMirror)); Mirror::request_generator_list req_gen = mir->get_request_generators("", ""); CHECK_EQ(req_gen.size(), 1); @@ -75,7 +78,10 @@ namespace mamba::download SUBCASE("https") { std::unique_ptr mir = make_mirror("https://conda.anaconda.org/conda-forge"); - CHECK_EQ(typeid(*mir), typeid(HTTPMirror)); + // `mir_ref` is used here to provide an explicit expression to `typeid` + // and avoid expression with side effects evaluation warning + auto& mir_ref = *mir; + CHECK_EQ(typeid(mir_ref), typeid(HTTPMirror)); Mirror::request_generator_list req_gen = mir->get_request_generators("", ""); CHECK_EQ(req_gen.size(), 1); @@ -94,7 +100,10 @@ namespace mamba::download SUBCASE("http") { std::unique_ptr mir = make_mirror("http://conda.anaconda.org/conda-forge"); - CHECK_EQ(typeid(*mir), typeid(HTTPMirror)); + // `mir_ref` is used here to provide an explicit expression to `typeid` + // and avoid expression with side effects evaluation warning + auto& mir_ref = *mir; + CHECK_EQ(typeid(mir_ref), typeid(HTTPMirror)); Mirror::request_generator_list req_gen = mir->get_request_generators("", ""); CHECK_EQ(req_gen.size(), 1); @@ -113,7 +122,10 @@ namespace mamba::download SUBCASE("file") { std::unique_ptr mir = make_mirror("file://channel_path"); - CHECK_EQ(typeid(*mir), typeid(HTTPMirror)); + // `mir_ref` is used here to provide an explicit expression to `typeid` + // and avoid expression with side effects evaluation warning + auto& mir_ref = *mir; + CHECK_EQ(typeid(mir_ref), typeid(HTTPMirror)); Mirror::request_generator_list req_gen = mir->get_request_generators("", ""); CHECK_EQ(req_gen.size(), 1); @@ -135,7 +147,10 @@ namespace mamba::download SUBCASE("Request repodata.json") { std::unique_ptr mir = make_mirror("oci://ghcr.io/channel-mirrors/conda-forge"); - CHECK_EQ(typeid(*mir), typeid(OCIMirror)); + // `mir_ref` is used here to provide an explicit expression to `typeid` + // and avoid expression with side effects evaluation warning + auto& mir_ref = *mir; + CHECK_EQ(typeid(mir_ref), typeid(OCIMirror)); Mirror::request_generator_list req_gen = mir->get_request_generators( "linux-64/repodata.json", @@ -164,7 +179,10 @@ namespace mamba::download SUBCASE("Request spec with sha") { std::unique_ptr mir = make_mirror("oci://ghcr.io/channel-mirrors/conda-forge"); - CHECK_EQ(typeid(*mir), typeid(OCIMirror)); + // `mir_ref` is used here to provide an explicit expression to `typeid` + // and avoid expression with side effects evaluation warning + auto& mir_ref = *mir; + CHECK_EQ(typeid(mir_ref), typeid(OCIMirror)); Mirror::request_generator_list req_gen = mir->get_request_generators( "linux-64/pandoc-3.2-ha770c72_0.conda", From 20d51bb0c504a3a21d4ad6952f0c03c5d725eb7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Klaim=20=28Jo=C3=ABl=20Lamotte=29?= <142265+Klaim@users.noreply.github.com> Date: Thu, 14 Nov 2024 16:06:02 +0100 Subject: [PATCH 105/126] More details in error message when failing to parse json from a python command's output (#3604) --- .../include/mamba/specs/build_number_spec.hpp | 4 +-- libmamba/include/mamba/specs/version_spec.hpp | 4 +-- libmamba/src/core/prefix_data.cpp | 35 +++++++++++++++++-- 3 files changed, 37 insertions(+), 6 deletions(-) diff --git a/libmamba/include/mamba/specs/build_number_spec.hpp b/libmamba/include/mamba/specs/build_number_spec.hpp index ddb1e717ca..5683df5b9b 100644 --- a/libmamba/include/mamba/specs/build_number_spec.hpp +++ b/libmamba/include/mamba/specs/build_number_spec.hpp @@ -73,7 +73,7 @@ namespace mamba::specs friend auto equal(free_interval, free_interval) -> bool; friend auto operator==(const BuildNumberPredicate& lhs, const BuildNumberPredicate& rhs) -> bool; - friend class ::fmt::formatter; + friend struct ::fmt::formatter; }; auto operator==(const BuildNumberPredicate& lhs, const BuildNumberPredicate& rhs) -> bool; @@ -140,7 +140,7 @@ namespace mamba::specs BuildNumberPredicate m_predicate; - friend class ::fmt::formatter; + friend struct ::fmt::formatter; }; namespace build_number_spec_literals diff --git a/libmamba/include/mamba/specs/version_spec.hpp b/libmamba/include/mamba/specs/version_spec.hpp index 50c1b746cf..bb4fccc962 100644 --- a/libmamba/include/mamba/specs/version_spec.hpp +++ b/libmamba/include/mamba/specs/version_spec.hpp @@ -110,7 +110,7 @@ namespace mamba::specs friend auto operator==(not_starts_with, not_starts_with) -> bool; friend auto operator==(compatible_with, compatible_with) -> bool; friend auto operator==(const VersionPredicate& lhs, const VersionPredicate& rhs) -> bool; - friend class ::fmt::formatter; + friend struct ::fmt::formatter; }; auto operator==(const VersionPredicate& lhs, const VersionPredicate& rhs) -> bool; @@ -210,7 +210,7 @@ namespace mamba::specs tree_type m_tree; - friend class ::fmt::formatter; + friend struct ::fmt::formatter; }; namespace version_spec_literals diff --git a/libmamba/src/core/prefix_data.cpp b/libmamba/src/core/prefix_data.cpp index 807a03d028..00d8c4dab5 100644 --- a/libmamba/src/core/prefix_data.cpp +++ b/libmamba/src/core/prefix_data.cpp @@ -9,9 +9,11 @@ #include #include +#include #include #include "mamba/core/channel_context.hpp" +#include "mamba/core/error_handling.hpp" #include "mamba/core/output.hpp" #include "mamba/core/prefix_data.hpp" #include "mamba/core/util.hpp" @@ -223,15 +225,27 @@ namespace mamba reproc::options run_options; run_options.env.extra = reproc::env{ env }; + LOG_TRACE << "Running command: " + << fmt::format("{}\n env options:{}", fmt::join(args, " "), fmt::join(env, " ")); + auto [status, ec] = reproc::run( args, run_options, reproc::sink::string(out), reproc::sink::string(err) ); + if (ec) { - throw std::runtime_error(ec.message()); + const auto message = fmt::format( + "failed to run python command :\n error: {}\n command ran: {}\n env options:{}\n-> output:\n{}\n\n-> error output:{}", + ec.message(), + fmt::join(args, " "), + fmt::join(env, " "), + out, + err + ); + throw mamba_error{ message, mamba_error_code::internal_failure }; } // Nothing installed with `pip` @@ -241,7 +255,24 @@ namespace mamba return; } - nlohmann::json j = nlohmann::json::parse(out); + LOG_TRACE << "Parsing `pip inspect` output:\n" << out; + nlohmann::json j; + try + { + j = nlohmann::json::parse(out); + } + catch (const std::exception& ec) + { + const auto message = fmt::format( + "failed to parse python command output:\n error: {}\n command ran: {}\n env options:{}\n-> output:\n{}\n\n-> error output:{}", + ec.what(), + fmt::join(args, " "), + fmt::join(env, " "), + out, + err + ); + throw mamba_error{ message, mamba_error_code::internal_failure }; + } if (j.contains("installed") && j["installed"].is_array()) { From 333abd0eeaa433ad9781a8881bc2dd28b0668e1c Mon Sep 17 00:00:00 2001 From: Hind Montassif Date: Thu, 14 Nov 2024 18:00:59 +0100 Subject: [PATCH 106/126] release libmamba 2.0.4alpha2, libmambapy 2.0.4alpha2, micromamba 2.0.4alpha2 --- CHANGELOG.md | 19 +++++++++++++++++++ libmamba/CHANGELOG.md | 17 +++++++++++++++++ libmambapy/CHANGELOG.md | 12 ++++++++++++ micromamba/CHANGELOG.md | 13 +++++++++++++ 4 files changed, 61 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 19c34c1f9e..5fae4896d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,22 @@ +2024.11.14 +========== + +Releases: libmamba 2.0.4alpha2, libmambapy 2.0.4alpha2, micromamba 2.0.4alpha2 + +Enhancements: + +- [libmamba] More details in error message when failing to parse json from a python command's output by @Klaim in https://github.com/mamba-org/mamba/pull/3604 + +Bug fixes: + +- [libmamba] Fix some warnings by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3595 +- [all] Remove Taskfile from `environment-dev-extra.yml` by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3597 + +CI fixes and doc: + +- [micromamba, libmamba] Update pre-commit hooks except clang-format by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3599 +- [all] Force spinx v6 in readthedocs by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3586 + 2024.11.12-0 ============ diff --git a/libmamba/CHANGELOG.md b/libmamba/CHANGELOG.md index 0ef8725ed0..01e0133965 100644 --- a/libmamba/CHANGELOG.md +++ b/libmamba/CHANGELOG.md @@ -1,3 +1,20 @@ +libmamba 2.0.4alpha2 (November 14, 2024) +======================================== + +Enhancements: + +- More details in error message when failing to parse json from a python command's output by @Klaim in https://github.com/mamba-org/mamba/pull/3604 + +Bug fixes: + +- Fix some warnings by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3595 +- Remove Taskfile from `environment-dev-extra.yml` by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3597 + +CI fixes and doc: + +- Update pre-commit hooks except clang-format by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3599 +- Force spinx v6 in readthedocs by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3586 + libmamba 2.0.4alpha1 (November 12, 2024) ======================================== diff --git a/libmambapy/CHANGELOG.md b/libmambapy/CHANGELOG.md index ca095fd685..b341f0634d 100644 --- a/libmambapy/CHANGELOG.md +++ b/libmambapy/CHANGELOG.md @@ -1,3 +1,15 @@ +libmambapy 2.0.4alpha2 (November 14, 2024) +========================================== + + +Bug fixes: + +- Remove Taskfile from `environment-dev-extra.yml` by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3597 + +CI fixes and doc: + +- Force spinx v6 in readthedocs by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3586 + libmambapy 2.0.4alpha1 (November 12, 2024) ========================================== diff --git a/micromamba/CHANGELOG.md b/micromamba/CHANGELOG.md index 72c3659437..419fa87901 100644 --- a/micromamba/CHANGELOG.md +++ b/micromamba/CHANGELOG.md @@ -1,3 +1,16 @@ +micromamba 2.0.4alpha2 (November 14, 2024) +========================================== + + +Bug fixes: + +- Remove Taskfile from `environment-dev-extra.yml` by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3597 + +CI fixes and doc: + +- Update pre-commit hooks except clang-format by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3599 +- Force spinx v6 in readthedocs by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3586 + micromamba 2.0.4alpha1 (November 12, 2024) ========================================== From ccbf7952815138f6178518cea656a5393bf1d8f7 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Mon, 18 Nov 2024 10:20:55 +0000 Subject: [PATCH 107/126] fix: Export `'channels'` as part of environments' export (#3587) --- micromamba/src/env.cpp | 16 ++++++---------- micromamba/tests/test_env.py | 32 ++++++++++++++++++++++++-------- 2 files changed, 30 insertions(+), 18 deletions(-) diff --git a/micromamba/src/env.cpp b/micromamba/src/env.cpp index f46a8f6158..d17e3b4e71 100644 --- a/micromamba/src/env.cpp +++ b/micromamba/src/env.cpp @@ -231,18 +231,14 @@ set_env_command(CLI::App* com, Configuration& config) std::cout << "{\n"; - if (!channels.empty()) + std::cout << " \"channels\": [\n"; + for (auto channel_it = channels.begin(); channel_it != channels.end(); ++channel_it) { - std::cout << " \"channels\": [\n"; - for (auto channel_it = channels.begin(); channel_it != channels.end(); - ++channel_it) - { - auto last_channel = std::next(channel_it) == channels.end(); - std::cout << " \"" << *channel_it << "\"" << (last_channel ? "" : ",") - << "\n"; - } - std::cout << " ],\n"; + auto last_channel = std::next(channel_it) == channels.end(); + std::cout << " \"" << *channel_it << "\"" << (last_channel ? "" : ",") << "\n"; } + std::cout << " ],\n"; + std::cout << " \"dependencies\": [\n" << dependencies.str() << " ],\n"; std::cout << " \"name\": \"" << get_env_name(ctx, ctx.prefix_params.target_prefix) diff --git a/micromamba/tests/test_env.py b/micromamba/tests/test_env.py index b1c8f112db..db443a44b0 100644 --- a/micromamba/tests/test_env.py +++ b/micromamba/tests/test_env.py @@ -62,6 +62,25 @@ def test_register_new_env(tmp_home, tmp_root_prefix): assert str(env_3_fp) in env_json["envs"] +@pytest.fixture(scope="module") +def empty_env(): + env_name = "env-empty" + helpers.create("-n", env_name) + return env_name + + +@pytest.mark.parametrize("json_flag", [None, "--json"]) +def test_env_export_empty(json_flag, empty_env): + flags = filter(None, [json_flag]) + output = helpers.run_env("export", "-n", empty_env, *flags) + + # json is already parsed + ret = output if json_flag else yaml.safe_load(output) + assert ret["name"] == empty_env + assert empty_env in ret["prefix"] + assert not ret["channels"] + + @pytest.fixture(scope="module") def export_env(): env_name = "env-create-export" @@ -90,27 +109,24 @@ def test_env_export_from_history(json_flag, export_env): @pytest.mark.parametrize("no_build_flag", [None, "--no-build", "--no-builds"]) @pytest.mark.parametrize("json_flag", [None, "--json"]) def test_env_export( - export_env, json_flag, no_build_flag, explicit_flag, md5_flag, channel_subdir_flag + channel_subdir_flag, md5_flag, explicit_flag, no_build_flag, json_flag, export_env ): if explicit_flag and json_flag: # `--explicit` has precedence over `--json`, which is tested bellow. # But we need to omit here to avoid `helpers.run_env` to parse the output as JSON and fail. json_flag = None - flags = filter(None, [no_build_flag, json_flag, explicit_flag, md5_flag, channel_subdir_flag]) + flags = filter(None, [channel_subdir_flag, md5_flag, explicit_flag, no_build_flag, json_flag]) output = helpers.run_env("export", "-n", export_env, *flags) if explicit_flag: assert "/micromamba-0.24.0-0." in output if md5_flag != "--no-md5": assert re.search("#[a-f0-9]{32}$", output.replace("\r", "")) else: - if json_flag: - # Already parsed - ret = output - else: - ret = yaml.safe_load(output) + # json is already parsed + ret = output if json_flag else yaml.safe_load(output) assert ret["name"] == export_env - assert "env-create-export" in ret["prefix"] + assert export_env in ret["prefix"] assert set(ret["channels"]) == {"conda-forge"} micromamba_spec_prefix = "micromamba=0.24.0" if no_build_flag else "micromamba=0.24.0=0" assert micromamba_spec_prefix in str(ret["dependencies"]) From 6654e1563335c0c91981fc5733f7511c18730743 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Mon, 18 Nov 2024 12:21:35 +0000 Subject: [PATCH 108/126] maint: Address compiler warnings (#3605) Co-authored-by: Julien Jerphanion --- libmamba/include/mamba/util/parsers.hpp | 4 ++-- libmamba/src/core/prefix_data.cpp | 4 ++-- libmamba/src/core/progress_bar_impl.cpp | 2 +- .../tests/src/validation/test_update_framework_v0_6.cpp | 9 ++++++++- micromamba/src/constructor.cpp | 2 +- 5 files changed, 14 insertions(+), 7 deletions(-) diff --git a/libmamba/include/mamba/util/parsers.hpp b/libmamba/include/mamba/util/parsers.hpp index 5aa44a1f6b..0654f087f8 100644 --- a/libmamba/include/mamba/util/parsers.hpp +++ b/libmamba/include/mamba/util/parsers.hpp @@ -277,11 +277,11 @@ namespace mamba::util template constexpr auto find(const std::array& arr, const T& val) -> std::size_t { - auto pos = std::size_t(N); + std::size_t pos = N; for (std::size_t i = 0; i < N; ++i) { const bool found = arr[i] == val; - pos = static_cast(found) * i + (1 - static_cast(found)) * pos; + pos = found ? i : pos; } return pos; } diff --git a/libmamba/src/core/prefix_data.cpp b/libmamba/src/core/prefix_data.cpp index 00d8c4dab5..c7031dbaff 100644 --- a/libmamba/src/core/prefix_data.cpp +++ b/libmamba/src/core/prefix_data.cpp @@ -261,11 +261,11 @@ namespace mamba { j = nlohmann::json::parse(out); } - catch (const std::exception& ec) + catch (const std::exception& exc) { const auto message = fmt::format( "failed to parse python command output:\n error: {}\n command ran: {}\n env options:{}\n-> output:\n{}\n\n-> error output:{}", - ec.what(), + exc.what(), fmt::join(args, " "), fmt::join(env, " "), out, diff --git a/libmamba/src/core/progress_bar_impl.cpp b/libmamba/src/core/progress_bar_impl.cpp index 3d2a217eba..1e2d050143 100644 --- a/libmamba/src/core/progress_bar_impl.cpp +++ b/libmamba/src/core/progress_bar_impl.cpp @@ -1395,7 +1395,7 @@ namespace mamba { if (!m_is_spinner) { - auto seed = static_cast( + auto seed = static_cast( std::chrono::system_clock::now().time_since_epoch().count() ); std::default_random_engine generator(seed); diff --git a/libmamba/tests/src/validation/test_update_framework_v0_6.cpp b/libmamba/tests/src/validation/test_update_framework_v0_6.cpp index 2a3bc196fa..fcfbae7d19 100644 --- a/libmamba/tests/src/validation/test_update_framework_v0_6.cpp +++ b/libmamba/tests/src/validation/test_update_framework_v0_6.cpp @@ -4,6 +4,13 @@ // // The full license is in the file LICENSE, distributed with this software. +// There are several `CHECK_THROWS_AS` expressions in this file. +// Sometimes they call a method marked as `[[nodiscard]]`. +// This causes compiler warnnings. +// This doctest flag is designed specifically to prevent this warning from happening. +// https://github.com/doctest/doctest/blob/master/doc/markdown/configuration.md#doctest_config_void_cast_expressions +#define DOCTEST_CONFIG_VOID_CAST_EXPRESSIONS + #include #include @@ -249,7 +256,7 @@ TEST_SUITE("validation::v0_6::RootImpl") out_file.close(); // "2.sv1.root.json" is not compatible spec version (spec version N) - CHECK_THROWS_AS(v0_6::RootImpl root(p), role_file_error); + CHECK_THROWS_AS(v0_6::RootImpl{ p }, role_file_error); } TEST_CASE_FIXTURE(RootImplT_v0_6, "update_from_path") diff --git a/micromamba/src/constructor.cpp b/micromamba/src/constructor.cpp index aaf6c6db70..ad7e39f88a 100644 --- a/micromamba/src/constructor.cpp +++ b/micromamba/src/constructor.cpp @@ -211,7 +211,7 @@ read_binary_from_stdin_and_write_to_file(fs::u8path& filename) { throw std::runtime_error("Reading from stdin failed."); } - out_stream.write(buffer.data(), len); + out_stream.write(buffer.data(), static_cast(len)); } out_stream.close(); } From ad9b2d6b8840825411a3c23251cfbb978ab60e89 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Mon, 18 Nov 2024 16:29:18 +0000 Subject: [PATCH 109/126] maint: Update clang-format to v19 (#3600) --- .pre-commit-config.yaml | 2 +- .../ext/solv-cpp/include/solv-cpp/solver.hpp | 4 +- .../solv-cpp/include/solv-cpp/transaction.hpp | 8 +- libmamba/ext/solv-cpp/src/pool.cpp | 8 +- libmamba/ext/solv-cpp/src/solver.cpp | 4 +- libmamba/ext/solv-cpp/src/transaction.cpp | 8 +- libmamba/ext/solv-cpp/tests/src/pool_data.cpp | 4 +- libmamba/include/mamba/core/query.hpp | 4 +- .../include/mamba/download/mirror_map.hpp | 4 +- .../include/mamba/solver/libsolv/database.hpp | 24 ++-- .../include/mamba/specs/build_number_spec.hpp | 4 +- libmamba/include/mamba/specs/channel.hpp | 8 +- libmamba/include/mamba/specs/glob_spec.hpp | 4 +- libmamba/include/mamba/specs/match_spec.hpp | 4 +- libmamba/include/mamba/specs/platform.hpp | 8 +- libmamba/include/mamba/specs/regex_spec.hpp | 4 +- libmamba/include/mamba/specs/version_spec.hpp | 8 +- libmamba/include/mamba/util/encoding.hpp | 20 +-- libmamba/include/mamba/util/environment.hpp | 8 +- .../include/mamba/util/flat_binary_tree.hpp | 12 +- .../mamba/util/flat_bool_expr_tree.hpp | 4 +- libmamba/include/mamba/util/flat_set.hpp | 37 +++-- libmamba/include/mamba/util/graph.hpp | 3 +- libmamba/include/mamba/util/os_unix.hpp | 4 +- libmamba/include/mamba/util/parsers.hpp | 4 +- libmamba/include/mamba/util/path_manip.hpp | 12 +- libmamba/include/mamba/util/random.hpp | 4 +- libmamba/include/mamba/util/string.hpp | 134 +++++++++--------- libmamba/include/mamba/util/tuple_hash.hpp | 4 +- libmamba/include/mamba/util/url.hpp | 18 +-- libmamba/include/mamba/validation/tools.hpp | 12 +- .../mamba/validation/update_framework.hpp | 12 +- .../validation/update_framework_v0_6.hpp | 4 +- .../mamba/validation/update_framework_v1.hpp | 4 +- libmamba/src/api/configuration.cpp | 7 +- libmamba/src/api/shell.cpp | 4 +- libmamba/src/core/channel_context.cpp | 7 +- libmamba/src/core/package_fetcher.cpp | 4 +- libmamba/src/core/package_handling.cpp | 8 +- libmamba/src/core/subdirdata.cpp | 3 +- libmamba/src/core/transaction.cpp | 4 +- libmamba/src/core/virtual_packages.cpp | 9 +- libmamba/src/download/downloader.cpp | 6 +- libmamba/src/download/downloader_impl.hpp | 4 +- libmamba/src/download/mirror_impl.cpp | 7 +- libmamba/src/solver/helpers.cpp | 4 +- libmamba/src/solver/helpers.hpp | 4 +- libmamba/src/solver/libsolv/helpers.cpp | 22 +-- libmamba/src/solver/libsolv/helpers.hpp | 8 +- libmamba/src/solver/libsolv/matcher.cpp | 4 +- libmamba/src/solver/libsolv/unsolvable.cpp | 4 +- libmamba/src/solver/problems_graph.cpp | 26 ++-- libmamba/src/specs/authentication_info.cpp | 8 +- libmamba/src/specs/build_number_spec.cpp | 12 +- libmamba/src/specs/channel.cpp | 26 ++-- libmamba/src/specs/chimera_string_spec.cpp | 7 +- libmamba/src/specs/conda_url.cpp | 4 +- libmamba/src/specs/glob_spec.cpp | 6 +- libmamba/src/specs/match_spec.cpp | 14 +- libmamba/src/specs/unresolved_channel.cpp | 14 +- libmamba/src/specs/version.cpp | 32 ++--- libmamba/src/specs/version_spec.cpp | 18 +-- libmamba/src/util/encoding.cpp | 4 +- libmamba/src/util/string.cpp | 44 +++--- libmamba/src/util/url.cpp | 12 +- libmamba/src/validation/keys.cpp | 2 +- libmamba/src/validation/tools.cpp | 19 +-- .../src/validation/update_framework_v0_6.cpp | 4 +- .../src/solver/libsolv/test_database.cpp | 4 +- .../tests/src/solver/libsolv/test_solver.cpp | 3 +- .../tests/src/solver/test_problems_graph.cpp | 7 +- libmamba/tests/src/specs/test_channel.cpp | 5 +- .../validation/test_update_framework_v0_6.cpp | 12 +- .../validation/test_update_framework_v1.cpp | 4 +- libmambapy/src/libmambapy/bindings/legacy.cpp | 6 +- .../libmambapy/bindings/solver_libsolv.cpp | 8 +- libmambapy/src/libmambapy/bindings/specs.cpp | 12 +- 77 files changed, 421 insertions(+), 407 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8aab8fd3e5..1a88afeba9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -34,7 +34,7 @@ repos: - id: blacken-docs additional_dependencies: [black==24.10.0] - repo: https://github.com/pre-commit/mirrors-clang-format - rev: v18.1.2 + rev: v19.1.3 hooks: - id: clang-format args: [--style=file] diff --git a/libmamba/ext/solv-cpp/include/solv-cpp/solver.hpp b/libmamba/ext/solv-cpp/include/solv-cpp/solver.hpp index 3a86bc7821..78de562d6c 100644 --- a/libmamba/ext/solv-cpp/include/solv-cpp/solver.hpp +++ b/libmamba/ext/solv-cpp/include/solv-cpp/solver.hpp @@ -71,8 +71,8 @@ namespace solv */ [[nodiscard]] auto problem_rules(ProblemId id) const -> ObjQueue; [[nodiscard]] auto get_rule_info(const ObjPool& pool, RuleId id) const -> ObjRuleInfo; - [[nodiscard]] auto - rule_info_to_string(const ObjPool& pool, const ObjRuleInfo& id) const -> std::string; + [[nodiscard]] auto rule_info_to_string(const ObjPool& pool, const ObjRuleInfo& id) const + -> std::string; private: diff --git a/libmamba/ext/solv-cpp/include/solv-cpp/transaction.hpp b/libmamba/ext/solv-cpp/include/solv-cpp/transaction.hpp index 6a24eee67c..1e0ba9c139 100644 --- a/libmamba/ext/solv-cpp/include/solv-cpp/transaction.hpp +++ b/libmamba/ext/solv-cpp/include/solv-cpp/transaction.hpp @@ -37,16 +37,16 @@ namespace solv * * Negative solvable ids are use to mean that the solvable must be removed. */ - [[nodiscard]] static auto - from_solvables(const ObjPool& pool, const ObjQueue& solvables) -> ObjTransaction; + [[nodiscard]] static auto from_solvables(const ObjPool& pool, const ObjQueue& solvables) + -> ObjTransaction; /** * Create a transaction from the result of a solver run. * * The solver must be solved. */ - [[nodiscard]] static auto - from_solver(const ObjPool& pool, const ObjSolver& solver) -> ObjTransaction; + [[nodiscard]] static auto from_solver(const ObjPool& pool, const ObjSolver& solver) + -> ObjTransaction; ObjTransaction(const ObjPool& pool); ObjTransaction(ObjTransaction&&) noexcept = default; diff --git a/libmamba/ext/solv-cpp/src/pool.cpp b/libmamba/ext/solv-cpp/src/pool.cpp index 50f691a380..bf2f7bc898 100644 --- a/libmamba/ext/solv-cpp/src/pool.cpp +++ b/libmamba/ext/solv-cpp/src/pool.cpp @@ -118,8 +118,8 @@ namespace solv return (id == 0) ? std::nullopt : std::optional(DependencyId{ id }); } - auto - ObjPoolView::add_dependency(StringId name_id, RelationFlag flag, StringId version_id) -> DependencyId + auto ObjPoolView::add_dependency(StringId name_id, RelationFlag flag, StringId version_id) + -> DependencyId { // Note: libsolv cannot report failure to allocate const ::Id id = ::pool_rel2id( @@ -181,8 +181,8 @@ namespace solv return solvables; } - auto - ObjPoolView::what_matches_dep(KeyNameId key, DependencyId dep, DependencyMarker marker) const -> ObjQueue + auto ObjPoolView::what_matches_dep(KeyNameId key, DependencyId dep, DependencyMarker marker) const + -> ObjQueue { ObjQueue solvables = {}; ::pool_whatmatchesdep(const_cast<::Pool*>(raw()), key, dep, solvables.raw(), marker); diff --git a/libmamba/ext/solv-cpp/src/solver.cpp b/libmamba/ext/solv-cpp/src/solver.cpp index 3c55bdb70a..5ac15fdc97 100644 --- a/libmamba/ext/solv-cpp/src/solver.cpp +++ b/libmamba/ext/solv-cpp/src/solver.cpp @@ -228,8 +228,8 @@ namespace solv }; } - auto - ObjSolver::rule_info_to_string(const ObjPool& /* pool */, const ObjRuleInfo& ri) const -> std::string + auto ObjSolver::rule_info_to_string(const ObjPool& /* pool */, const ObjRuleInfo& ri) const + -> std::string { // pool is captured inside solver so we take it as a parameter to be explicit. return ::solver_ruleinfo2str( diff --git a/libmamba/ext/solv-cpp/src/transaction.cpp b/libmamba/ext/solv-cpp/src/transaction.cpp index 6361cc5ed7..180e11ce81 100644 --- a/libmamba/ext/solv-cpp/src/transaction.cpp +++ b/libmamba/ext/solv-cpp/src/transaction.cpp @@ -41,8 +41,8 @@ namespace solv return *this; } - auto - ObjTransaction::from_solvables(const ObjPool& pool, const ObjQueue& solvables) -> ObjTransaction + auto ObjTransaction::from_solvables(const ObjPool& pool, const ObjQueue& solvables) + -> ObjTransaction { return ObjTransaction{ ::transaction_create_decisionq( const_cast<::Pool*>(pool.raw()), @@ -103,8 +103,8 @@ namespace solv return ::transaction_type(const_cast<::Transaction*>(raw()), step, mode); } - auto - ObjTransaction::step_newer(const ObjPool& pool, SolvableId step) const -> std::optional + auto ObjTransaction::step_newer(const ObjPool& pool, SolvableId step) const + -> std::optional { assert_same_pool(pool, *this); if (const auto solvable = pool.get_solvable(step); solvable && solvable->installed()) diff --git a/libmamba/ext/solv-cpp/tests/src/pool_data.cpp b/libmamba/ext/solv-cpp/tests/src/pool_data.cpp index fa095ce33f..e18d8eedf7 100644 --- a/libmamba/ext/solv-cpp/tests/src/pool_data.cpp +++ b/libmamba/ext/solv-cpp/tests/src/pool_data.cpp @@ -48,8 +48,8 @@ namespace solv::test return attrs(a) >= attrs(b); } - auto - add_simple_package(solv::ObjPool& pool, solv::ObjRepoView& repo, const SimplePkg& pkg) -> solv::SolvableId + auto add_simple_package(solv::ObjPool& pool, solv::ObjRepoView& repo, const SimplePkg& pkg) + -> solv::SolvableId { auto [solv_id, solv] = repo.add_solvable(); solv.set_name(pkg.name); diff --git a/libmamba/include/mamba/core/query.hpp b/libmamba/include/mamba/core/query.hpp index 2cb86adaac..45ddfd8e85 100644 --- a/libmamba/include/mamba/core/query.hpp +++ b/libmamba/include/mamba/core/query.hpp @@ -94,8 +94,8 @@ namespace mamba using Database = solver::libsolv::Database; - [[nodiscard]] static auto - find(Database& db, const std::vector& queries) -> QueryResult; + [[nodiscard]] static auto find(Database& db, const std::vector& queries) + -> QueryResult; [[nodiscard]] static auto whoneeds(Database& db, std::string query, bool tree) -> QueryResult; diff --git a/libmamba/include/mamba/download/mirror_map.hpp b/libmamba/include/mamba/download/mirror_map.hpp index adc4548d38..bbc9b71770 100644 --- a/libmamba/include/mamba/download/mirror_map.hpp +++ b/libmamba/include/mamba/download/mirror_map.hpp @@ -64,8 +64,8 @@ namespace mamba::download }; template - auto - mirror_map::create_unique_mirror(const std::string& mirror_name, Args&&... args) -> MirrorType& + auto mirror_map::create_unique_mirror(const std::string& mirror_name, Args&&... args) + -> MirrorType& { static_assert(std::is_base_of_v); diff --git a/libmamba/include/mamba/solver/libsolv/database.hpp b/libmamba/include/mamba/solver/libsolv/database.hpp index 7dc4a0ecc0..641b926685 100644 --- a/libmamba/include/mamba/solver/libsolv/database.hpp +++ b/libmamba/include/mamba/solver/libsolv/database.hpp @@ -100,11 +100,9 @@ namespace mamba::solver::libsolv PipAsPythonDependency add = PipAsPythonDependency::No ) -> RepoInfo; - auto native_serialize_repo( - const RepoInfo& repo, - const fs::u8path& path, - const RepodataOrigin& metadata - ) -> expected_t; + auto + native_serialize_repo(const RepoInfo& repo, const fs::u8path& path, const RepodataOrigin& metadata) + -> expected_t; [[nodiscard]] auto installed_repo() const -> std::optional; @@ -162,11 +160,11 @@ namespace mamba::solver::libsolv [[nodiscard]] auto packages_in_repo(RepoInfo repo) const -> std::vector; - [[nodiscard]] auto - packages_matching_ids(const specs::MatchSpec& ms) -> std::vector; + [[nodiscard]] auto packages_matching_ids(const specs::MatchSpec& ms) + -> std::vector; - [[nodiscard]] auto - packages_depending_on_ids(const specs::MatchSpec& ms) -> std::vector; + [[nodiscard]] auto packages_depending_on_ids(const specs::MatchSpec& ms) + -> std::vector; }; /******************** @@ -191,11 +189,9 @@ namespace mamba::solver::libsolv } template - auto Database::add_repo_from_packages( - const Range& packages, - std::string_view name, - PipAsPythonDependency add - ) -> RepoInfo + auto + Database::add_repo_from_packages(const Range& packages, std::string_view name, PipAsPythonDependency add) + -> RepoInfo { return add_repo_from_packages(packages.begin(), packages.end(), name, add); } diff --git a/libmamba/include/mamba/specs/build_number_spec.hpp b/libmamba/include/mamba/specs/build_number_spec.hpp index 5683df5b9b..585b51793d 100644 --- a/libmamba/include/mamba/specs/build_number_spec.hpp +++ b/libmamba/include/mamba/specs/build_number_spec.hpp @@ -71,8 +71,8 @@ namespace mamba::specs BuildNumberPredicate(BuildNumber ver, BinaryOperator op); friend auto equal(free_interval, free_interval) -> bool; - friend auto - operator==(const BuildNumberPredicate& lhs, const BuildNumberPredicate& rhs) -> bool; + friend auto operator==(const BuildNumberPredicate& lhs, const BuildNumberPredicate& rhs) + -> bool; friend struct ::fmt::formatter; }; diff --git a/libmamba/include/mamba/specs/channel.hpp b/libmamba/include/mamba/specs/channel.hpp index 59f66ed89b..f3bdc23ff4 100644 --- a/libmamba/include/mamba/specs/channel.hpp +++ b/libmamba/include/mamba/specs/channel.hpp @@ -39,8 +39,8 @@ namespace mamba::specs /** * Remove the last element of the '/'-separated name. */ - [[nodiscard]] auto - weaken_key(std::string_view key) const -> std::optional; + [[nodiscard]] auto weaken_key(std::string_view key) const + -> std::optional; }; template @@ -95,8 +95,8 @@ namespace mamba::specs [[nodiscard]] auto mirror_urls() const -> const std::vector&; [[nodiscard]] auto platform_mirror_urls() const -> std::vector; - [[nodiscard]] auto - platform_mirror_urls(const std::string_view platform) const -> std::vector; + [[nodiscard]] auto platform_mirror_urls(const std::string_view platform) const + -> std::vector; [[nodiscard]] auto url() const -> const CondaURL&; auto clear_url() -> const CondaURL; diff --git a/libmamba/include/mamba/specs/glob_spec.hpp b/libmamba/include/mamba/specs/glob_spec.hpp index 706dd7591c..6b2ff80b4d 100644 --- a/libmamba/include/mamba/specs/glob_spec.hpp +++ b/libmamba/include/mamba/specs/glob_spec.hpp @@ -65,8 +65,8 @@ struct fmt::formatter { auto parse(format_parse_context& ctx) -> decltype(ctx.begin()); - auto - format(const ::mamba::specs::GlobSpec& spec, format_context& ctx) const -> decltype(ctx.out()); + auto format(const ::mamba::specs::GlobSpec& spec, format_context& ctx) const + -> decltype(ctx.out()); }; template <> diff --git a/libmamba/include/mamba/specs/match_spec.hpp b/libmamba/include/mamba/specs/match_spec.hpp index 1d4ceaa1e2..b6552fa199 100644 --- a/libmamba/include/mamba/specs/match_spec.hpp +++ b/libmamba/include/mamba/specs/match_spec.hpp @@ -226,8 +226,8 @@ struct fmt::formatter<::mamba::specs::MatchSpec> { auto parse(format_parse_context& ctx) -> decltype(ctx.begin()); - auto - format(const ::mamba::specs::MatchSpec& spec, format_context& ctx) const -> decltype(ctx.out()); + auto format(const ::mamba::specs::MatchSpec& spec, format_context& ctx) const + -> decltype(ctx.out()); }; /********************************* diff --git a/libmamba/include/mamba/specs/platform.hpp b/libmamba/include/mamba/specs/platform.hpp index 2af47d8142..3149296a80 100644 --- a/libmamba/include/mamba/specs/platform.hpp +++ b/libmamba/include/mamba/specs/platform.hpp @@ -53,11 +53,11 @@ namespace mamba::specs return static_cast(KnownPlatform::count_); } - [[nodiscard]] constexpr auto - known_platforms() -> std::array; + [[nodiscard]] constexpr auto known_platforms() + -> std::array; - [[nodiscard]] constexpr auto - known_platform_names() -> std::array; + [[nodiscard]] constexpr auto known_platform_names() + -> std::array; /** * Convert the enumeration to its conda string. diff --git a/libmamba/include/mamba/specs/regex_spec.hpp b/libmamba/include/mamba/specs/regex_spec.hpp index 74edbbecc2..57353e44c5 100644 --- a/libmamba/include/mamba/specs/regex_spec.hpp +++ b/libmamba/include/mamba/specs/regex_spec.hpp @@ -71,8 +71,8 @@ struct fmt::formatter { auto parse(format_parse_context& ctx) -> decltype(ctx.begin()); - auto - format(const ::mamba::specs::RegexSpec& spec, format_context& ctx) const -> decltype(ctx.out()); + auto format(const ::mamba::specs::RegexSpec& spec, format_context& ctx) const + -> decltype(ctx.out()); }; template <> diff --git a/libmamba/include/mamba/specs/version_spec.hpp b/libmamba/include/mamba/specs/version_spec.hpp index bb4fccc962..a2798fe379 100644 --- a/libmamba/include/mamba/specs/version_spec.hpp +++ b/libmamba/include/mamba/specs/version_spec.hpp @@ -37,8 +37,8 @@ namespace mamba::specs [[nodiscard]] static auto make_less_equal(Version ver) -> VersionPredicate; [[nodiscard]] static auto make_starts_with(Version ver) -> VersionPredicate; [[nodiscard]] static auto make_not_starts_with(Version ver) -> VersionPredicate; - [[nodiscard]] static auto - make_compatible_with(Version ver, std::size_t level) -> VersionPredicate; + [[nodiscard]] static auto make_compatible_with(Version ver, std::size_t level) + -> VersionPredicate; /** Construct an free interval. */ VersionPredicate() = default; @@ -243,8 +243,8 @@ struct fmt::formatter auto parse(format_parse_context& ctx) -> decltype(ctx.begin()); - auto - format(const ::mamba::specs::VersionSpec& spec, format_context& ctx) const -> decltype(ctx.out()); + auto format(const ::mamba::specs::VersionSpec& spec, format_context& ctx) const + -> decltype(ctx.out()); }; template <> diff --git a/libmamba/include/mamba/util/encoding.hpp b/libmamba/include/mamba/util/encoding.hpp index 6df0355e18..9012aa800a 100644 --- a/libmamba/include/mamba/util/encoding.hpp +++ b/libmamba/include/mamba/util/encoding.hpp @@ -51,14 +51,14 @@ namespace mamba::util /** * Convert two hexadecimal characters to a byte. */ - [[nodiscard]] auto - two_hex_to_byte(char high, char low, EncodingError& error) noexcept -> std::byte; + [[nodiscard]] auto two_hex_to_byte(char high, char low, EncodingError& error) noexcept + -> std::byte; /** * Convert two hexadecimal characters to a byte. */ - [[nodiscard]] auto - two_hex_to_byte(char high, char low) noexcept -> tl::expected; + [[nodiscard]] auto two_hex_to_byte(char high, char low) noexcept + -> tl::expected; /** * Convert hexadecimal characters to a bytes and write it to the given output. @@ -74,8 +74,8 @@ namespace mamba::util * The number of hexadecimal characters must be even and out must be allocated with half the * number of hexadecimal characters. */ - [[nodiscard]] auto - hex_to_bytes_to(std::string_view hex, std::byte* out) noexcept -> tl::expected; + [[nodiscard]] auto hex_to_bytes_to(std::string_view hex, std::byte* out) noexcept + -> tl::expected; /** * Escape reserved URL reserved characters with '%' encoding. @@ -100,13 +100,13 @@ namespace mamba::util /** * Convert a string to base64 encoding. */ - [[nodiscard]] auto - encode_base64(std::string_view input) -> tl::expected; + [[nodiscard]] auto encode_base64(std::string_view input) + -> tl::expected; /** * Convert a string from base64 back to its original representation. */ - [[nodiscard]] auto - decode_base64(std::string_view input) -> tl::expected; + [[nodiscard]] auto decode_base64(std::string_view input) + -> tl::expected; } #endif diff --git a/libmamba/include/mamba/util/environment.hpp b/libmamba/include/mamba/util/environment.hpp index dc54646060..f3fc75bced 100644 --- a/libmamba/include/mamba/util/environment.hpp +++ b/libmamba/include/mamba/util/environment.hpp @@ -108,8 +108,8 @@ namespace mamba::util * Return the full path of a program from its name if found inside the given directories. */ template - [[nodiscard]] auto - which_in(std::string_view exe, Iter search_path_first, Iter search_path_last) -> fs::u8path; + [[nodiscard]] auto which_in(std::string_view exe, Iter search_path_first, Iter search_path_last) + -> fs::u8path; /** * Return the full path of a program from its name if found inside the given directories. @@ -139,8 +139,8 @@ namespace mamba::util { [[nodiscard]] auto which_in_one(const fs::u8path& exe, const fs::u8path& dir) -> fs::u8path; - [[nodiscard]] auto - which_in_split(const fs::u8path& exe, std::string_view paths) -> fs::u8path; + [[nodiscard]] auto which_in_split(const fs::u8path& exe, std::string_view paths) + -> fs::u8path; } template diff --git a/libmamba/include/mamba/util/flat_binary_tree.hpp b/libmamba/include/mamba/util/flat_binary_tree.hpp index 01c3b26813..f488cd6554 100644 --- a/libmamba/include/mamba/util/flat_binary_tree.hpp +++ b/libmamba/include/mamba/util/flat_binary_tree.hpp @@ -87,8 +87,8 @@ namespace mamba::util * The children must have been previously added to the tree and their IDs can be used * to point to them. */ - auto - add_branch(const branch_type& branch, idx_type left_child, idx_type right_child) -> idx_type; + auto add_branch(const branch_type& branch, idx_type left_child, idx_type right_child) + -> idx_type; auto add_branch(branch_type&& branch, idx_type left_child, idx_type right_child) -> idx_type; [[nodiscard]] auto node(idx_type idx) const -> const node_type&; @@ -258,11 +258,9 @@ namespace mamba::util } template - auto flat_binary_tree::add_branch( - const branch_type& branch, - idx_type left_child, - idx_type right_child - ) -> idx_type + auto + flat_binary_tree::add_branch(const branch_type& branch, idx_type left_child, idx_type right_child) + -> idx_type { return add_branch_impl(branch, left_child, right_child); } diff --git a/libmamba/include/mamba/util/flat_bool_expr_tree.hpp b/libmamba/include/mamba/util/flat_bool_expr_tree.hpp index abab3921ae..eea8ca07a4 100644 --- a/libmamba/include/mamba/util/flat_bool_expr_tree.hpp +++ b/libmamba/include/mamba/util/flat_bool_expr_tree.hpp @@ -167,8 +167,8 @@ namespace mamba::util void reserve(size_type size); template - [[nodiscard]] auto - evaluate(UnaryFunc&& var_evaluator = {}, bool empty_val = true) const -> bool; + [[nodiscard]] auto evaluate(UnaryFunc&& var_evaluator = {}, bool empty_val = true) const + -> bool; template void infix_for_each(UnaryFunc&& func) const; diff --git a/libmamba/include/mamba/util/flat_set.hpp b/libmamba/include/mamba/util/flat_set.hpp index 8275a3b3bd..6e897c72b1 100644 --- a/libmamba/include/mamba/util/flat_set.hpp +++ b/libmamba/include/mamba/util/flat_set.hpp @@ -127,14 +127,14 @@ namespace mamba::util friend auto operator==(const flat_set& lhs, const flat_set& rhs) -> bool; template - friend auto - set_union(const flat_set&, const flat_set&) -> flat_set; + friend auto set_union(const flat_set&, const flat_set&) + -> flat_set; template - friend auto - set_intersection(const flat_set&, const flat_set&) -> flat_set; + friend auto set_intersection(const flat_set&, const flat_set&) + -> flat_set; template - friend auto - set_difference(const flat_set&, const flat_set&) -> flat_set; + friend auto set_difference(const flat_set&, const flat_set&) + -> flat_set; template friend auto set_symmetric_difference(const flat_set&, const flat_set&) -> flat_set; @@ -160,16 +160,14 @@ namespace mamba::util -> flat_set; template - auto operator==( - const flat_set& lhs, - const flat_set& rhs - ) -> bool; + auto + operator==(const flat_set& lhs, const flat_set& rhs) + -> bool; template - auto operator!=( - const flat_set& lhs, - const flat_set& rhs - ) -> bool; + auto + operator!=(const flat_set& lhs, const flat_set& rhs) + -> bool; template auto set_is_disjoint_of( @@ -430,7 +428,8 @@ namespace mamba::util */ template auto - set_disjoint(InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, Compare comp) -> bool + set_disjoint(InputIt1 first1, InputIt1 last1, InputIt2 first2, InputIt2 last2, Compare comp) + -> bool { while (first1 != last1 && first2 != last2) { @@ -512,8 +511,8 @@ namespace mamba::util } template - auto - set_intersection(const flat_set& lhs, const flat_set& rhs) -> flat_set + auto set_intersection(const flat_set& lhs, const flat_set& rhs) + -> flat_set { auto out = flat_set(); std::set_intersection( @@ -528,8 +527,8 @@ namespace mamba::util } template - auto - set_difference(const flat_set& lhs, const flat_set& rhs) -> flat_set + auto set_difference(const flat_set& lhs, const flat_set& rhs) + -> flat_set { auto out = flat_set(); std::set_difference( diff --git a/libmamba/include/mamba/util/graph.hpp b/libmamba/include/mamba/util/graph.hpp index 5ab2168868..d608abb03d 100644 --- a/libmamba/include/mamba/util/graph.hpp +++ b/libmamba/include/mamba/util/graph.hpp @@ -705,7 +705,8 @@ namespace mamba::util template auto - is_reachable(const Graph& graph, typename Graph::node_id source, typename Graph::node_id target) -> bool + is_reachable(const Graph& graph, typename Graph::node_id source, typename Graph::node_id target) + -> bool { struct : EmptyVisitor { diff --git a/libmamba/include/mamba/util/os_unix.hpp b/libmamba/include/mamba/util/os_unix.hpp index 2398035688..89729cae6a 100644 --- a/libmamba/include/mamba/util/os_unix.hpp +++ b/libmamba/include/mamba/util/os_unix.hpp @@ -16,7 +16,7 @@ namespace mamba::util { - [[nodiscard]] auto - unix_name_version() -> tl::expected, OSError>; + [[nodiscard]] auto unix_name_version() + -> tl::expected, OSError>; } #endif diff --git a/libmamba/include/mamba/util/parsers.hpp b/libmamba/include/mamba/util/parsers.hpp index 0654f087f8..11b93f6500 100644 --- a/libmamba/include/mamba/util/parsers.hpp +++ b/libmamba/include/mamba/util/parsers.hpp @@ -249,8 +249,8 @@ namespace mamba::util /** * Test whether the glob pattern @p pattern matches the string @p str. */ - [[nodiscard]] auto - glob_match(std::string_view pattern, std::string_view str, char glob = '*') -> bool; + [[nodiscard]] auto glob_match(std::string_view pattern, std::string_view str, char glob = '*') + -> bool; /******************** * Implementation * diff --git a/libmamba/include/mamba/util/path_manip.hpp b/libmamba/include/mamba/util/path_manip.hpp index 2c04d6c75b..3e0db5e985 100644 --- a/libmamba/include/mamba/util/path_manip.hpp +++ b/libmamba/include/mamba/util/path_manip.hpp @@ -80,8 +80,8 @@ namespace mamba::util /** * Concatenate paths with the given separator. */ - [[nodiscard]] auto - path_concat(std::string_view parent, std::string_view child, char sep) -> std::string; + [[nodiscard]] auto path_concat(std::string_view parent, std::string_view child, char sep) + -> std::string; /** * Concatenate paths with '/' on Unix and detected separator on Windows. @@ -91,8 +91,8 @@ namespace mamba::util /** * Expand a leading '~' with the given home directory, assuming the given separator. */ - [[nodiscard]] auto - expand_home(std::string_view path, std::string_view home, char sep) -> std::string; + [[nodiscard]] auto expand_home(std::string_view path, std::string_view home, char sep) + -> std::string; /** * Expand a leading '~' with the given home directory. @@ -109,8 +109,8 @@ namespace mamba::util * * This assumes the given separator is used separate paths. */ - [[nodiscard]] auto - shrink_home(std::string_view path, std::string_view home, char sep) -> std::string; + [[nodiscard]] auto shrink_home(std::string_view path, std::string_view home, char sep) + -> std::string; /** * If the path starts with the given home directory, replace it with a leading '~'. diff --git a/libmamba/include/mamba/util/random.hpp b/libmamba/include/mamba/util/random.hpp index a8d17351d4..327b286494 100644 --- a/libmamba/include/mamba/util/random.hpp +++ b/libmamba/include/mamba/util/random.hpp @@ -61,8 +61,8 @@ namespace mamba::util return rng; } - extern template auto - local_random_generator() -> default_random_generator&; + extern template auto local_random_generator() + -> default_random_generator&; template auto random_int(T min, T max, Generator& generator) -> T diff --git a/libmamba/include/mamba/util/string.hpp b/libmamba/include/mamba/util/string.hpp index 4d8a1bb4a0..17e94cc992 100644 --- a/libmamba/include/mamba/util/string.hpp +++ b/libmamba/include/mamba/util/string.hpp @@ -103,32 +103,32 @@ namespace mamba::util /** * Return a view to the input without the prefix if present. */ - [[nodiscard]] auto - remove_prefix(std::string_view str, std::string_view prefix) -> std::string_view; - [[nodiscard]] auto - remove_prefix(std::string_view str, std::string_view::value_type c) -> std::string_view; + [[nodiscard]] auto remove_prefix(std::string_view str, std::string_view prefix) + -> std::string_view; + [[nodiscard]] auto remove_prefix(std::string_view str, std::string_view::value_type c) + -> std::string_view; /** * Return a view to prefix if present, and a view to the rest of the input. */ - [[nodiscard]] auto - split_prefix(std::string_view str, std::string_view prefix) -> std::array; + [[nodiscard]] auto split_prefix(std::string_view str, std::string_view prefix) + -> std::array; [[nodiscard]] auto split_prefix(std::string_view str, std::string_view::value_type c) -> std::array; /** * Return a view to the input without the suffix if present. */ - [[nodiscard]] auto - remove_suffix(std::string_view str, std::string_view suffix) -> std::string_view; - [[nodiscard]] auto - remove_suffix(std::string_view str, std::string_view::value_type c) -> std::string_view; + [[nodiscard]] auto remove_suffix(std::string_view str, std::string_view suffix) + -> std::string_view; + [[nodiscard]] auto remove_suffix(std::string_view str, std::string_view::value_type c) + -> std::string_view; /** * Return a view to the head of the input, and a view to suffix if present. */ - [[nodiscard]] auto - split_suffix(std::string_view str, std::string_view suffix) -> std::array; + [[nodiscard]] auto split_suffix(std::string_view str, std::string_view suffix) + -> std::array; [[nodiscard]] auto split_suffix(std::string_view str, std::string_view::value_type c) -> std::array; @@ -139,24 +139,24 @@ namespace mamba::util [[nodiscard]] auto lstrip(std::string_view input) -> std::string_view; [[nodiscard]] auto lstrip(std::wstring_view input) -> std::wstring_view; - [[nodiscard]] auto - lstrip_parts(std::string_view input, char c) -> std::array; - [[nodiscard]] auto - lstrip_parts(std::wstring_view input, wchar_t c) -> std::array; - [[nodiscard]] auto - lstrip_parts(std::string_view input, std::string_view chars) -> std::array; - [[nodiscard]] auto - lstrip_parts(std::wstring_view input, std::wstring_view chars) -> std::array; + [[nodiscard]] auto lstrip_parts(std::string_view input, char c) + -> std::array; + [[nodiscard]] auto lstrip_parts(std::wstring_view input, wchar_t c) + -> std::array; + [[nodiscard]] auto lstrip_parts(std::string_view input, std::string_view chars) + -> std::array; + [[nodiscard]] auto lstrip_parts(std::wstring_view input, std::wstring_view chars) + -> std::array; template [[nodiscard]] auto lstrip_if(std::string_view input, UnaryFunc should_strip) -> std::string_view; template - [[nodiscard]] auto - lstrip_if(std::wstring_view input, UnaryFunc should_strip) -> std::wstring_view; + [[nodiscard]] auto lstrip_if(std::wstring_view input, UnaryFunc should_strip) + -> std::wstring_view; template - [[nodiscard]] auto - lstrip_if_parts(std::string_view input, UnaryFunc should_strip) -> std::array; + [[nodiscard]] auto lstrip_if_parts(std::string_view input, UnaryFunc should_strip) + -> std::array; template [[nodiscard]] auto lstrip_if_parts(std::wstring_view input, UnaryFunc should_strip) -> std::array; @@ -168,24 +168,24 @@ namespace mamba::util [[nodiscard]] auto rstrip(std::string_view input) -> std::string_view; [[nodiscard]] auto rstrip(std::wstring_view input) -> std::wstring_view; - [[nodiscard]] auto - rstrip_parts(std::string_view input, char c) -> std::array; - [[nodiscard]] auto - rstrip_parts(std::wstring_view input, wchar_t c) -> std::array; - [[nodiscard]] auto - rstrip_parts(std::string_view input, std::string_view chars) -> std::array; - [[nodiscard]] auto - rstrip_parts(std::wstring_view input, std::wstring_view chars) -> std::array; + [[nodiscard]] auto rstrip_parts(std::string_view input, char c) + -> std::array; + [[nodiscard]] auto rstrip_parts(std::wstring_view input, wchar_t c) + -> std::array; + [[nodiscard]] auto rstrip_parts(std::string_view input, std::string_view chars) + -> std::array; + [[nodiscard]] auto rstrip_parts(std::wstring_view input, std::wstring_view chars) + -> std::array; template [[nodiscard]] auto rstrip_if(std::string_view input, UnaryFunc should_strip) -> std::string_view; template - [[nodiscard]] auto - rstrip_if(std::wstring_view input, UnaryFunc should_strip) -> std::wstring_view; + [[nodiscard]] auto rstrip_if(std::wstring_view input, UnaryFunc should_strip) + -> std::wstring_view; template - [[nodiscard]] auto - rstrip_if_parts(std::string_view input, UnaryFunc should_strip) -> std::array; + [[nodiscard]] auto rstrip_if_parts(std::string_view input, UnaryFunc should_strip) + -> std::array; template [[nodiscard]] auto rstrip_if_parts(std::wstring_view input, UnaryFunc should_strip) -> std::array; @@ -198,24 +198,25 @@ namespace mamba::util [[nodiscard]] auto strip(std::wstring_view input) -> std::wstring_view; [[nodiscard]] auto strip_parts(std::string_view input, char c) -> std::array; - [[nodiscard]] auto - strip_parts(std::wstring_view input, wchar_t c) -> std::array; - [[nodiscard]] auto - strip_parts(std::string_view input, std::string_view chars) -> std::array; - [[nodiscard]] auto - strip_parts(std::wstring_view input, std::wstring_view chars) -> std::array; + [[nodiscard]] auto strip_parts(std::wstring_view input, wchar_t c) + -> std::array; + [[nodiscard]] auto strip_parts(std::string_view input, std::string_view chars) + -> std::array; + [[nodiscard]] auto strip_parts(std::wstring_view input, std::wstring_view chars) + -> std::array; template [[nodiscard]] auto strip_if(std::string_view input, UnaryFunc should_strip) -> std::string_view; template - [[nodiscard]] auto strip_if(std::wstring_view input, UnaryFunc should_strip) -> std::wstring_view; + [[nodiscard]] auto strip_if(std::wstring_view input, UnaryFunc should_strip) + -> std::wstring_view; template - [[nodiscard]] auto - strip_if_parts(std::string_view input, UnaryFunc should_strip) -> std::array; + [[nodiscard]] auto strip_if_parts(std::string_view input, UnaryFunc should_strip) + -> std::array; template - [[nodiscard]] auto - strip_if_parts(std::wstring_view input, UnaryFunc should_strip) -> std::array; + [[nodiscard]] auto strip_if_parts(std::wstring_view input, UnaryFunc should_strip) + -> std::array; [[nodiscard]] auto split_once(std::string_view str, char sep) -> std::tuple>; @@ -269,10 +270,11 @@ namespace mamba::util * would return "private/channel/label/foo", but "private/chan" and "channel/label/foo" * would return the "private/chan/channel/label/foo". */ + [[nodiscard]] auto concat_dedup_splits(std::string_view str1, std::string_view str2, char sep) + -> std::string; [[nodiscard]] auto - concat_dedup_splits(std::string_view str1, std::string_view str2, char sep) -> std::string; - [[nodiscard]] auto - concat_dedup_splits(std::string_view str1, std::string_view str2, std::string_view sep) -> std::string; + concat_dedup_splits(std::string_view str1, std::string_view str2, std::string_view sep) + -> std::string; void replace_all(std::string& data, std::string_view search, std::string_view replace); void replace_all(std::wstring& data, std::wstring_view search, std::wstring_view replace); @@ -294,8 +296,8 @@ namespace mamba::util * separator in between the elements (thus appearing ``n-1`` times). */ template - auto - join_for_each(InputIt first, InputIt last, UnaryFunction func, const Value& sep) -> UnaryFunction; + auto join_for_each(InputIt first, InputIt last, UnaryFunction func, const Value& sep) + -> UnaryFunction; /** * Concatenate the elements of the container @p container by interleaving a separator. @@ -460,15 +462,15 @@ namespace mamba::util } template - auto - lstrip_if_parts(std::string_view input, UnaryFunc should_strip) -> std::array + auto lstrip_if_parts(std::string_view input, UnaryFunc should_strip) + -> std::array { return detail::lstrip_if_parts_impl(input, std::move(should_strip)); } template - auto - lstrip_if_parts(std::wstring_view input, UnaryFunc should_strip) -> std::array + auto lstrip_if_parts(std::wstring_view input, UnaryFunc should_strip) + -> std::array { return detail::lstrip_if_parts_impl(input, std::move(should_strip)); } @@ -502,15 +504,15 @@ namespace mamba::util } template - auto - rstrip_if_parts(std::string_view input, UnaryFunc should_strip) -> std::array + auto rstrip_if_parts(std::string_view input, UnaryFunc should_strip) + -> std::array { return detail::rstrip_if_parts_impl(input, std::move(should_strip)); } template - auto - rstrip_if_parts(std::wstring_view input, UnaryFunc should_strip) -> std::array + auto rstrip_if_parts(std::wstring_view input, UnaryFunc should_strip) + -> std::array { return detail::rstrip_if_parts_impl(input, std::move(should_strip)); } @@ -540,15 +542,15 @@ namespace mamba::util } template - auto - strip_if_parts(std::string_view input, UnaryFunc should_strip) -> std::array + auto strip_if_parts(std::string_view input, UnaryFunc should_strip) + -> std::array { return detail::strip_if_parts_impl(input, std::move(should_strip)); } template - auto - strip_if_parts(std::wstring_view input, UnaryFunc should_strip) -> std::array + auto strip_if_parts(std::wstring_view input, UnaryFunc should_strip) + -> std::array { return detail::strip_if_parts_impl(input, std::move(should_strip)); } @@ -607,8 +609,8 @@ namespace mamba::util // TODO(C++20) Use ``std::ranges::join_view`` (or ``std::ranges::join``) template - auto - join_for_each(InputIt first, InputIt last, UnaryFunction func, const Value& sep) -> UnaryFunction + auto join_for_each(InputIt first, InputIt last, UnaryFunction func, const Value& sep) + -> UnaryFunction { if (first < last) { diff --git a/libmamba/include/mamba/util/tuple_hash.hpp b/libmamba/include/mamba/util/tuple_hash.hpp index ef50bb8a82..872d9f23d1 100644 --- a/libmamba/include/mamba/util/tuple_hash.hpp +++ b/libmamba/include/mamba/util/tuple_hash.hpp @@ -21,8 +21,8 @@ namespace mamba::util } template > - constexpr auto - hash_combine_val(std::size_t seed, const T& val, const Hasher& hasher = {}) -> std::size_t + constexpr auto hash_combine_val(std::size_t seed, const T& val, const Hasher& hasher = {}) + -> std::size_t { return hash_combine(seed, hasher(val)); } diff --git a/libmamba/include/mamba/util/url.hpp b/libmamba/include/mamba/util/url.hpp index 0f1300c7e7..074f256a52 100644 --- a/libmamba/include/mamba/util/url.hpp +++ b/libmamba/include/mamba/util/url.hpp @@ -260,15 +260,15 @@ namespace mamba::util protected: - [[nodiscard]] auto - authentication_elems(Credentials, Decode::no_type) const -> std::array; - [[nodiscard]] auto - authentication_elems(Credentials, Decode::yes_type) const -> std::array; - - [[nodiscard]] auto - authority_elems(Credentials, Decode::no_type) const -> std::array; - [[nodiscard]] auto - authority_elems(Credentials, Decode::yes_type) const -> std::array; + [[nodiscard]] auto authentication_elems(Credentials, Decode::no_type) const + -> std::array; + [[nodiscard]] auto authentication_elems(Credentials, Decode::yes_type) const + -> std::array; + + [[nodiscard]] auto authority_elems(Credentials, Decode::no_type) const + -> std::array; + [[nodiscard]] auto authority_elems(Credentials, Decode::yes_type) const + -> std::array; [[nodiscard]] auto pretty_str_path(StripScheme strip_scheme = StripScheme::no, char rstrip_path = 0) const diff --git a/libmamba/include/mamba/validation/tools.hpp b/libmamba/include/mamba/validation/tools.hpp index dcf645df6c..51b2738bd4 100644 --- a/libmamba/include/mamba/validation/tools.hpp +++ b/libmamba/include/mamba/validation/tools.hpp @@ -35,8 +35,8 @@ namespace mamba::validation auto generate_ed25519_keypair(std::byte* pk, std::byte* sk) -> int; auto generate_ed25519_keypair() -> std::pair< - std::array, - std::array>; + std::array, + std::array>; auto generate_ed25519_keypair_hex() -> std::pair; auto sign(const std::string& data, const std::byte* sk, std::byte* signature) -> int; @@ -52,8 +52,8 @@ namespace mamba::validation verify(const std::byte* data, std::size_t data_len, const std::byte* pk, const std::byte* signature) -> int; auto verify(const std::string& data, const std::byte* pk, const std::byte* signature) -> int; - auto - verify(const std::string& data, const std::string& pk_hex, const std::string& signature_hex) -> int; + auto verify(const std::string& data, const std::string& pk_hex, const std::string& signature_hex) + -> int; /** * Verify a GPG/PGP signature against the hash of the binary data and @@ -61,8 +61,8 @@ namespace mamba::validation * See RFC4880, section 5.2.4 https://datatracker.ietf.org/doc/html/rfc4880#section-5.2.4 * This method assumes hash function to be SHA-256 */ - auto - verify_gpg_hashed_msg(const std::byte* data, const std::byte* pk, const std::byte* signature) -> int; + auto verify_gpg_hashed_msg(const std::byte* data, const std::byte* pk, const std::byte* signature) + -> int; auto verify_gpg_hashed_msg(const std::string& data, const std::byte* pk, const std::byte* signature) -> int; diff --git a/libmamba/include/mamba/validation/update_framework.hpp b/libmamba/include/mamba/validation/update_framework.hpp index 712983e1fb..2e163c7035 100644 --- a/libmamba/include/mamba/validation/update_framework.hpp +++ b/libmamba/include/mamba/validation/update_framework.hpp @@ -59,8 +59,9 @@ namespace mamba::validation [[nodiscard]] virtual auto json_key() const -> std::string = 0; [[nodiscard]] virtual auto expiration_json_key() const -> std::string = 0; - [[nodiscard]] virtual auto - signatures(const nlohmann::json& j) const -> std::set = 0; + [[nodiscard]] virtual auto signatures(const nlohmann::json& j) const + -> std::set + = 0; protected: @@ -103,8 +104,8 @@ namespace mamba::validation protected: - [[nodiscard]] auto - read_json_file(const fs::u8path& p, bool update = false) const -> nlohmann::json; + [[nodiscard]] auto read_json_file(const fs::u8path& p, bool update = false) const + -> nlohmann::json; /** * Check that a threshold of valid signatures is met @@ -178,7 +179,8 @@ namespace mamba::validation const TimeRef& time_reference, const std::string& url, const fs::u8path& cache_path - ) const -> std::unique_ptr = 0; + ) const -> std::unique_ptr + = 0; protected: diff --git a/libmamba/include/mamba/validation/update_framework_v0_6.hpp b/libmamba/include/mamba/validation/update_framework_v0_6.hpp index d338ef4a81..3dd6ba35ce 100644 --- a/libmamba/include/mamba/validation/update_framework_v0_6.hpp +++ b/libmamba/include/mamba/validation/update_framework_v0_6.hpp @@ -32,8 +32,8 @@ namespace mamba::validation::v0_6 [[nodiscard]] auto json_key() const -> std::string override; [[nodiscard]] auto expiration_json_key() const -> std::string override; - [[nodiscard]] auto - signatures(const nlohmann::json& j) const -> std::set override; + [[nodiscard]] auto signatures(const nlohmann::json& j) const + -> std::set override; [[nodiscard]] auto canonicalize(const nlohmann::json& j) const -> std::string override; [[nodiscard]] auto upgradable() const -> bool override; diff --git a/libmamba/include/mamba/validation/update_framework_v1.hpp b/libmamba/include/mamba/validation/update_framework_v1.hpp index 482b270af4..9646fdb5c1 100644 --- a/libmamba/include/mamba/validation/update_framework_v1.hpp +++ b/libmamba/include/mamba/validation/update_framework_v1.hpp @@ -34,8 +34,8 @@ namespace mamba::validation::v1 [[nodiscard]] auto json_key() const -> std::string override; [[nodiscard]] auto expiration_json_key() const -> std::string override; - [[nodiscard]] auto - signatures(const nlohmann::json& j) const -> std::set override; + [[nodiscard]] auto signatures(const nlohmann::json& j) const + -> std::set override; }; /** diff --git a/libmamba/src/api/configuration.cpp b/libmamba/src/api/configuration.cpp index d065e396e9..946992aaf6 100644 --- a/libmamba/src/api/configuration.cpp +++ b/libmamba/src/api/configuration.cpp @@ -629,8 +629,8 @@ namespace mamba } } - auto - get_root_prefix_from_mamba_bin(const fs::u8path& mamba_bin_path) -> expected_t + auto get_root_prefix_from_mamba_bin(const fs::u8path& mamba_bin_path) + -> expected_t { if (mamba_bin_path.empty()) { @@ -1555,7 +1555,8 @@ namespace mamba previous versions of conda, this parameter was configured as either True or False. True is now an alias to 'flexible'.)")) .set_post_merge_hook( - [&](ChannelPriority& value) { + [&](ChannelPriority& value) + { m_context.solver_flags.strict_repo_priority = (value == ChannelPriority::Strict); } )); diff --git a/libmamba/src/api/shell.cpp b/libmamba/src/api/shell.cpp index 6a4d9bcb52..92cf298f39 100644 --- a/libmamba/src/api/shell.cpp +++ b/libmamba/src/api/shell.cpp @@ -23,8 +23,8 @@ namespace mamba { namespace { - auto - make_activator(const Context& context, std::string_view name) -> std::unique_ptr + auto make_activator(const Context& context, std::string_view name) + -> std::unique_ptr { if (name == "bash" || name == "zsh" || name == "dash" || name == "posix") { diff --git a/libmamba/src/core/channel_context.cpp b/libmamba/src/core/channel_context.cpp index aff570f39c..3432be270e 100644 --- a/libmamba/src/core/channel_context.cpp +++ b/libmamba/src/core/channel_context.cpp @@ -27,8 +27,8 @@ namespace mamba namespace { - auto create_platforms(const std::vector& platforms - ) -> specs::ChannelResolveParams::platform_list + auto create_platforms(const std::vector& platforms) + -> specs::ChannelResolveParams::platform_list { return { platforms.cbegin(), platforms.cend() }; } @@ -193,7 +193,8 @@ namespace mamba { auto channels = specs::UnresolvedChannel::parse(loc) .and_then( // - [&](specs::UnresolvedChannel&& uc) { + [&](specs::UnresolvedChannel&& uc) + { return specs::Channel::resolve(std::move(uc), params); } ) diff --git a/libmamba/src/core/package_fetcher.cpp b/libmamba/src/core/package_fetcher.cpp index cd62744f4c..c960f73178 100644 --- a/libmamba/src/core/package_fetcher.cpp +++ b/libmamba/src/core/package_fetcher.cpp @@ -178,8 +178,8 @@ namespace mamba return request; } - auto - PackageFetcher::validate(std::size_t downloaded_size, progress_callback_t* cb) const -> ValidationResult + auto PackageFetcher::validate(std::size_t downloaded_size, progress_callback_t* cb) const + -> ValidationResult { update_monitor(cb, PackageExtractEvent::validate_update); ValidationResult res = validate_size(downloaded_size); diff --git a/libmamba/src/core/package_handling.cpp b/libmamba/src/core/package_handling.cpp index 320d916366..f0c4ce36ba 100644 --- a/libmamba/src/core/package_handling.cpp +++ b/libmamba/src/core/package_handling.cpp @@ -73,7 +73,7 @@ namespace mamba public: scoped_archive_read() - : scoped_archive_read(archive_read_new()){}; + : scoped_archive_read(archive_read_new()) {}; static scoped_archive_read read_disk() { @@ -450,7 +450,8 @@ namespace mamba zstd, compression_level, compression_threads, - [](const fs::u8path& p) -> bool { + [](const fs::u8path& p) -> bool + { return p.std_path().begin() != p.std_path().end() && *p.std_path().begin() != "info"; } @@ -461,7 +462,8 @@ namespace mamba zstd, compression_level, compression_threads, - [](const fs::u8path& p) -> bool { + [](const fs::u8path& p) -> bool + { return p.std_path().begin() != p.std_path().end() && *p.std_path().begin() == "info"; } diff --git a/libmamba/src/core/subdirdata.cpp b/libmamba/src/core/subdirdata.cpp index 54ae7908b4..67d71211a4 100644 --- a/libmamba/src/core/subdirdata.cpp +++ b/libmamba/src/core/subdirdata.cpp @@ -285,7 +285,8 @@ namespace mamba return m; } - auto SubdirMetadata::from_repodata_file(const fs::u8path& repodata_file) -> expected_subdir_metadata + auto SubdirMetadata::from_repodata_file(const fs::u8path& repodata_file) + -> expected_subdir_metadata { const std::string json = [](const fs::u8path& file) -> std::string { diff --git a/libmamba/src/core/transaction.cpp b/libmamba/src/core/transaction.cpp index e0f22dce41..7d2f766896 100644 --- a/libmamba/src/core/transaction.cpp +++ b/libmamba/src/core/transaction.cpp @@ -84,8 +84,8 @@ namespace mamba return out; } - auto - installed_python(const solver::libsolv::Database& db) -> std::optional + auto installed_python(const solver::libsolv::Database& db) + -> std::optional { // TODO combine Repo and MatchSpec search API in Pool auto out = std::optional(); diff --git a/libmamba/src/core/virtual_packages.cpp b/libmamba/src/core/virtual_packages.cpp index f95c89cd8c..c457a57b95 100644 --- a/libmamba/src/core/virtual_packages.cpp +++ b/libmamba/src/core/virtual_packages.cpp @@ -262,7 +262,8 @@ namespace mamba { overridable_windows_version() .transform( - [&](std::string&& version) { + [&](std::string&& version) + { res.push_back(make_virtual_package("__win", platform, std::move(version))); } ) @@ -284,7 +285,8 @@ namespace mamba overridable_linux_version() .transform( - [&](std::string&& version) { + [&](std::string&& version) + { res.push_back( make_virtual_package("__linux", platform, std::move(version)) ); @@ -318,7 +320,8 @@ namespace mamba overridable_osx_version() .transform( - [&](std::string&& version) { + [&](std::string&& version) + { res.push_back(make_virtual_package("__osx", platform, std::move(version))); } ) diff --git a/libmamba/src/download/downloader.cpp b/libmamba/src/download/downloader.cpp index 2273bfdd48..d220301d3f 100644 --- a/libmamba/src/download/downloader.cpp +++ b/libmamba/src/download/downloader.cpp @@ -962,7 +962,8 @@ namespace mamba::download { new_mirror = find_mirror( m_mirror_set, - [iteration](const auto& mirror) { + [iteration](const auto& mirror) + { return iteration > mirror->failed_transfers() && mirror->can_accept_more_connections(); } @@ -1016,7 +1017,8 @@ namespace mamba::download m_requests.begin(), m_requests.end(), std::back_inserter(m_trackers), - [tracker_options, this](const Request& req) { + [tracker_options, this](const Request& req) + { return DownloadTracker(req, p_mirrors->get_mirrors(req.mirror_name), tracker_options); } ); diff --git a/libmamba/src/download/downloader_impl.hpp b/libmamba/src/download/downloader_impl.hpp index d9ab58f069..5f691c4856 100644 --- a/libmamba/src/download/downloader_impl.hpp +++ b/libmamba/src/download/downloader_impl.hpp @@ -193,8 +193,8 @@ namespace mamba::download DownloadTrackerOptions options ); - auto - prepare_new_attempt(CURLMultiHandle& handle, const Context& context) -> completion_map_entry; + auto prepare_new_attempt(CURLMultiHandle& handle, const Context& context) + -> completion_map_entry; bool has_failed() const; bool can_start_transfer() const; diff --git a/libmamba/src/download/mirror_impl.cpp b/libmamba/src/download/mirror_impl.cpp index 430e775530..39fcb82782 100644 --- a/libmamba/src/download/mirror_impl.cpp +++ b/libmamba/src/download/mirror_impl.cpp @@ -153,10 +153,9 @@ namespace mamba::download return MirrorID(std::move(url)); } - auto OCIMirror::get_request_generators_impl( - const std::string& url_path, - const std::string& spec_sha256 - ) const -> request_generator_list + auto + OCIMirror::get_request_generators_impl(const std::string& url_path, const std::string& spec_sha256) const + -> request_generator_list { // NB: This method can be executed by many threads in parallel. Therefore, // data should not be captured in lambda used for building the request, as diff --git a/libmamba/src/solver/helpers.cpp b/libmamba/src/solver/helpers.cpp index a42cf9c905..9a2d826cf2 100644 --- a/libmamba/src/solver/helpers.cpp +++ b/libmamba/src/solver/helpers.cpp @@ -8,8 +8,8 @@ namespace mamba::solver { - auto find_new_python_in_solution(const Solution& solution - ) -> std::optional> + auto find_new_python_in_solution(const Solution& solution) + -> std::optional> { auto out = std::optional>{}; for_each_to_install( diff --git a/libmamba/src/solver/helpers.hpp b/libmamba/src/solver/helpers.hpp index 4a807be3d4..f6979f40d4 100644 --- a/libmamba/src/solver/helpers.hpp +++ b/libmamba/src/solver/helpers.hpp @@ -19,8 +19,8 @@ namespace mamba::solver { - [[nodiscard]] auto find_new_python_in_solution(const Solution& solution - ) -> std::optional>; + [[nodiscard]] auto find_new_python_in_solution(const Solution& solution) + -> std::optional>; [[nodiscard]] auto python_binary_compatible( // const specs::Version& older, diff --git a/libmamba/src/solver/libsolv/helpers.cpp b/libmamba/src/solver/libsolv/helpers.cpp index 59bfca15ab..cd4e9c2a3d 100644 --- a/libmamba/src/solver/libsolv/helpers.cpp +++ b/libmamba/src/solver/libsolv/helpers.cpp @@ -91,8 +91,8 @@ namespace mamba::solver::libsolv solv.add_self_provide(); } - auto - make_package_info(const solv::ObjPool& pool, solv::ObjSolvableViewConst s) -> specs::PackageInfo + auto make_package_info(const solv::ObjPool& pool, solv::ObjSolvableViewConst s) + -> specs::PackageInfo { specs::PackageInfo out = {}; @@ -814,11 +814,9 @@ namespace mamba::solver::libsolv repo.set_pip_added(true); } - auto make_abused_namespace_dep_args( - solv::ObjPool& pool, - std::string_view dependency, - const MatchFlags& flags - ) -> std::pair + auto + make_abused_namespace_dep_args(solv::ObjPool& pool, std::string_view dependency, const MatchFlags& flags) + -> std::pair { return { pool.add_string(dependency), @@ -1083,8 +1081,8 @@ namespace mamba::solver::libsolv } } - auto - transaction_to_solution_all(const solv::ObjPool& pool, const solv::ObjTransaction& trans) -> Solution + auto transaction_to_solution_all(const solv::ObjPool& pool, const solv::ObjTransaction& trans) + -> Solution { return transaction_to_solution_impl(pool, trans, [](const auto&) { return true; }); } @@ -1194,7 +1192,8 @@ namespace mamba::solver::libsolv namespace { - auto action_refers_to(const Solution::Action& unknown_action, std::string_view pkg_name) -> bool + auto action_refers_to(const Solution::Action& unknown_action, std::string_view pkg_name) + -> bool { return std::visit( [&](const auto& action) @@ -1369,7 +1368,8 @@ namespace mamba::solver::libsolv { return pool_add_matchspec(pool, job.spec) .transform( - [&](auto id) { + [&](auto id) + { raw_jobs.push_back( SOLVER_ERASE | (job.clean_dependencies ? SOLVER_CLEANDEPS : 0), id diff --git a/libmamba/src/solver/libsolv/helpers.hpp b/libmamba/src/solver/libsolv/helpers.hpp index b7a411b5ea..f7c30118c6 100644 --- a/libmamba/src/solver/libsolv/helpers.hpp +++ b/libmamba/src/solver/libsolv/helpers.hpp @@ -38,8 +38,8 @@ namespace mamba::solver::libsolv { void set_solvable(solv::ObjPool& pool, solv::ObjSolvableView solv, const specs::PackageInfo& pkg); - auto - make_package_info(const solv::ObjPool& pool, solv::ObjSolvableViewConst s) -> specs::PackageInfo; + auto make_package_info(const solv::ObjPool& pool, solv::ObjSolvableViewConst s) + -> specs::PackageInfo; [[nodiscard]] auto libsolv_read_json( // solv::ObjRepoView repo, @@ -135,8 +135,8 @@ namespace mamba::solver::libsolv const Request::Flags& flags ) -> Solution; - [[nodiscard]] auto - installed_python(const solv::ObjPool& pool) -> std::optional; + [[nodiscard]] auto installed_python(const solv::ObjPool& pool) + -> std::optional; [[nodiscard]] auto solution_needs_python_relink( // const solv::ObjPool& pool, diff --git a/libmamba/src/solver/libsolv/matcher.cpp b/libmamba/src/solver/libsolv/matcher.cpp index 71efbd3cec..354bde52ca 100644 --- a/libmamba/src/solver/libsolv/matcher.cpp +++ b/libmamba/src/solver/libsolv/matcher.cpp @@ -182,8 +182,8 @@ namespace mamba::solver::libsolv .value(); } - auto - Matcher::get_channels(const specs::UnresolvedChannel& uc) -> expected_t + auto Matcher::get_channels(const specs::UnresolvedChannel& uc) + -> expected_t { // Channel maps require converting channel to string because unresolved channels are // awkward to compare. diff --git a/libmamba/src/solver/libsolv/unsolvable.cpp b/libmamba/src/solver/libsolv/unsolvable.cpp index cbbdcbbea7..2187e95f37 100644 --- a/libmamba/src/solver/libsolv/unsolvable.cpp +++ b/libmamba/src/solver/libsolv/unsolvable.cpp @@ -563,8 +563,8 @@ namespace mamba::solver::libsolv return out; } - auto - UnSolvable::explain_problems(Database& pool, const ProblemsMessageFormat& format) const -> std::string + auto UnSolvable::explain_problems(Database& pool, const ProblemsMessageFormat& format) const + -> std::string { std::stringstream ss; diff --git a/libmamba/src/solver/problems_graph.cpp b/libmamba/src/solver/problems_graph.cpp index 6e1c40f092..25cf5ca7f2 100644 --- a/libmamba/src/solver/problems_graph.cpp +++ b/libmamba/src/solver/problems_graph.cpp @@ -213,10 +213,9 @@ namespace mamba::solver * @return For each node type, a partition of the the indices in @p of that type.. */ template - auto merge_node_indices( - const node_type_list& nodes_by_type, - CompFunc&& merge_criteria - ) -> node_type_list> + auto + merge_node_indices(const node_type_list& nodes_by_type, CompFunc&& merge_criteria) + -> node_type_list> { auto merge_func = [&merge_criteria](const auto& node_indices_of_one_node_type) { @@ -532,10 +531,9 @@ namespace mamba::solver * If two groups contain a node that are respectively in conflicts, then they are in * conflicts. */ - auto merge_conflicts( - const ProblemsGraph::conflicts_t& old_conflicts, - const node_id_mapping& old_to_new - ) -> CompressedProblemsGraph::conflicts_t + auto + merge_conflicts(const ProblemsGraph::conflicts_t& old_conflicts, const node_id_mapping& old_to_new) + -> CompressedProblemsGraph::conflicts_t { auto new_conflicts = CompressedProblemsGraph::conflicts_t(); for (const auto& [old_from, old_with] : old_conflicts) @@ -1254,8 +1252,8 @@ namespace mamba::solver template auto concat_nodes_impl(const std::vector& ids) -> Node; auto concat_nodes(const std::vector& ids) -> node_t; - auto - concat_edges(const std::vector& from, const std::vector& to) -> edge_t; + auto concat_edges(const std::vector& from, const std::vector& to) + -> edge_t; }; /************************************* @@ -1313,8 +1311,8 @@ namespace mamba::solver * Sort suffices such that if one ends with the other, the longest one is put first. */ template - constexpr auto - sorted_suffix(std::array arr) -> std::array + constexpr auto sorted_suffix(std::array arr) + -> std::array { std::sort( arr.begin(), @@ -1654,8 +1652,8 @@ namespace mamba::solver return out; } - auto - problem_tree_msg(const CompressedProblemsGraph& pbs, const ProblemsMessageFormat& format) -> std::string + auto problem_tree_msg(const CompressedProblemsGraph& pbs, const ProblemsMessageFormat& format) + -> std::string { std::stringstream ss; print_problem_tree_msg(ss, pbs, format); diff --git a/libmamba/src/specs/authentication_info.cpp b/libmamba/src/specs/authentication_info.cpp index 1016736245..10c724639e 100644 --- a/libmamba/src/specs/authentication_info.cpp +++ b/libmamba/src/specs/authentication_info.cpp @@ -87,15 +87,15 @@ std::hash::operator()( } auto -std::hash::operator()(const mamba::specs::BearerToken& auth -) const -> std::size_t +std::hash::operator()(const mamba::specs::BearerToken& auth) const + -> std::size_t { return std::hash{}(auth.token); } auto -std::hash::operator()(const mamba::specs::CondaToken& auth -) const -> std::size_t +std::hash::operator()(const mamba::specs::CondaToken& auth) const + -> std::size_t { return std::hash{}(auth.token); } diff --git a/libmamba/src/specs/build_number_spec.cpp b/libmamba/src/specs/build_number_spec.cpp index 90222da43c..abf0e4a72d 100644 --- a/libmamba/src/specs/build_number_spec.cpp +++ b/libmamba/src/specs/build_number_spec.cpp @@ -19,8 +19,8 @@ namespace mamba::specs * BuildNumberPredicate BinaryOperators Implementation * *********************************************************/ - auto - BuildNumberPredicate::free_interval::operator()(const BuildNumber&, const BuildNumber&) const -> bool + auto BuildNumberPredicate::free_interval::operator()(const BuildNumber&, const BuildNumber&) const + -> bool { return true; } @@ -98,8 +98,8 @@ namespace mamba::specs } auto -fmt::formatter::parse(format_parse_context& ctx -) -> decltype(ctx.begin()) +fmt::formatter::parse(format_parse_context& ctx) + -> decltype(ctx.begin()) { // make sure that range is empty if (ctx.begin() != ctx.end() && *ctx.begin() != '}') @@ -253,8 +253,8 @@ namespace mamba::specs } auto -fmt::formatter::parse(format_parse_context& ctx -) -> decltype(ctx.begin()) +fmt::formatter::parse(format_parse_context& ctx) + -> decltype(ctx.begin()) { // make sure that range is empty if (ctx.begin() != ctx.end() && *ctx.begin() != '}') diff --git a/libmamba/src/specs/channel.cpp b/libmamba/src/specs/channel.cpp index 9781cefdde..977d97b390 100644 --- a/libmamba/src/specs/channel.cpp +++ b/libmamba/src/specs/channel.cpp @@ -20,14 +20,14 @@ namespace mamba::specs * NameWeakener Implementation * *********************************/ - auto ChannelResolveParams::NameWeakener::make_first_key(std::string_view key - ) const -> std::string_view + auto ChannelResolveParams::NameWeakener::make_first_key(std::string_view key) const + -> std::string_view { return key; } - auto ChannelResolveParams::NameWeakener::weaken_key(std::string_view key - ) const -> std::optional + auto ChannelResolveParams::NameWeakener::weaken_key(std::string_view key) const + -> std::optional { return std::get<0>(util::rsplit_once(key, '/')); } @@ -328,7 +328,8 @@ namespace mamba::specs return uri.pretty_str(); } - auto resolve_path_location(std::string location, ChannelResolveParamsView params) -> std::string + auto resolve_path_location(std::string location, ChannelResolveParamsView params) + -> std::string { if (util::url_has_scheme(location)) { @@ -387,8 +388,8 @@ namespace mamba::specs return url.pretty_str(StripScheme::no, '/', Credentials::Remove); } - auto - resolve_url(UnresolvedChannel&& uc, ChannelResolveParamsView params) -> expected_parse_t + auto resolve_url(UnresolvedChannel&& uc, ChannelResolveParamsView params) + -> expected_parse_t { assert(util::url_has_scheme(uc.location())); assert(util::url_get_scheme(uc.location()) != "file"); @@ -450,7 +451,8 @@ namespace mamba::specs return out; } - auto resolve_name_from_alias(UnresolvedChannel&& uc, ChannelResolveParamsView params) -> Channel + auto resolve_name_from_alias(UnresolvedChannel&& uc, ChannelResolveParamsView params) + -> Channel { auto url = params.channel_alias; url.append_path(uc.location()); @@ -462,8 +464,8 @@ namespace mamba::specs }; } - auto - resolve_name(UnresolvedChannel&& uc, ChannelResolveParamsView params) -> Channel::channel_list + auto resolve_name(UnresolvedChannel&& uc, ChannelResolveParamsView params) + -> Channel::channel_list { if (auto it = params.custom_channels.find_weaken(uc.location()); it != params.custom_channels.cend()) @@ -561,8 +563,8 @@ namespace mamba::specs * Implementation of std::hash * *********************************/ -auto ::std::hash::operator()(const mamba::specs::Channel - & chan) const -> std::size_t +auto ::std::hash::operator()(const mamba::specs::Channel & chan) const + -> std::size_t { return mamba::util::hash_combine( mamba::util::hash_vals(chan.url(), chan.display_name()), diff --git a/libmamba/src/specs/chimera_string_spec.cpp b/libmamba/src/specs/chimera_string_spec.cpp index 01bc227264..9627b6a0ac 100644 --- a/libmamba/src/specs/chimera_string_spec.cpp +++ b/libmamba/src/specs/chimera_string_spec.cpp @@ -46,7 +46,8 @@ namespace mamba::specs [[nodiscard]] auto is_likely_glob(std::string_view pattern) -> bool { - constexpr auto is_likely_glob_char = [](char c) -> bool { + constexpr auto is_likely_glob_char = [](char c) -> bool + { return util::is_alphanum(c) || (c == '-') || (c == '_') || (c == GlobSpec::glob_pattern); }; @@ -125,8 +126,8 @@ namespace mamba::specs } auto -fmt::formatter::parse(format_parse_context& ctx -) -> decltype(ctx.begin()) +fmt::formatter::parse(format_parse_context& ctx) + -> decltype(ctx.begin()) { // make sure that range is empty if (ctx.begin() != ctx.end() && *ctx.begin() != '}') diff --git a/libmamba/src/specs/conda_url.cpp b/libmamba/src/specs/conda_url.cpp index 46b45a0d1a..886731ea64 100644 --- a/libmamba/src/specs/conda_url.cpp +++ b/libmamba/src/specs/conda_url.cpp @@ -24,8 +24,8 @@ namespace mamba::specs * * Not a static function, it is needed in "channel_spec.cpp". */ - auto find_slash_and_platform(std::string_view path - ) -> std::tuple> + auto find_slash_and_platform(std::string_view path) + -> std::tuple> { static constexpr auto npos = std::string_view::npos; diff --git a/libmamba/src/specs/glob_spec.cpp b/libmamba/src/specs/glob_spec.cpp index 723ff13cbb..8293fda91c 100644 --- a/libmamba/src/specs/glob_spec.cpp +++ b/libmamba/src/specs/glob_spec.cpp @@ -56,10 +56,8 @@ fmt::formatter::parse(format_parse_context& ctx) -> decl } auto -fmt::formatter::format( - const ::mamba::specs::GlobSpec& spec, - format_context& ctx -) const -> decltype(ctx.out()) +fmt::formatter::format(const ::mamba::specs::GlobSpec& spec, format_context& ctx) const + -> decltype(ctx.out()) { return fmt::format_to(ctx.out(), "{}", spec.str()); } diff --git a/libmamba/src/specs/match_spec.cpp b/libmamba/src/specs/match_spec.cpp index d314c26f55..09d763af8c 100644 --- a/libmamba/src/specs/match_spec.cpp +++ b/libmamba/src/specs/match_spec.cpp @@ -180,7 +180,8 @@ namespace mamba::specs { return util::strip_if( str, - [](char c) -> bool { + [](char c) -> bool + { return !util::is_graphic(c) || (c == MatchSpec::preferred_quote) || (c == MatchSpec::alt_quote); } @@ -312,8 +313,8 @@ namespace mamba::specs ); } - [[nodiscard]] auto split_attribute_val(std::string_view key_val - ) -> expected_parse_t>> + [[nodiscard]] auto split_attribute_val(std::string_view key_val) + -> expected_parse_t>> { // Forbid known ambiguity if (util::starts_with(key_val, "version")) @@ -427,7 +428,8 @@ namespace mamba::specs assert(start < end); return set_matchspec_attributes(spec, str.substr(start + 1, end - start - 1)) .and_then( // - [&]() { + [&]() + { return rparse_and_set_matchspec_attributes( spec, str.substr(0, start_end.first) @@ -438,8 +440,8 @@ namespace mamba::specs ); } - auto split_version_and_build(std::string_view str - ) -> std::pair + auto split_version_and_build(std::string_view str) + -> std::pair { str = util::strip(str); diff --git a/libmamba/src/specs/unresolved_channel.cpp b/libmamba/src/specs/unresolved_channel.cpp index 012c2402d2..95d56a28ac 100644 --- a/libmamba/src/specs/unresolved_channel.cpp +++ b/libmamba/src/specs/unresolved_channel.cpp @@ -26,8 +26,8 @@ namespace mamba::specs { // Defined in conda_url.cpp - [[nodiscard]] auto find_slash_and_platform(std::string_view path - ) -> std::tuple>; + [[nodiscard]] auto find_slash_and_platform(std::string_view path) + -> std::tuple>; auto UnresolvedChannel::parse_platform_list(std::string_view plats) -> platform_set { @@ -68,8 +68,8 @@ namespace mamba::specs return { {}, {} }; } - auto split_location_platform(std::string_view str - ) -> expected_parse_t> + auto split_location_platform(std::string_view str) + -> expected_parse_t> { if (util::ends_with(str, ']')) { @@ -247,10 +247,8 @@ namespace mamba::specs } auto -fmt::formatter::format( - const UnresolvedChannel& uc, - format_context& ctx -) const -> format_context::iterator +fmt::formatter::format(const UnresolvedChannel& uc, format_context& ctx) const + -> format_context::iterator { auto out = fmt::format_to(ctx.out(), "{}", uc.location()); if (!uc.platform_filters().empty()) diff --git a/libmamba/src/specs/version.cpp b/libmamba/src/specs/version.cpp index 9a0bade8f9..286ceeffeb 100644 --- a/libmamba/src/specs/version.cpp +++ b/libmamba/src/specs/version.cpp @@ -176,8 +176,8 @@ namespace mamba::specs } auto -fmt::formatter::parse(format_parse_context& ctx -) -> decltype(ctx.begin()) +fmt::formatter::parse(format_parse_context& ctx) + -> decltype(ctx.begin()) { // make sure that range is empty if (ctx.begin() != ctx.end() && *ctx.begin() != '}') @@ -404,8 +404,8 @@ namespace mamba::specs { }; - [[maybe_unused]] auto - starts_with_three_way(const AlwaysEqual&, const AlwaysEqual&) -> strong_ordering + [[maybe_unused]] auto starts_with_three_way(const AlwaysEqual&, const AlwaysEqual&) + -> strong_ordering { // This comparison should not happen with the current usage. assert(false); @@ -424,8 +424,8 @@ namespace mamba::specs return strong_ordering::equal; } - auto - starts_with_three_way(const VersionPartAtom& a, const VersionPartAtom& b) -> strong_ordering + auto starts_with_three_way(const VersionPartAtom& a, const VersionPartAtom& b) + -> strong_ordering { if ((a.numeral() == b.numeral()) && b.literal().empty()) { @@ -533,8 +533,8 @@ namespace mamba::specs } template - auto parse_leading_epoch(std::string_view str - ) -> expected_parse_t> + auto parse_leading_epoch(std::string_view str) + -> expected_parse_t> { const auto delim_pos = str.find(Version::epoch_delim); // No epoch is specified @@ -574,8 +574,8 @@ namespace mamba::specs return { maybe_integer.value(), rest }; } - auto - parse_leading_literal(std::string_view str) -> std::pair + auto parse_leading_literal(std::string_view str) + -> std::pair { const auto [literal, rest] = util::lstrip_if_parts( str, @@ -584,8 +584,8 @@ namespace mamba::specs return { literal, rest }; } - auto - parse_leading_part_atom(std::string_view str) -> std::pair + auto parse_leading_part_atom(std::string_view str) + -> std::pair { assert(!str.empty()); @@ -694,8 +694,8 @@ namespace mamba::specs return { std::move(parts) }; } - auto parse_trailing_local_version(std::string_view str - ) -> expected_parse_t> + auto parse_trailing_local_version(std::string_view str) + -> expected_parse_t> { const auto delim_pos = str.rfind(Version::local_delim); // No local is specified @@ -791,8 +791,8 @@ fmt::formatter::parse(format_parse_context& ctx) -> declt } auto -fmt::formatter::format(const ::mamba::specs::Version v, format_context& ctx) - const -> decltype(ctx.out()) +fmt::formatter::format(const ::mamba::specs::Version v, format_context& ctx) const + -> decltype(ctx.out()) { auto out = ctx.out(); if (v.epoch() != 0) diff --git a/libmamba/src/specs/version_spec.cpp b/libmamba/src/specs/version_spec.cpp index c68058a68c..8f784a26fb 100644 --- a/libmamba/src/specs/version_spec.cpp +++ b/libmamba/src/specs/version_spec.cpp @@ -29,8 +29,8 @@ namespace mamba::specs return true; } - auto - VersionPredicate::starts_with::operator()(const Version& point, const Version& prefix) const -> bool + auto VersionPredicate::starts_with::operator()(const Version& point, const Version& prefix) const + -> bool { return point.starts_with(prefix); } @@ -41,7 +41,8 @@ namespace mamba::specs } auto - VersionPredicate::not_starts_with::operator()(const Version& point, const Version& prefix) const -> bool + VersionPredicate::not_starts_with::operator()(const Version& point, const Version& prefix) const + -> bool { return !point.starts_with(prefix); } @@ -52,13 +53,14 @@ namespace mamba::specs } auto - VersionPredicate::compatible_with::operator()(const Version& point, const Version& older) const -> bool + VersionPredicate::compatible_with::operator()(const Version& point, const Version& older) const + -> bool { return point.compatible_with(older, level); } - auto - operator==(VersionPredicate::compatible_with lhs, VersionPredicate::compatible_with rhs) -> bool + auto operator==(VersionPredicate::compatible_with lhs, VersionPredicate::compatible_with rhs) + -> bool { return lhs.level == rhs.level; } @@ -180,8 +182,8 @@ namespace mamba::specs } auto -fmt::formatter::parse(format_parse_context& ctx -) -> decltype(ctx.begin()) +fmt::formatter::parse(format_parse_context& ctx) + -> decltype(ctx.begin()) { if (auto it = std::find(ctx.begin(), ctx.end(), 'b'); it < ctx.end()) { diff --git a/libmamba/src/util/encoding.cpp b/libmamba/src/util/encoding.cpp index 665794548a..ab30d3867d 100644 --- a/libmamba/src/util/encoding.cpp +++ b/libmamba/src/util/encoding.cpp @@ -144,8 +144,8 @@ namespace mamba::util } // TODO(C++20): use iterators return type - auto - hex_to_bytes_to(std::string_view hex, std::byte* out) noexcept -> tl::expected + auto hex_to_bytes_to(std::string_view hex, std::byte* out) noexcept + -> tl::expected { auto error = EncodingError::Ok; hex_to_bytes_to(hex, out, error); diff --git a/libmamba/src/util/string.cpp b/libmamba/src/util/string.cpp index 0b45e3bccc..d6d78ab920 100644 --- a/libmamba/src/util/string.cpp +++ b/libmamba/src/util/string.cpp @@ -285,8 +285,8 @@ namespace mamba::util * Implementation of remove prefix/suffix functions * ******************************************************/ - auto - split_prefix(std::string_view str, std::string_view prefix) -> std::array + auto split_prefix(std::string_view str, std::string_view prefix) + -> std::array { if (starts_with(str, prefix)) { @@ -315,8 +315,8 @@ namespace mamba::util return std::get<1>(split_prefix(str, c)); } - auto - split_suffix(std::string_view str, std::string_view suffix) -> std::array + auto split_suffix(std::string_view str, std::string_view suffix) + -> std::array { if (ends_with(str, suffix)) { @@ -478,14 +478,14 @@ namespace mamba::util return lstrip_parts_impl(input, c); } - auto - lstrip_parts(std::string_view input, std::string_view chars) -> std::array + auto lstrip_parts(std::string_view input, std::string_view chars) + -> std::array { return lstrip_parts_impl(input, chars); } - auto - lstrip_parts(std::wstring_view input, std::wstring_view chars) -> std::array + auto lstrip_parts(std::wstring_view input, std::wstring_view chars) + -> std::array { return lstrip_parts_impl(input, chars); } @@ -517,14 +517,14 @@ namespace mamba::util return rstrip_parts_impl(input, c); } - auto - rstrip_parts(std::string_view input, std::string_view chars) -> std::array + auto rstrip_parts(std::string_view input, std::string_view chars) + -> std::array { return rstrip_parts_impl(input, chars); } - auto - rstrip_parts(std::wstring_view input, std::wstring_view chars) -> std::array + auto rstrip_parts(std::wstring_view input, std::wstring_view chars) + -> std::array { return rstrip_parts_impl(input, chars); } @@ -558,14 +558,14 @@ namespace mamba::util return strip_parts_impl(input, c); } - auto - strip_parts(std::string_view input, std::string_view chars) -> std::array + auto strip_parts(std::string_view input, std::string_view chars) + -> std::array { return strip_parts_impl(input, chars); } - auto - strip_parts(std::wstring_view input, std::wstring_view chars) -> std::array + auto strip_parts(std::wstring_view input, std::wstring_view chars) + -> std::array { return strip_parts_impl(input, chars); } @@ -767,8 +767,8 @@ namespace mamba::util } // TODO(C++20) lazy_split_view is a range - auto - split(std::wstring_view input, wchar_t sep, std::size_t max_split) -> std::vector + auto split(std::wstring_view input, wchar_t sep, std::size_t max_split) + -> std::vector { const auto sep_arr = std::array{ sep, L'\0' }; return split(input, sep_arr.data(), max_split); @@ -796,8 +796,8 @@ namespace mamba::util } // TODO(C++20) lazy_split_view is a range - auto - rsplit(std::wstring_view input, wchar_t sep, std::size_t max_split) -> std::vector + auto rsplit(std::wstring_view input, wchar_t sep, std::size_t max_split) + -> std::vector { const auto sep_arr = std::array{ sep, L'\0' }; return rsplit(input, sep_arr.data(), max_split); @@ -897,8 +897,8 @@ namespace mamba::util return concat_dedup_splits_impl(str1, str2, sep); } - auto - concat_dedup_splits(std::string_view str1, std::string_view str2, std::string_view sep) -> std::string + auto concat_dedup_splits(std::string_view str1, std::string_view str2, std::string_view sep) + -> std::string { return concat_dedup_splits_impl(str1, str2, sep); } diff --git a/libmamba/src/util/url.cpp b/libmamba/src/util/url.cpp index aeb2ed4db0..480f2012e6 100644 --- a/libmamba/src/util/url.cpp +++ b/libmamba/src/util/url.cpp @@ -52,8 +52,8 @@ namespace mamba::util CurlUrl(); - [[nodiscard]] auto - get_part(::CURLUPart part, flag_type flags = 0) const -> std::optional; + [[nodiscard]] auto get_part(::CURLUPart part, flag_type flags = 0) const + -> std::optional; private: @@ -99,8 +99,8 @@ namespace mamba::util size_type m_len = { -1 }; }; - auto - CurlUrl::parse(const std::string& url, flag_type flags) -> tl::expected + auto CurlUrl::parse(const std::string& url, flag_type flags) + -> tl::expected { auto out = CurlUrl(); const CURLUcode uc = ::curl_url_set(out.m_handle.get(), CURLUPART_URL, url.c_str(), flags); @@ -445,8 +445,8 @@ namespace mamba::util ); } - auto - URL::authority_elems(Credentials credentials, Decode::yes_type) const -> std::array + auto URL::authority_elems(Credentials credentials, Decode::yes_type) const + -> std::array { return authority_elems_impl( authentication_elems(credentials, Decode::yes), diff --git a/libmamba/src/validation/keys.cpp b/libmamba/src/validation/keys.cpp index 443561c812..7016a39dc9 100644 --- a/libmamba/src/validation/keys.cpp +++ b/libmamba/src/validation/keys.cpp @@ -82,7 +82,7 @@ namespace mamba::validation RoleFullKeys::RoleFullKeys(const std::map& keys_, const std::size_t& threshold_) : keys(keys_) - , threshold(threshold_){}; + , threshold(threshold_) {}; auto RoleFullKeys::to_keys() const -> std::map { diff --git a/libmamba/src/validation/tools.cpp b/libmamba/src/validation/tools.cpp index ded92117d6..31ddfcd567 100644 --- a/libmamba/src/validation/tools.cpp +++ b/libmamba/src/validation/tools.cpp @@ -42,8 +42,8 @@ namespace mamba::validation namespace { template - [[nodiscard]] auto - hex_to_bytes_arr(const B& buffer, int& error_code) noexcept -> std::array + [[nodiscard]] auto hex_to_bytes_arr(const B& buffer, int& error_code) noexcept + -> std::array { auto out = std::array{}; auto err = util::EncodingError::Ok; @@ -53,8 +53,8 @@ namespace mamba::validation } template - [[nodiscard]] auto - hex_to_bytes_vec(const B& buffer, int& error_code) noexcept -> std::vector + [[nodiscard]] auto hex_to_bytes_vec(const B& buffer, int& error_code) noexcept + -> std::vector { auto out = std::vector(buffer.size() / 2); auto err = util::EncodingError::Ok; @@ -133,8 +133,8 @@ namespace mamba::validation } auto generate_ed25519_keypair() -> std::pair< - std::array, - std::array> + std::array, + std::array> { std::array pk, sk; generate_ed25519_keypair(pk.data(), sk.data()); @@ -288,14 +288,15 @@ namespace mamba::validation return verify(data, bin_pk.data(), bin_signature.data()); } - auto - verify_gpg_hashed_msg(const std::byte* data, const std::byte* pk, const std::byte* signature) -> int + auto verify_gpg_hashed_msg(const std::byte* data, const std::byte* pk, const std::byte* signature) + -> int { return verify(data, MAMBA_SHA256_SIZE_BYTES, pk, signature); } auto - verify_gpg_hashed_msg(const std::string& data, const std::byte* pk, const std::byte* signature) -> int + verify_gpg_hashed_msg(const std::string& data, const std::byte* pk, const std::byte* signature) + -> int { int error = 0; auto data_bin = hex_to_bytes_arr(data, error); diff --git a/libmamba/src/validation/update_framework_v0_6.cpp b/libmamba/src/validation/update_framework_v0_6.cpp index 70c8c3881d..d51ff62648 100644 --- a/libmamba/src/validation/update_framework_v0_6.cpp +++ b/libmamba/src/validation/update_framework_v0_6.cpp @@ -146,8 +146,8 @@ namespace mamba::validation::v0_6 } auto - RootImpl::upgraded_signature(const nlohmann::json& j, const std::string& pk, const std::byte* sk) - const -> RoleSignature + RootImpl::upgraded_signature(const nlohmann::json& j, const std::string& pk, const std::byte* sk) const + -> RoleSignature { std::array sig_bin; sign(j.dump(), sk, sig_bin.data()); diff --git a/libmamba/tests/src/solver/libsolv/test_database.cpp b/libmamba/tests/src/solver/libsolv/test_database.cpp index d8a4d105a6..bb2a1a8512 100644 --- a/libmamba/tests/src/solver/libsolv/test_database.cpp +++ b/libmamba/tests/src/solver/libsolv/test_database.cpp @@ -22,8 +22,8 @@ using namespace mamba::solver; namespace { - auto - mkpkg(std::string name, std::string version, std::vector deps = {}) -> specs::PackageInfo + auto mkpkg(std::string name, std::string version, std::vector deps = {}) + -> specs::PackageInfo { auto out = specs::PackageInfo(); out.name = std::move(name); diff --git a/libmamba/tests/src/solver/libsolv/test_solver.cpp b/libmamba/tests/src/solver/libsolv/test_solver.cpp index 5263975c1d..63b35ce07d 100644 --- a/libmamba/tests/src/solver/libsolv/test_solver.cpp +++ b/libmamba/tests/src/solver/libsolv/test_solver.cpp @@ -25,7 +25,8 @@ using namespace mamba; using namespace mamba::solver; auto -find_actions_with_name(const Solution& solution, std::string_view name) -> std::vector +find_actions_with_name(const Solution& solution, std::string_view name) + -> std::vector { auto out = std::vector(); for (const auto& action : solution.actions) diff --git a/libmamba/tests/src/solver/test_problems_graph.cpp b/libmamba/tests/src/solver/test_problems_graph.cpp index 87223292b2..9ff270c2a5 100644 --- a/libmamba/tests/src/solver/test_problems_graph.cpp +++ b/libmamba/tests/src/solver/test_problems_graph.cpp @@ -297,10 +297,9 @@ namespace ); } - auto make_platform_channels( - std::vector&& channels, - const std::vector& platforms - ) -> std::vector + auto + make_platform_channels(std::vector&& channels, const std::vector& platforms) + -> std::vector { auto add_plat = [&platforms](const auto& chan) { return fmt::format("{}[{}]", chan, fmt::join(platforms, ",")); }; diff --git a/libmamba/tests/src/specs/test_channel.cpp b/libmamba/tests/src/specs/test_channel.cpp index 7da74db183..5e597dcb15 100644 --- a/libmamba/tests/src/specs/test_channel.cpp +++ b/libmamba/tests/src/specs/test_channel.cpp @@ -233,9 +233,8 @@ TEST_SUITE("specs::channel") { auto make_typical_params = []() -> ChannelResolveParams { - auto make_channel = [](std::string_view loc, const ChannelResolveParams& params) { - return Channel::resolve(UnresolvedChannel::parse(loc).value(), params).value().at(0); - }; + auto make_channel = [](std::string_view loc, const ChannelResolveParams& params) + { return Channel::resolve(UnresolvedChannel::parse(loc).value(), params).value().at(0); }; auto params = ChannelResolveParams{}; params.platforms = { "linux-64", "noarch" }; diff --git a/libmamba/tests/src/validation/test_update_framework_v0_6.cpp b/libmamba/tests/src/validation/test_update_framework_v0_6.cpp index fcfbae7d19..b96caef24a 100644 --- a/libmamba/tests/src/validation/test_update_framework_v0_6.cpp +++ b/libmamba/tests/src/validation/test_update_framework_v0_6.cpp @@ -176,8 +176,8 @@ class RootImplT_v0_6 std::unique_ptr channel_dir; - auto generate_role_secrets(int count - ) -> std::map> + auto generate_role_secrets(int count) + -> std::map> { std::map> role_secrets; @@ -757,8 +757,8 @@ class KeyMgrT_v06 : public RootImplT_v0_6 return update_key_mgr.patch(sig_patch); } - auto - write_key_mgr_file(const nl::json& j, const std::string& filename = "key_mgr.json") -> fs::u8path + auto write_key_mgr_file(const nl::json& j, const std::string& filename = "key_mgr.json") + -> fs::u8path { fs::u8path p = channel_dir->path() / filename; @@ -1030,8 +1030,8 @@ class PkgMgrT_v06 : public KeyMgrT_v06 return update_pkg_mgr.patch(sig_patch); } - auto - write_pkg_mgr_file(const nl::json& j, const std::string& filename = "pkg_mgr.json") -> fs::u8path + auto write_pkg_mgr_file(const nl::json& j, const std::string& filename = "pkg_mgr.json") + -> fs::u8path { fs::u8path p = channel_dir->path() / filename; diff --git a/libmamba/tests/src/validation/test_update_framework_v1.cpp b/libmamba/tests/src/validation/test_update_framework_v1.cpp index 4444e64cd1..ee574af9e0 100644 --- a/libmamba/tests/src/validation/test_update_framework_v1.cpp +++ b/libmamba/tests/src/validation/test_update_framework_v1.cpp @@ -133,8 +133,8 @@ class RootImplT_v1 secrets_type secrets; - auto generate_role_secrets(int count - ) -> std::map> + auto generate_role_secrets(int count) + -> std::map> { std::map> role_secrets; diff --git a/libmambapy/src/libmambapy/bindings/legacy.cpp b/libmambapy/src/libmambapy/bindings/legacy.cpp index 17c48894e3..dbfa4375f7 100644 --- a/libmambapy/src/libmambapy/bindings/legacy.cpp +++ b/libmambapy/src/libmambapy/bindings/legacy.cpp @@ -371,7 +371,8 @@ bind_submodule_impl(pybind11::module_ m) py::enum_(m, "SolverRuleinfo") .def(py::init( - [](py::args, py::kwargs) -> SolverRuleinfoV2Migrator { + [](py::args, py::kwargs) -> SolverRuleinfoV2Migrator + { throw std::runtime_error("Direct access to libsolv objects is not longer supported."); } )); @@ -579,7 +580,8 @@ bind_submodule_impl(pybind11::module_ m) const std::string& full_url, MultiPackageCache& caches, const std::string& repodata_fn, - const std::string& url) { + const std::string& url) + { self.create(context, channel_context, channel, platform, full_url, caches, repodata_fn, url); }, py::arg("context"), diff --git a/libmambapy/src/libmambapy/bindings/solver_libsolv.cpp b/libmambapy/src/libmambapy/bindings/solver_libsolv.cpp index a9d1fa7fe5..985afb48b2 100644 --- a/libmambapy/src/libmambapy/bindings/solver_libsolv.cpp +++ b/libmambapy/src/libmambapy/bindings/solver_libsolv.cpp @@ -225,12 +225,12 @@ namespace mambapy py::arg("format") ); - constexpr auto solver_flags_v2_migrator = [](Solver&, py::args, py::kwargs) { + constexpr auto solver_flags_v2_migrator = [](Solver&, py::args, py::kwargs) + { throw std::runtime_error("All flags need to be passed in the libmambapy.solver.Request."); }; - constexpr auto solver_job_v2_migrator = [](Solver&, py::args, py::kwargs) { - throw std::runtime_error("All jobs need to be passed in the libmambapy.solver.Request."); - }; + constexpr auto solver_job_v2_migrator = [](Solver&, py::args, py::kwargs) + { throw std::runtime_error("All jobs need to be passed in the libmambapy.solver.Request."); }; py::class_(m, "Solver") // .def(py::init()) diff --git a/libmambapy/src/libmambapy/bindings/specs.cpp b/libmambapy/src/libmambapy/bindings/specs.cpp index 21556dfa0d..bbe1d74155 100644 --- a/libmambapy/src/libmambapy/bindings/specs.cpp +++ b/libmambapy/src/libmambapy/bindings/specs.cpp @@ -122,7 +122,8 @@ namespace mambapy ) .def( "user", - [](const CondaURL& self, bool decode) { + [](const CondaURL& self, bool decode) + { return decode ? self.user(CondaURL::Decode::yes) : self.user(CondaURL::Decode::no); }, @@ -145,7 +146,8 @@ namespace mambapy .def("has_user", [](const CondaURL& self) { return self.has_user(); }) .def( "password", - [](const CondaURL& self, bool decode) { + [](const CondaURL& self, bool decode) + { return decode ? self.password(CondaURL::Decode::yes) : self.password(CondaURL::Decode::no); }, @@ -197,7 +199,8 @@ namespace mambapy .def("authority", [](const CondaURL& self) { return self.authority(); }) .def( "path", - [](const CondaURL& self, bool decode) { + [](const CondaURL& self, bool decode) + { return decode ? self.path(CondaURL::Decode::yes) : self.path(CondaURL::Decode::no); }, @@ -778,7 +781,8 @@ namespace mambapy .def( // V2 Migation: Hard deprecation since errors would be hard to track. py::init( - [](std::string_view) -> MatchSpec { + [](std::string_view) -> MatchSpec + { throw std::invalid_argument( "Use 'MatchSpec.parse' to create a new object from a string" ); From d42b8c248115ad9540175d03bfcf5ddba9988795 Mon Sep 17 00:00:00 2001 From: Julien Jerphanion Date: Mon, 18 Nov 2024 17:41:17 +0100 Subject: [PATCH 110/126] docs: Update pieces of documentation after the release of mamba 2 (#3610) Signed-off-by: Julien Jerphanion Co-authored-by: Lucas Colley Co-authored-by: Johan Mabille --- README.md | 42 ++++++++++++++++------ docs/source/developer_zone/changes-2.0.rst | 8 +++-- docs/source/index.rst | 9 ++--- 3 files changed, 42 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 0ea3cdaf37..53912124c1 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,6 @@ Package Manager mamba Package Server quetz - Package Builder boa @@ -31,8 +30,29 @@ At the same time, `mamba` utilizes the same command line parser, package installation and deinstallation code and transaction verification routines as `conda` to stay as compatible as possible. -Mamba is part of a bigger ecosystem to make scientific packaging more sustainable. You can read our [announcement blog post](https://medium.com/@QuantStack/open-software-packaging-for-science-61cecee7fc23). -The ecosystem also consists of `quetz`, an open source `conda` package server and `boa`, a fast `conda` package builder. +`mamba` is part of the [conda-forge](https://conda-forge.org/) ecosystem, which also consists of `quetz`, an open source `conda` package server. + +You can read our [announcement blog post](https://medium.com/@QuantStack/open-software-packaging-for-science-61cecee7fc23). + +## micromamba + +`micromamba` is the statically linked version of `mamba`. + +It can be installed as a standalone executable without any dependencies, making it a perfect fit for CI/CD pipelines and containerized environments. + +See the [documentation on `micromamba`](https://mamba.readthedocs.io/en/latest/user_guide/micromamba.html) for details. + +## `mamba` v.s. `micromamba` + +`mamba` has to be preferred when: + - `libmambapy` or `libmamba` is used by other software in the same environment. + - Scenarios where regular updates to libraries are required (especially for security). + - Environments are focused on reducing disk space usage for dependencies. + +`micromamba` has to be preferred when: + - Relying a single self-contained executable is required. + - A miniforge distribution is not present. + - Usage requires minimal runtime. ## Installation @@ -45,33 +65,35 @@ Please refer to the [mamba](https://mamba.readthedocs.io/en/latest/installation/ ### `repoquery` To efficiently query repositories and query package dependencies you can use `mamba repoquery` or `micromamba repoquery`. + See the [repoquery documentation](https://mamba.readthedocs.io/en/latest/user_guide/mamba.html#repoquery) for details. ### Installing lock files -`micromamba` can be used to install lock files generated by [conda-lock](https://conda.github.io/conda-lock/) without having to install `conda-lock`. Simply invoke e.g. `micromamba create -n my-env -f conda-lock.yml` with an environment lockfile named `*-lock.yml` or `*-lock.yaml`. +`micromamba` can be used to install lock files generated by [conda-lock](https://conda.github.io/conda-lock/) without having to install `conda-lock`. + +Simply invoke e.g. `micromamba create -n my-env -f conda-lock.yml` with an environment lockfile named `*-lock.yml` or `*-lock.yaml`. ### setup-micromamba (setup-miniconda replacement) [setup-micromamba](https://github.com/marketplace/actions/setup-micromamba) is a replacement for [setup-miniconda](https://github.com/marketplace/actions/setup-miniconda) that uses `micromamba`. + It can significantly reduce your CI setup time by: - Using `micromamba`, which takes around 1 s to install. - Caching package downloads. - Caching entire `conda` environments. -## micromamba - -`micromamba` is a small, pure-C++ reimplementation of `mamba`/`conda`. It strives to be a full replacement for `mamba` and `conda`. As such, it doesn't use any `conda` code (in fact it doesn't require Python at all). - -See the [documentation on `micromamba`](https://mamba.readthedocs.io/en/latest/user_guide/micromamba.html) for details. - ## Development installation Please refer to the instructions given by the [official documentation](https://mamba.readthedocs.io/en/latest/developer_zone/dev_environment.html). ## Support us +Only `mamba` and `micromamba` 2.0 and later are supported and are actively developed. + +The `1.x` branch is only maintained for addressing security issues such as CVEs. + For questions, you can also join us on the [QuantStack Chat](https://gitter.im/QuantStack/Lobby) or on the [Conda channel](https://gitter.im/conda/conda) (note that this project is not officially affiliated with `conda` or Anaconda Inc.). ## License diff --git a/docs/source/developer_zone/changes-2.0.rst b/docs/source/developer_zone/changes-2.0.rst index bf92cfd8b9..31ffeb31e7 100644 --- a/docs/source/developer_zone/changes-2.0.rst +++ b/docs/source/developer_zone/changes-2.0.rst @@ -14,10 +14,12 @@ Command Line Executables ------------------------ Mamba (executable) ****************** -``mamba``, previously a Python executable mixing ``libmambapy``, ``conda``, and code to bridge both -project is being replace by a fully C++ executable based on ``libmamba`` solely. -It now presents the same user interface and experience as ``micromamba``. +``mamba``, previously a Python executable mixing ``libmambapy``, ``conda``, and some specific code logic +has been entirely replaced by the dynamically linked version of ``micromamba``, +a statically-linked ELF based on ``libmamba``. + +Hence ``mamba``` now has the exact same user interface and experience as ``micromamba``. .. warning:: diff --git a/docs/source/index.rst b/docs/source/index.rst index a2ad902443..7c658cd3a6 100644 --- a/docs/source/index.rst +++ b/docs/source/index.rst @@ -5,11 +5,12 @@ Mamba is a fast, robust, and cross-platform package manager. It runs on Windows, OS X and Linux (ARM64 and PPC64LE included) and is fully compatible with ``conda`` packages and supports most of conda's commands. -The ``mamba-org`` organization hosts multiple Mamba flavors: +Mamba is a framework with several components: -- ``mamba``: a Python-based CLI conceived as a *drop-in* replacement for ``conda``, offering higher speed and more reliable environment solutions -- ``micromamba``: a pure C++-based CLI, self-contained in a single-file executable -- ``libmamba``: a C++ library exposing low-level and high-level APIs on top of which both ``mamba`` and ``micromamba`` are built +- ``libmamba``: a C++ library of the domain, exposing low-level and high-level APIs +- ``mamba``: a ELF as a *drop-in* replacement for ``conda``, built on top of ``libmamba`` +- ``micromamba``: the statically linked version of ``mamba`` +- ``libmambapy``: python bindings of ``libmamba`` .. note:: In this documentation, ``Mamba`` will refer to all flavors while flavor-specific details will mention ``mamba``, ``micromamba`` or ``libmamba``. From e1e0f8c88d88386e032f9269414eb8e75602e432 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Klaim=20=28Jo=C3=ABl=20Lamotte=29?= <142265+Klaim@users.noreply.github.com> Date: Wed, 20 Nov 2024 11:27:55 +0100 Subject: [PATCH 111/126] Prevent pip "rich" ouput (#3607) Co-authored-by: Johan Mabille Co-authored-by: Hind-M <70631848+Hind-M@users.noreply.github.com> --- libmamba/src/core/prefix_data.cpp | 78 ++++++++++++++++++++----------- 1 file changed, 50 insertions(+), 28 deletions(-) diff --git a/libmamba/src/core/prefix_data.cpp b/libmamba/src/core/prefix_data.cpp index c7031dbaff..50e574506d 100644 --- a/libmamba/src/core/prefix_data.cpp +++ b/libmamba/src/core/prefix_data.cpp @@ -17,6 +17,7 @@ #include "mamba/core/output.hpp" #include "mamba/core/prefix_data.hpp" #include "mamba/core/util.hpp" +#include "mamba/core/util_scope.hpp" #include "mamba/specs/conda_url.hpp" #include "mamba/util/environment.hpp" #include "mamba/util/graph.hpp" @@ -215,37 +216,58 @@ namespace mamba const auto get_python_path = [&] { return util::which_in("python", util::get_path_dirs(m_prefix_path)).string(); }; - const auto args = std::array{ get_python_path(), - "-m", - "pip", - "inspect", - "--local" }; + const auto args = std::array{ get_python_path(), "-q", "-m", "pip", + "inspect", "--local" }; - const std::vector> env{ { "PYTHONIOENCODING", "utf-8" } }; + const std::vector> env{ + { "PYTHONIOENCODING", "utf-8" }, + { "NO_COLOR", "1" }, + { "PIP_NO_COLOR", "1" }, + { "PIP_NO_PYTHON_VERSION_WARNING", "1" }, + }; reproc::options run_options; run_options.env.extra = reproc::env{ env }; - LOG_TRACE << "Running command: " - << fmt::format("{}\n env options:{}", fmt::join(args, " "), fmt::join(env, " ")); - - auto [status, ec] = reproc::run( - args, - run_options, - reproc::sink::string(out), - reproc::sink::string(err) - ); - - if (ec) - { - const auto message = fmt::format( - "failed to run python command :\n error: {}\n command ran: {}\n env options:{}\n-> output:\n{}\n\n-> error output:{}", - ec.message(), - fmt::join(args, " "), - fmt::join(env, " "), - out, - err + { // Scoped environment changes + + // We need FORCE_COLOR to be removed to avoid rich output, + // we restore it as soon as the command is run. + const auto maybe_previous_force_color = util::get_env("FORCE_COLOR"); + util::unset_env("FORCE_COLOR"); + on_scope_exit _{ [&] + { + if (maybe_previous_force_color) + { + util::set_env("FORCE_COLOR", maybe_previous_force_color.value()); + } + } }; + + LOG_TRACE << "Running command: " + << fmt::format( + "{}\n env options (FORCE_COLOR is unset):{}", + fmt::join(args, " "), + fmt::join(env, " ") + ); + + auto [status, ec] = reproc::run( + args, + run_options, + reproc::sink::string(out), + reproc::sink::string(err) ); - throw mamba_error{ message, mamba_error_code::internal_failure }; + + if (ec) + { + const auto message = fmt::format( + "failed to run python command :\n error: {}\n command ran: {}\n env options:{}\n-> output:\n{}\n\n-> error output:{}", + ec.message(), + fmt::join(args, " "), + fmt::join(env, " "), + out, + err + ); + throw mamba_error{ message, mamba_error_code::internal_failure }; + } } // Nothing installed with `pip` @@ -261,11 +283,11 @@ namespace mamba { j = nlohmann::json::parse(out); } - catch (const std::exception& exc) + catch (const std::exception& parse_error) { const auto message = fmt::format( "failed to parse python command output:\n error: {}\n command ran: {}\n env options:{}\n-> output:\n{}\n\n-> error output:{}", - exc.what(), + parse_error.what(), fmt::join(args, " "), fmt::join(env, " "), out, From e4ad1cc6cdcc7e0608b1f4874cc9b8ca74c3af7e Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Wed, 20 Nov 2024 11:36:49 +0000 Subject: [PATCH 112/126] =?UTF-8?q?maint:=20Unify=20`cmake`=20calls=20in?= =?UTF-8?q?=20workflows,=20build=20win=20static=20builds=20in=20p=E2=80=A6?= =?UTF-8?q?=20(#3616)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/conda_canary.yml | 22 ++++++++++------------ .github/workflows/static_build.yml | 8 +++----- .github/workflows/windows_impl.yml | 2 +- 3 files changed, 14 insertions(+), 18 deletions(-) diff --git a/.github/workflows/conda_canary.yml b/.github/workflows/conda_canary.yml index 2e12a75d14..3eade7a640 100644 --- a/.github/workflows/conda_canary.yml +++ b/.github/workflows/conda_canary.yml @@ -52,18 +52,16 @@ jobs: restore-keys: conda-canary- - name: build libmamba Python bindings run: | - mkdir build - cd build - cmake .. -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX \ - -DBUILD_LIBMAMBAPY=ON \ - -DBUILD_LIBMAMBA=ON \ - -DBUILD_SHARED=ON \ - -DBUILD_MAMBA_PACKAGE=ON \ - -DCMAKE_CXX_COMPILER_LAUNCHER=sccache \ - -DCMAKE_C_COMPILER_LAUNCHER=sccache \ - -GNinja - ninja - ninja install + cmake -B build/ -G Ninja \ + -D CMAKE_INSTALL_PREFIX=$CONDA_PREFIX \ + -D BUILD_LIBMAMBAPY=ON \ + -D BUILD_LIBMAMBA=ON \ + -D BUILD_SHARED=ON \ + -D BUILD_MAMBA_PACKAGE=ON \ + -D CMAKE_CXX_COMPILER_LAUNCHER=sccache \ + -D CMAKE_C_COMPILER_LAUNCHER=sccache + cmake --build build/ --parallel + cmake --install build/ - name: install libmambapy run: pip install -e ./libmambapy/ --no-deps - name: build cache statistics diff --git a/.github/workflows/static_build.yml b/.github/workflows/static_build.yml index 9d2c32a9a5..ce65e5e848 100644 --- a/.github/workflows/static_build.yml +++ b/.github/workflows/static_build.yml @@ -167,18 +167,16 @@ jobs: shell: cmd /C call {0} run: | set CMAKE_PREFIX_PATH=.\vcpkg_installed\x64-windows-static-md;%CONDA_PREFIX%\Library - cmake -S . ^ - -B build ^ + cmake -B build/ -G Ninja ^ -D CMAKE_CXX_COMPILER_LAUNCHER=sccache ^ -D CMAKE_C_COMPILER_LAUNCHER=sccache ^ -D CMAKE_MSVC_RUNTIME_LIBRARY="MultiThreadedDLL" ^ -D CMAKE_BUILD_TYPE="Release" ^ -D BUILD_LIBMAMBA=ON ^ -D BUILD_STATIC=ON ^ - -D BUILD_MICROMAMBA=ON ^ - -G "Ninja" + -D BUILD_MICROMAMBA=ON if %errorlevel% neq 0 exit /b %errorlevel% - cmake --build build + cmake --build build/ --parallel if %errorlevel% neq 0 exit /b %errorlevel% sccache --show-stats if %errorlevel% neq 0 exit /b %errorlevel% diff --git a/.github/workflows/windows_impl.yml b/.github/workflows/windows_impl.yml index a3b3ca3cea..f545d5e5bb 100644 --- a/.github/workflows/windows_impl.yml +++ b/.github/workflows/windows_impl.yml @@ -38,7 +38,7 @@ jobs: - name: Build mamba run: | cmake -B build/ -G Ninja ^ - --preset mamba-win-shared-${{ inputs.build_type }} ^ + --preset mamba-win-shared-${{ inputs.build_type }} ^ -D CMAKE_MSVC_RUNTIME_LIBRARY="MultiThreadedDLL" ^ -D CMAKE_CXX_COMPILER_LAUNCHER=sccache ^ -D CMAKE_C_COMPILER_LAUNCHER=sccache ^ From a6a749f1ff5056a4772ceefb525db202c44b94df Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Wed, 20 Nov 2024 11:58:19 +0000 Subject: [PATCH 113/126] maint: Add dependabot config for GitHub workflows/actions (#3614) --- .github/dependabot.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000000..5a5dbe4663 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,15 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file + +version: 2 +updates: + - package-ecosystem: github-actions + directory: / + schedule: + interval: weekly + - package-ecosystem: github-actions + directory: .github/actions/workspace/ + schedule: + interval: weekly From 4f79ad8b78a3e142d8aa0322d198239f88ba75ee Mon Sep 17 00:00:00 2001 From: Cornelius Roemer Date: Wed, 20 Nov 2024 14:51:37 +0100 Subject: [PATCH 114/126] doc: Homebrew currently only installs micromamba v1 (#3499) --- docs/source/installation/micromamba-installation.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docs/source/installation/micromamba-installation.rst b/docs/source/installation/micromamba-installation.rst index 64d4b9148c..ae230eab4b 100644 --- a/docs/source/installation/micromamba-installation.rst +++ b/docs/source/installation/micromamba-installation.rst @@ -25,6 +25,9 @@ On macOS, you can install ``micromamba`` from `Homebrew `_: brew install micromamba +.. hint:: + + (2024-10-03) Homebrew currently only has version 1 of micromamba, not version 2. See https://github.com/mamba-org/mamba/issues/3495 for updates. Mamba-org releases ****************** From bed139622479da69a02a7acffd6746cf88c2c763 Mon Sep 17 00:00:00 2001 From: Jakob Klepp <1183303+truh@users.noreply.github.com> Date: Wed, 20 Nov 2024 15:10:12 +0100 Subject: [PATCH 115/126] Doc: how to install specific Micromamba version (#3517) Co-authored-by: Johan Mabille --- docs/source/installation/micromamba-installation.rst | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/docs/source/installation/micromamba-installation.rst b/docs/source/installation/micromamba-installation.rst index ae230eab4b..2f2ff36562 100644 --- a/docs/source/installation/micromamba-installation.rst +++ b/docs/source/installation/micromamba-installation.rst @@ -55,6 +55,11 @@ On Windows Powershell, use Invoke-Expression ((Invoke-WebRequest -Uri https://micro.mamba.pm/install.ps1).Content) +A specific micromamba release can be installed by setting the ``VERSION`` environment variable. +The release versions contain a build number in addition to the micromamba version. + +Micromamba releases can be found on Github: https://github.com/mamba-org/micromamba-releases/releases + Self updates ^^^^^^^^^^^^ Once installed, ``micromamba`` can be updated with From c0ce48bebe43c761b6d050be83a70197111f197e Mon Sep 17 00:00:00 2001 From: Cornelius Roemer Date: Wed, 20 Nov 2024 15:24:31 +0100 Subject: [PATCH 116/126] doc: show how to use advanced match specs in yaml spec (#3384) Co-authored-by: Johan Mabille --- docs/source/user_guide/micromamba.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/source/user_guide/micromamba.rst b/docs/source/user_guide/micromamba.rst index b92b0cc281..ad1fc7640c 100644 --- a/docs/source/user_guide/micromamba.rst +++ b/docs/source/user_guide/micromamba.rst @@ -156,7 +156,7 @@ More powerful are ``YAML`` files like the following, because they already contai dependencies: - python >=3.6,<3.7 - ipykernel >=5.1 - - ipywidgets + - ipywidgets[build_number=!=0] They are used the same way as text files: From d4de99bfef0658a40b3fda0360ca0f6f1eae4e07 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Klaim=20=28Jo=C3=ABl=20Lamotte=29?= <142265+Klaim@users.noreply.github.com> Date: Wed, 20 Nov 2024 18:09:27 +0100 Subject: [PATCH 117/126] fixed: incorrect erasing of env vars (#3622) --- libmamba/src/core/activation.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/libmamba/src/core/activation.cpp b/libmamba/src/core/activation.cpp index 46169e7fbb..29f999b591 100644 --- a/libmamba/src/core/activation.cpp +++ b/libmamba/src/core/activation.cpp @@ -554,10 +554,14 @@ namespace mamba auto conda_environment_env_vars = get_environment_vars(prefix); // TODO check with conda if that's really what's supposed to happen ... - std::remove_if( - conda_environment_env_vars.begin(), - conda_environment_env_vars.end(), - [](auto& el) { return el.second == CONDA_ENV_VARS_UNSET_VAR; } + // TODO: C++20 replace by `std::erase_if` + conda_environment_env_vars.erase( + std::remove_if( + conda_environment_env_vars.begin(), + conda_environment_env_vars.end(), + [](auto& el) { return el.second == CONDA_ENV_VARS_UNSET_VAR; } + ), + conda_environment_env_vars.end() ); std::vector clobbering_env_vars; From 7b0a957dc0406722de0ce12780865be7ddce9c9b Mon Sep 17 00:00:00 2001 From: Julien Jerphanion Date: Thu, 21 Nov 2024 11:27:52 +0100 Subject: [PATCH 118/126] feat: List PyPI packages in environment export (#3623) Signed-off-by: Julien Jerphanion Co-authored-by: Johan Mabille Co-authored-by: Ayaz Salikhov --- micromamba/src/env.cpp | 30 ++++++++++++++++++++++++++++-- micromamba/tests/test_env.py | 35 +++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+), 2 deletions(-) diff --git a/micromamba/src/env.cpp b/micromamba/src/env.cpp index d17e3b4e71..8b636596f7 100644 --- a/micromamba/src/env.cpp +++ b/micromamba/src/env.cpp @@ -180,6 +180,7 @@ set_env_command(CLI::App* com, Configuration& config) History& hist = pd.history(); const auto& versions_map = pd.records(); + const auto& pip_versions_map = pd.pip_records(); auto requested_specs_map = hist.get_requested_specs_map(); std::stringstream dependencies; std::set channels; @@ -227,6 +228,21 @@ set_env_command(CLI::App* com, Configuration& config) channels.insert(chan.display_name()); } } + + // Add a `pip` subsection in `dependencies` listing wheels installed from PyPI + if (!pip_versions_map.empty()) + { + dependencies << (first_dependency_printed ? ",\n" : "") << " { \"pip\": [\n"; + first_dependency_printed = false; + for (const auto& [k, v] : pip_versions_map) + { + dependencies << (first_dependency_printed ? ",\n" : "") << " \"" + << v.name << "==" << v.version << "\""; + first_dependency_printed = true; + } + dependencies << "\n ]\n }"; + } + dependencies << (first_dependency_printed ? "\n" : ""); std::cout << "{\n"; @@ -255,6 +271,7 @@ set_env_command(CLI::App* com, Configuration& config) History& hist = pd.history(); const auto& versions_map = pd.records(); + const auto& pip_versions_map = pd.pip_records(); std::cout << "name: " << get_env_name(ctx, ctx.prefix_params.target_prefix) << "\n"; std::cout << "channels:\n"; @@ -278,7 +295,7 @@ set_env_command(CLI::App* com, Configuration& config) } else { - dependencies << "- "; + dependencies << " - "; if (channel_subdir) { dependencies @@ -303,10 +320,19 @@ set_env_command(CLI::App* com, Configuration& config) channels.insert(chan.display_name()); } } + // Add a `pip` subsection in `dependencies` listing wheels installed from PyPI + if (!pip_versions_map.empty()) + { + dependencies << " - pip:\n"; + for (const auto& [k, v] : pip_versions_map) + { + dependencies << " - " << v.name << "==" << v.version << "\n"; + } + } for (const auto& c : channels) { - std::cout << "- " << c << "\n"; + std::cout << " - " << c << "\n"; } std::cout << "dependencies:\n" << dependencies.str() << std::endl; diff --git a/micromamba/tests/test_env.py b/micromamba/tests/test_env.py index db443a44b0..e6785407dd 100644 --- a/micromamba/tests/test_env.py +++ b/micromamba/tests/test_env.py @@ -484,3 +484,38 @@ def test_env_update_empty_base(tmp_home, tmp_root_prefix, tmp_path): packages = helpers.umamba_list("-p", env_prefix, "--json") assert any(package["name"] == "xtensor" for package in packages) assert any(package["name"] == "python" for package in packages) + + +env_yaml_content_env_export_with_pip = """ +channels: +- conda-forge +dependencies: +- pip +- pip: + - requests==2.32.3 +""" + + +@pytest.mark.parametrize("json_flag", [None, "--json"]) +def test_env_export_with_pip(tmp_path, json_flag): + env_name = "env_export_with_pip" + + env_file_yml = tmp_path / "test_env_yaml_content_to_install_requests_with_pip.yaml" + env_file_yml.write_text(env_yaml_content_env_export_with_pip) + + flags = list(filter(None, [json_flag])) + helpers.create("-n", env_name, "-f", env_file_yml, no_dry_run=True) + + output = helpers.run_env("export", "-n", env_name, *flags) + + # JSON is already parsed + ret = output if json_flag else yaml.safe_load(output) + + assert ret["name"] == env_name + assert env_name in ret["prefix"] + assert set(ret["channels"]) == {"conda-forge"} + + pip_section = next( + dep for dep in ret["dependencies"] if isinstance(dep, dict) and ["pip"] == [*dep] + ) + assert pip_section["pip"] == ["requests==2.32.3"] From ebe0d4f89c93b39f354942bd96f70212ca9c47cf Mon Sep 17 00:00:00 2001 From: Hind-M <70631848+Hind-M@users.noreply.github.com> Date: Thu, 21 Nov 2024 11:38:40 +0100 Subject: [PATCH 119/126] Fix build trailing `*` display (#3619) --- libmamba/src/solver/problems_graph.cpp | 40 +++++++++++-------- .../tests/src/solver/libsolv/test_solver.cpp | 28 +++++++++++++ 2 files changed, 51 insertions(+), 17 deletions(-) diff --git a/libmamba/src/solver/problems_graph.cpp b/libmamba/src/solver/problems_graph.cpp index 25cf5ca7f2..e07a036371 100644 --- a/libmamba/src/solver/problems_graph.cpp +++ b/libmamba/src/solver/problems_graph.cpp @@ -1322,18 +1322,28 @@ namespace mamba::solver return arr; } - auto rstrip_excessive_free(std::string_view str) -> std::string_view - { - str = util::rstrip(str); - str = util::remove_suffix(str, specs::GlobSpec::free_pattern); - str = util::rstrip(str); - for (const auto& suffix : sorted_suffix(specs::VersionSpec::all_free_strs)) - { - str = util::remove_suffix(str, suffix); - } - str = util::rstrip(str); - return str; - } + // Single dependency with only name constraint often end up looking like + // ``python =* *`` so `rstrip_excessive_free` was used to strip all this. + // Best would be to handle this with a richer NamedList that contains + // ``VersionSpecs`` to avoid flaky reliance on string modification. + + // As `rstrip_excessive_free` side effect was to strip `*` from a regex, + // (which is not wanted and confusing when trying to understand the + // unsolvability problems), it is not used anymore on `vers_builds_trunc`. + // But we still keep it uncommented for a while (in case we need to + // restore it later). + // auto rstrip_excessive_free(std::string_view str) -> std::string_view + // { + // str = util::rstrip(str); + // str = util::remove_suffix(str, specs::GlobSpec::free_pattern); + // str = util::rstrip(str); + // for (const auto& suffix : sorted_suffix(specs::VersionSpec::all_free_strs)) + // { + // str = util::remove_suffix(str, suffix); + // } + // str = util::rstrip(str); + // return str; + // } void TreeExplainer::write_pkg_dep(const TreeNode& tn) { @@ -1348,11 +1358,7 @@ namespace mamba::solver } else { - // Single dependency with only name constraint often end up looking like - // ``python =* *`` so we strip all this. - // Best would be to handle this with a richer NamedList that contains - // ``VersionSpecs`` to avoid flaky reliance on string modification. - const auto relevant_vers_builds_trunc = rstrip_excessive_free(vers_builds_trunc); + const auto relevant_vers_builds_trunc = vers_builds_trunc; if (relevant_vers_builds_trunc.empty()) { write(fmt::format(style, "{}", edges.name())); diff --git a/libmamba/tests/src/solver/libsolv/test_solver.cpp b/libmamba/tests/src/solver/libsolv/test_solver.cpp index 63b35ce07d..87aa6cb673 100644 --- a/libmamba/tests/src/solver/libsolv/test_solver.cpp +++ b/libmamba/tests/src/solver/libsolv/test_solver.cpp @@ -1097,5 +1097,33 @@ TEST_SUITE("solver::libsolv::solver") CHECK_EQ(std::get(solution.actions.front()).install.build_string, "bld"); CHECK_EQ(std::get(solution.actions.front()).install.build_number, 4); } + + SUBCASE("foo[version='=*,=*', build='pyhd*']") + { + auto pkg = PackageInfo("foo"); + pkg.version = "=*,=*"; + pkg.build_string = "pyhd*"; + + db.add_repo_from_packages(std::array{ pkg }); + + auto request = Request{ + /* .flags= */ {}, + /* .jobs= */ { Request::Install{ "foo[version='=*,=*', build='pyhd*']"_ms } }, + }; + const auto outcome = libsolv::Solver().solve(db, request); + + REQUIRE(outcome.has_value()); + REQUIRE(std::holds_alternative(outcome.value())); + + const auto& unsolvable = std::get(outcome.value()); + const auto problems_explained = unsolvable.explain_problems(db, {}); + // To avoid mismatch due to color formatting, we perform the check by splitting the + // output following the format + CHECK(util::contains(problems_explained, "foo =*,=* pyhd*")); + CHECK(util::contains( + problems_explained, + "does not exist (perhaps a typo or a missing channel)." + )); + } } } From feafaf0e9601096042136be86c8a8ee9325b1235 Mon Sep 17 00:00:00 2001 From: Hind Montassif Date: Thu, 21 Nov 2024 13:02:28 +0100 Subject: [PATCH 120/126] release libmamba 2.0.4alpha3, libmambapy 2.0.4alpha3, micromamba 2.0.4alpha3 --- CHANGELOG.md | 27 +++++++++++++++++++++++++++ libmamba/CHANGELOG.md | 21 +++++++++++++++++++++ libmambapy/CHANGELOG.md | 14 ++++++++++++++ micromamba/CHANGELOG.md | 21 +++++++++++++++++++++ 4 files changed, 83 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5fae4896d9..4b6f641216 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,30 @@ +2024.11.21 +========== + +Releases: libmamba 2.0.4alpha3, libmambapy 2.0.4alpha3, micromamba 2.0.4alpha3 + +Enhancements: + +- [micromamba] feat: List PyPI packages in environment export by @jjerphan in https://github.com/mamba-org/mamba/pull/3623 + +Bug fixes: + +- [libmamba] Fix build trailing `*` display by @Hind-M in https://github.com/mamba-org/mamba/pull/3619 +- [libmamba] fixed: incorrect erasing of env vars by @Klaim in https://github.com/mamba-org/mamba/pull/3622 +- [libmamba] Prevent pip "rich" ouput by @Klaim in https://github.com/mamba-org/mamba/pull/3607 +- [micromamba, libmamba] maint: Address compiler warnings by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3605 +- [micromamba] fix: Export `'channels'` as part of environments' export by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3587 + +CI fixes and doc: + +- [all] doc: show how to use advanced match specs in yaml spec by @corneliusroemer in https://github.com/mamba-org/mamba/pull/3384 +- [all] Doc: how to install specific Micromamba version by @truh in https://github.com/mamba-org/mamba/pull/3517 +- [all] doc: Homebrew currently only installs micromamba v1 by @corneliusroemer in https://github.com/mamba-org/mamba/pull/3499 +- [all] maint: Add dependabot config for GitHub workflows/actions by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3614 +- [all] maint: Unify `cmake` calls in workflows, build win static builds in p… by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3616 +- [all] docs: Update pieces of documentation after the release of mamba 2 by @jjerphan in https://github.com/mamba-org/mamba/pull/3610 +- [libmambapy, libmamba] maint: Update clang-format to v19 by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3600 + 2024.11.14 ========== diff --git a/libmamba/CHANGELOG.md b/libmamba/CHANGELOG.md index 01e0133965..3174d1ea0d 100644 --- a/libmamba/CHANGELOG.md +++ b/libmamba/CHANGELOG.md @@ -1,3 +1,24 @@ +libmamba 2.0.4alpha3 (November 21, 2024) +======================================== + + +Bug fixes: + +- Fix build trailing `*` display by @Hind-M in https://github.com/mamba-org/mamba/pull/3619 +- fixed: incorrect erasing of env vars by @Klaim in https://github.com/mamba-org/mamba/pull/3622 +- Prevent pip "rich" ouput by @Klaim in https://github.com/mamba-org/mamba/pull/3607 +- maint: Address compiler warnings by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3605 + +CI fixes and doc: + +- doc: show how to use advanced match specs in yaml spec by @corneliusroemer in https://github.com/mamba-org/mamba/pull/3384 +- Doc: how to install specific Micromamba version by @truh in https://github.com/mamba-org/mamba/pull/3517 +- doc: Homebrew currently only installs micromamba v1 by @corneliusroemer in https://github.com/mamba-org/mamba/pull/3499 +- maint: Add dependabot config for GitHub workflows/actions by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3614 +- maint: Unify `cmake` calls in workflows, build win static builds in p… by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3616 +- docs: Update pieces of documentation after the release of mamba 2 by @jjerphan in https://github.com/mamba-org/mamba/pull/3610 +- maint: Update clang-format to v19 by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3600 + libmamba 2.0.4alpha2 (November 14, 2024) ======================================== diff --git a/libmambapy/CHANGELOG.md b/libmambapy/CHANGELOG.md index b341f0634d..1bdc2f21d7 100644 --- a/libmambapy/CHANGELOG.md +++ b/libmambapy/CHANGELOG.md @@ -1,3 +1,17 @@ +libmambapy 2.0.4alpha3 (November 21, 2024) +========================================== + + +CI fixes and doc: + +- doc: show how to use advanced match specs in yaml spec by @corneliusroemer in https://github.com/mamba-org/mamba/pull/3384 +- Doc: how to install specific Micromamba version by @truh in https://github.com/mamba-org/mamba/pull/3517 +- doc: Homebrew currently only installs micromamba v1 by @corneliusroemer in https://github.com/mamba-org/mamba/pull/3499 +- maint: Add dependabot config for GitHub workflows/actions by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3614 +- maint: Unify `cmake` calls in workflows, build win static builds in p… by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3616 +- docs: Update pieces of documentation after the release of mamba 2 by @jjerphan in https://github.com/mamba-org/mamba/pull/3610 +- maint: Update clang-format to v19 by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3600 + libmambapy 2.0.4alpha2 (November 14, 2024) ========================================== diff --git a/micromamba/CHANGELOG.md b/micromamba/CHANGELOG.md index 419fa87901..36632a1868 100644 --- a/micromamba/CHANGELOG.md +++ b/micromamba/CHANGELOG.md @@ -1,3 +1,24 @@ +micromamba 2.0.4alpha3 (November 21, 2024) +========================================== + +Enhancements: + +- feat: List PyPI packages in environment export by @jjerphan in https://github.com/mamba-org/mamba/pull/3623 + +Bug fixes: + +- maint: Address compiler warnings by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3605 +- fix: Export `'channels'` as part of environments' export by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3587 + +CI fixes and doc: + +- doc: show how to use advanced match specs in yaml spec by @corneliusroemer in https://github.com/mamba-org/mamba/pull/3384 +- Doc: how to install specific Micromamba version by @truh in https://github.com/mamba-org/mamba/pull/3517 +- doc: Homebrew currently only installs micromamba v1 by @corneliusroemer in https://github.com/mamba-org/mamba/pull/3499 +- maint: Add dependabot config for GitHub workflows/actions by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3614 +- maint: Unify `cmake` calls in workflows, build win static builds in p… by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3616 +- docs: Update pieces of documentation after the release of mamba 2 by @jjerphan in https://github.com/mamba-org/mamba/pull/3610 + micromamba 2.0.4alpha2 (November 14, 2024) ========================================== From 0a8128d23eef2d23abacd194692e112f1c25b820 Mon Sep 17 00:00:00 2001 From: Ayaz Salikhov Date: Thu, 21 Nov 2024 12:50:09 +0000 Subject: [PATCH 121/126] maint: Enable `-Werror` compiler flag for GCC, Clang and AppleClang (#3611) --- CMakeLists.txt | 6 ++++- cmake/CompilerWarnings.cmake | 15 +++++++++++ libmamba/CMakeLists.txt | 8 ++++++ libmamba/ext/solv-cpp/src/pool.cpp | 11 ++++++++ libmamba/include/mamba/util/conditional.hpp | 4 +-- libmamba/src/core/run.cpp | 11 ++++++++ libmamba/src/core/thread_utils.cpp | 30 ++++++++++++++++----- libmamba/src/core/util.cpp | 11 ++++++++ libmamba/src/solver/libsolv/matcher.cpp | 2 +- libmamba/src/solver/problems_graph.cpp | 10 +++++++ libmambapy/CMakeLists.txt | 8 ++++++ 11 files changed, 105 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 972f95df1b..9786aad45a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,7 +19,11 @@ option(BUILD_LIBMAMBA_TESTS "Build libmamba C++ tests" OFF) option(BUILD_MAMBA "Build mamba" OFF) option(BUILD_MICROMAMBA "Build micromamba" OFF) option(BUILD_MAMBA_PACKAGE "Build mamba package utility" OFF) -option(MAMBA_WARNING_AS_ERROR "Treat compiler warnings as errors" OFF) +if(MSVC) + option(MAMBA_WARNING_AS_ERROR "Treat compiler warnings as errors" OFF) +else() + option(MAMBA_WARNING_AS_ERROR "Treat compiler warnings as errors" ON) +endif() set( MAMBA_LTO "Default" diff --git a/cmake/CompilerWarnings.cmake b/cmake/CompilerWarnings.cmake index 61ccbca8ea..c9e5d327de 100644 --- a/cmake/CompilerWarnings.cmake +++ b/cmake/CompilerWarnings.cmake @@ -109,6 +109,21 @@ function(mamba_target_add_compile_warnings target) -Wuninitialized ) + # It seems that these flags are leaked to CXXFLAGS: `-framework CoreFoundation` `-framework + # CoreServices` `-framework Security` `-framework Kerberos` `-fno-merge-constants` + # + # These flags give compiler warnings/errors: `unused-command-line-argument` and + # `ignored-optimization-argument` So we disable these warnings/errors for all the files + # + # This might be happening during `conda-build` and might be a bug in + # https://github.com/conda-forge/clang-compiler-activation-feedstock + if(APPLE AND CMAKE_CXX_COMPILER_ID STREQUAL "Clang") + set( + clang_warnings + ${clang_warnings} -Wno-unused-command-line-argument -Wno-ignored-optimization-argument + ) + endif() + if(${ARG_WARNING_AS_ERROR}) set(clang_warnings ${clang_warnings} -Werror) set(msvc_warnings ${msvc_warnings} /WX) diff --git a/libmamba/CMakeLists.txt b/libmamba/CMakeLists.txt index faf54a113e..cc77f6546d 100644 --- a/libmamba/CMakeLists.txt +++ b/libmamba/CMakeLists.txt @@ -264,6 +264,14 @@ set( ${LIBMAMBA_SOURCE_DIR}/api/shell.cpp ${LIBMAMBA_SOURCE_DIR}/api/update.cpp ) +# TODO: remove when switch to C++20 +if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") + # This file uses capturing structured bindings, which was fixed in C++20 + set_source_files_properties( + ${LIBMAMBA_SOURCE_DIR}/download/mirror_impl.cpp + PROPERTIES COMPILE_FLAGS -Wno-c++20-extensions + ) +endif() foreach(script ${SHELL_SCRIPTS}) list(APPEND LIBMAMBA_SOURCES shell_scripts/${script}.cpp) diff --git a/libmamba/ext/solv-cpp/src/pool.cpp b/libmamba/ext/solv-cpp/src/pool.cpp index bf2f7bc898..9928fc46a4 100644 --- a/libmamba/ext/solv-cpp/src/pool.cpp +++ b/libmamba/ext/solv-cpp/src/pool.cpp @@ -93,10 +93,21 @@ namespace solv namespace { +// This function is only used in `assert()` expressions +// That's why it might get reported as unused in Release builds +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-function" +#endif + auto is_reldep(::Id id) -> bool { return ISRELDEP(static_cast>(id)) != 0; } + +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif } auto ObjPoolView::get_string(StringId id) const -> std::string_view diff --git a/libmamba/include/mamba/util/conditional.hpp b/libmamba/include/mamba/util/conditional.hpp index 7882e53218..5db28cc4c1 100644 --- a/libmamba/include/mamba/util/conditional.hpp +++ b/libmamba/include/mamba/util/conditional.hpp @@ -31,9 +31,7 @@ namespace mamba::util } else { - using int_t = Int; - return static_cast(condition) * true_val - + (int_t(1) - static_cast(condition)) * false_val; + return condition ? true_val : false_val; } } } diff --git a/libmamba/src/core/run.cpp b/libmamba/src/core/run.cpp index 9644fcba48..10ab92847a 100644 --- a/libmamba/src/core/run.cpp +++ b/libmamba/src/core/run.cpp @@ -186,6 +186,13 @@ namespace mamba return !other_processes_with_same_name.empty(); } +// This ctor only uses proc_dir_lock in `assert()` expression +// That's why it might get reported as unused in Release builds +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" +#endif + ScopedProcFile::ScopedProcFile( const Context& context, const std::string& name, @@ -217,6 +224,10 @@ namespace mamba pid_file << file_json; } +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif + ScopedProcFile::~ScopedProcFile() { const auto lock = lock_proc_dir(); diff --git a/libmamba/src/core/thread_utils.cpp b/libmamba/src/core/thread_utils.cpp index 8c847cc482..89e093e0dc 100644 --- a/libmamba/src/core/thread_utils.cpp +++ b/libmamba/src/core/thread_utils.cpp @@ -29,6 +29,29 @@ namespace mamba #ifndef _WIN32 namespace { +#if defined(__APPLE__) && defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wsign-conversion" +#endif + + // `sigaddset` might be implemented as a macro calling `__sigbits(int)` function + // At the same time `sigset_t` might be `unsigned int` + // This causes compiler warning + sigset_t get_sigset() + { + // block signals in this thread and subsequently + // spawned threads + sigset_t sigset; + sigemptyset(&sigset); + sigaddset(&sigset, SIGINT); + // sigaddset(&sigset, SIGTERM); + return sigset; + } + +#if defined(__APPLE__) && defined(__GNUC__) +#pragma GCC diagnostic pop +#endif + std::thread::native_handle_type sig_recv_thread; std::atomic receiver_exists(false); } @@ -74,12 +97,7 @@ namespace mamba { stop_receiver_thread(); - // block signals in this thread and subsequently - // spawned threads - sigset_t sigset; - sigemptyset(&sigset); - sigaddset(&sigset, SIGINT); - // sigaddset(&sigset, SIGTERM); + sigset_t sigset = get_sigset(); pthread_sigmask(SIG_BLOCK, &sigset, nullptr); std::thread receiver(handler, sigset); sig_recv_thread = receiver.native_handle(); diff --git a/libmamba/src/core/util.cpp b/libmamba/src/core/util.cpp index ac4fe48135..2f8c7c5197 100644 --- a/libmamba/src/core/util.cpp +++ b/libmamba/src/core/util.cpp @@ -971,6 +971,13 @@ namespace mamba << "'"; } +// This function is only used in `assert()` expressions +// That's why it might get reported as unused in Release builds +#if defined(__GNUC__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-function" +#endif + bool is_lockfile_locked(const LockFileOwner& lockfile) { #ifdef _WIN32 @@ -981,6 +988,10 @@ namespace mamba #endif } +#if defined(__GNUC__) +#pragma GCC diagnostic pop +#endif + class LockedFilesRegistry { public: diff --git a/libmamba/src/solver/libsolv/matcher.cpp b/libmamba/src/solver/libsolv/matcher.cpp index 354bde52ca..6751e2ec1a 100644 --- a/libmamba/src/solver/libsolv/matcher.cpp +++ b/libmamba/src/solver/libsolv/matcher.cpp @@ -193,7 +193,7 @@ namespace mamba::solver::libsolv return { std::cref(it->second) }; } - return specs::Channel::resolve(std::move(uc), channel_params()) + return specs::Channel::resolve(uc, channel_params()) .transform( [&](channel_list&& chan) { diff --git a/libmamba/src/solver/problems_graph.cpp b/libmamba/src/solver/problems_graph.cpp index e07a036371..d1da0a4984 100644 --- a/libmamba/src/solver/problems_graph.cpp +++ b/libmamba/src/solver/problems_graph.cpp @@ -264,6 +264,12 @@ namespace mamba::solver return CompressedProblemsGraph::NamedList(tmp.begin(), tmp.end()); } +// GCC reports dangling reference when using std::invoke with data members +#if defined(__GNUC__) && !defined(__clang__) +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wdangling-reference" +#endif + template auto invoke_version(T&& e) -> decltype(auto) { @@ -328,6 +334,10 @@ namespace mamba::solver } } +#if defined(__GNUC__) && !defined(__clang__) +#pragma GCC diagnostic pop +#endif + /** * Detect if a type has a ``name`` member (function). */ diff --git a/libmambapy/CMakeLists.txt b/libmambapy/CMakeLists.txt index e644962076..c1535f8516 100644 --- a/libmambapy/CMakeLists.txt +++ b/libmambapy/CMakeLists.txt @@ -32,6 +32,14 @@ pybind11_add_module( src/libmambapy/bindings/solver.cpp src/libmambapy/bindings/solver_libsolv.cpp ) +# TODO: remove when `SubdirData::cache_path()` is removed +if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") + # This file uses capturing structured bindings, which was fixed in C++20 + set_source_files_properties( + src/libmambapy/bindings/legacy.cpp + PROPERTIES COMPILE_FLAGS -Wno-error=deprecated-declarations + ) +endif() target_include_directories(bindings PRIVATE src/libmambapy/bindings) From 020b1163c69b2e3fb4d1205c5cf52592c3219d15 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Thu, 21 Nov 2024 10:39:07 -0500 Subject: [PATCH 122/126] fix: support homebrew/linuxbrew (AppleClang, GCC 11) (#3613) Signed-off-by: Henry Schreiner --- libmamba/CMakeLists.txt | 3 + libmamba/ext/solv-cpp/CMakeLists.txt | 1 + libmamba/include/mamba/specs/channel.hpp | 101 ++++++++++++----------- libmamba/src/core/transaction.cpp | 3 +- libmamba/src/solver/problems_graph.cpp | 4 +- 5 files changed, 59 insertions(+), 53 deletions(-) diff --git a/libmamba/CMakeLists.txt b/libmamba/CMakeLists.txt index cc77f6546d..5fe133ceb6 100644 --- a/libmamba/CMakeLists.txt +++ b/libmamba/CMakeLists.txt @@ -617,6 +617,9 @@ macro(libmamba_create_target target_name linkage output_name) solv::libsolvext solv::cpp ) + # CMake 3.17 provides a LibArchive::LibArchive target that could be used instead of + # LIBRARIES/INCLUDE_DIRS + target_include_directories(${target_name} PRIVATE "${LibArchive_INCLUDE_DIRS}") endif() if(WIN32) diff --git a/libmamba/ext/solv-cpp/CMakeLists.txt b/libmamba/ext/solv-cpp/CMakeLists.txt index 4af07a432a..8934098b4b 100644 --- a/libmamba/ext/solv-cpp/CMakeLists.txt +++ b/libmamba/ext/solv-cpp/CMakeLists.txt @@ -20,6 +20,7 @@ find_package(Libsolv REQUIRED) if(BUILD_SHARED) set(LIBSOLV_DEPS solv::libsolv solv::libsolvext) + set_target_properties(solv-cpp PROPERTIES POSITION_INDEPENDENT_CODE ON) else() set(LIBSOLV_DEPS solv::libsolv_static solv::libsolvext_static) endif() diff --git a/libmamba/include/mamba/specs/channel.hpp b/libmamba/include/mamba/specs/channel.hpp index f3bdc23ff4..26e829a728 100644 --- a/libmamba/include/mamba/specs/channel.hpp +++ b/libmamba/include/mamba/specs/channel.hpp @@ -22,61 +22,15 @@ namespace mamba::specs { - class Channel; - - struct ChannelResolveParams - { - /** - * The weakener for @ref ResolveParams::custom_channels. - */ - struct NameWeakener - { - /** - * Return the key unchanged. - */ - [[nodiscard]] auto make_first_key(std::string_view key) const -> std::string_view; - - /** - * Remove the last element of the '/'-separated name. - */ - [[nodiscard]] auto weaken_key(std::string_view key) const - -> std::optional; - }; - - template - using name_map = util::weakening_map, NameWeakener>; - - using platform_list = util::flat_set; - using channel_list = std::vector; - using channel_map = name_map; - using multichannel_map = name_map; - - platform_list platforms = {}; - CondaURL channel_alias = {}; - channel_map custom_channels = {}; - multichannel_map custom_multichannels = {}; - AuthenticationDataBase authentication_db = {}; - std::string home_dir = {}; - std::string current_working_dir = {}; - }; - - struct ChannelResolveParamsView - { - const ChannelResolveParams::platform_list& platforms = {}; - const CondaURL& channel_alias = {}; - const ChannelResolveParams::channel_map& custom_channels = {}; - const ChannelResolveParams::multichannel_map& custom_multichannels = {}; - const AuthenticationDataBase& authentication_db = {}; - std::string_view home_dir = {}; - std::string_view current_working_dir = {}; - }; + struct ChannelResolveParams; + struct ChannelResolveParamsView; class Channel { public: - using platform_list = ChannelResolveParams::platform_list; - using channel_list = ChannelResolveParams::channel_list; + using platform_list = util::flat_set; + using channel_list = std::vector; [[nodiscard]] static auto resolve( // UnresolvedChannel uc, @@ -145,6 +99,53 @@ namespace mamba::specs util::flat_set m_platforms; }; + struct ChannelResolveParams + { + /** + * The weakener for @ref ResolveParams::custom_channels. + */ + struct NameWeakener + { + /** + * Return the key unchanged. + */ + [[nodiscard]] auto make_first_key(std::string_view key) const -> std::string_view; + + /** + * Remove the last element of the '/'-separated name. + */ + [[nodiscard]] auto weaken_key(std::string_view key) const + -> std::optional; + }; + + template + using name_map = util::weakening_map, NameWeakener>; + + using platform_list = util::flat_set; + using channel_list = std::vector; + using channel_map = name_map; + using multichannel_map = name_map; + + platform_list platforms = {}; + CondaURL channel_alias = {}; + channel_map custom_channels = {}; + multichannel_map custom_multichannels = {}; + AuthenticationDataBase authentication_db = {}; + std::string home_dir = {}; + std::string current_working_dir = {}; + }; + + struct ChannelResolveParamsView + { + const ChannelResolveParams::platform_list& platforms = {}; + const CondaURL& channel_alias = {}; + const ChannelResolveParams::channel_map& custom_channels = {}; + const ChannelResolveParams::multichannel_map& custom_multichannels = {}; + const AuthenticationDataBase& authentication_db = {}; + std::string_view home_dir = {}; + std::string_view current_working_dir = {}; + }; + /** Tuple-like equality of all observable members */ auto operator==(const Channel& a, const Channel& b) -> bool; auto operator!=(const Channel& a, const Channel& b) -> bool; diff --git a/libmamba/src/core/transaction.cpp b/libmamba/src/core/transaction.cpp index 7d2f766896..6daa990a12 100644 --- a/libmamba/src/core/transaction.cpp +++ b/libmamba/src/core/transaction.cpp @@ -698,7 +698,8 @@ namespace mamba it != extract_tasks.end(); ++it) { - std::packaged_task task{ [=] { return it->run(); } }; + std::packaged_task task{ [=] + { return it->run(); } }; extract_trackers.push_back(task.get_future()); MainExecutor::instance().schedule(std::move(task)); } diff --git a/libmamba/src/solver/problems_graph.cpp b/libmamba/src/solver/problems_graph.cpp index d1da0a4984..e19d8c0597 100644 --- a/libmamba/src/solver/problems_graph.cpp +++ b/libmamba/src/solver/problems_graph.cpp @@ -265,7 +265,7 @@ namespace mamba::solver } // GCC reports dangling reference when using std::invoke with data members -#if defined(__GNUC__) && !defined(__clang__) +#if defined(__GNUC__) && !defined(__clang__) && __GNUC__ >= 13 #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wdangling-reference" #endif @@ -334,7 +334,7 @@ namespace mamba::solver } } -#if defined(__GNUC__) && !defined(__clang__) +#if defined(__GNUC__) && !defined(__clang__) && __GNUC__ >= 13 #pragma GCC diagnostic pop #endif From fcb007a9814c567dbe130bd592bb071d02d8cbe1 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Thu, 21 Nov 2024 12:11:46 -0500 Subject: [PATCH 123/126] ci: add brew toolchain test (#3625) Signed-off-by: Henry Schreiner Co-authored-by: Julien Jerphanion --- .github/workflows/brew.yml | 47 +++++++++++++++++++++++++++++++++++++ .github/workflows/tests.yml | 4 ++++ 2 files changed, 51 insertions(+) create mode 100644 .github/workflows/brew.yml diff --git a/.github/workflows/brew.yml b/.github/workflows/brew.yml new file mode 100644 index 0000000000..2a451fdec2 --- /dev/null +++ b/.github/workflows/brew.yml @@ -0,0 +1,47 @@ +name: Homebrew and Linuxbrew toolchains + +on: + workflow_call: + +jobs: + build_linuxbrew: + name: Build on linuxbrew + runs-on: ubuntu-latest + container: + image: homebrew/brew:latest + + steps: + # v1 required due to permissions error + - name: Checkout mamba repository + uses: actions/checkout@v1 + + - name: Correct the creation permissions + run: sudo chown -R linuxbrew . + + - name: Install host and build dependencies + run: brew install fmt libarchive libsolv lz4 openssl@3 reproc simdjson xz yaml-cpp zstd cmake cli11 nlohmann-json spdlog tl-expected curl pkgconfig python bzip2 krb5 zlib + + - name: Configure to build mamba + run: cmake -S. -Bbuild -DBUILD_LIBMAMBA=ON -DBUILD_MAMBA=ON -DBUILD_SHARED=ON -DBUILD_STATIC=OFF + + - name: Build mamba + run: cmake --build build -j4 + + build_homebrew: + name: Build on homebrew + runs-on: macos-13 + + steps: + - name: Checkout mamba repository + uses: actions/checkout@v4 + + - name: Install host and build dependencies + run: brew install fmt libarchive libsolv lz4 openssl@3 reproc simdjson xz yaml-cpp zstd cmake cli11 nlohmann-json spdlog tl-expected pkgconfig python + + - name: Configure to build mamba + run: > + cmake -S. -Bbuild -DBUILD_LIBMAMBA=ON -DBUILD_MAMBA=ON -DBUILD_SHARED=ON -DBUILD_STATIC=OFF + -DLibArchive_ROOT=$(brew --prefix libarchive) + + - name: Build mamba + run: cmake --build build -j4 diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b66a4b254d..68483a940b 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -42,3 +42,7 @@ jobs: with: os: ${{ matrix.os }} build_type: ${{ matrix.build_type }} + + brew_tests: + name: Homebrew and Linuxbrew toolchains + uses: ./.github/workflows/brew.yml From b163ce9027b4583e97e2ff801690e3fc0da7cf31 Mon Sep 17 00:00:00 2001 From: Julien Jerphanion Date: Fri, 22 Nov 2024 15:23:27 +0100 Subject: [PATCH 124/126] fix: Return JSON on environment creation dry run (#3627) Signed-off-by: Julien Jerphanion --- libmamba/src/api/create.cpp | 18 ++++++++++++++++++ micromamba/tests/test_create.py | 15 +++++++++++++++ 2 files changed, 33 insertions(+) diff --git a/libmamba/src/api/create.cpp b/libmamba/src/api/create.cpp index 835f244f56..ca25db2ab1 100644 --- a/libmamba/src/api/create.cpp +++ b/libmamba/src/api/create.cpp @@ -4,6 +4,8 @@ // // The full license is in the file LICENSE, distributed with this software. +#include + #include "mamba/api/configuration.hpp" #include "mamba/api/create.hpp" #include "mamba/api/install.hpp" @@ -29,6 +31,7 @@ namespace mamba auto& create_specs = config.at("specs").value>(); auto& use_explicit = config.at("explicit_install").value(); + auto& json_format = config.at("json").get_cli_config(); auto channel_context = ChannelContext::make_conda_compatible(ctx); @@ -78,6 +81,21 @@ namespace mamba ); } } + else + { + if (create_specs.empty() && json_format) + { + // Just print the JSON + nlohmann::json output; + output["actions"]["FETCH"] = nlohmann::json::array(); + output["actions"]["PREFIX"] = ctx.prefix_params.target_prefix; + output["dry_run"] = true; + output["prefix"] = ctx.prefix_params.target_prefix; + output["success"] = true; + std::cout << output.dump(2) << std::endl; + return; + } + } if (ctx.env_lockfile) { diff --git a/micromamba/tests/test_create.py b/micromamba/tests/test_create.py index 1987a8bcad..e26243daa9 100644 --- a/micromamba/tests/test_create.py +++ b/micromamba/tests/test_create.py @@ -1343,3 +1343,18 @@ def test_parsable_env_history_with_metadata(tmp_home, tmp_root_prefix, tmp_path) # Must not hang helpers.umamba_list("-p", env_prefix, "--json") + + +def test_create_dry_run_json(tmp_path): + # Non-regression test for https://github.com/mamba-org/mamba/issues/3583 + env_prefix = tmp_path / "env-create_dry_run_json" + res = helpers.create("-p", env_prefix, "--dry-run", "--json") + + expected_output = { + "actions": {"FETCH": [], "PREFIX": str(env_prefix)}, + "dry_run": True, + "prefix": str(env_prefix), + "success": True, + } + + assert res == expected_output From c809abcba67fa3a94e205552ac1a6388c1736934 Mon Sep 17 00:00:00 2001 From: Hind Montassif Date: Fri, 22 Nov 2024 16:43:30 +0100 Subject: [PATCH 125/126] release libmamba 2.0.4, libmambapy 2.0.4, micromamba 2.0.4 --- CHANGELOG.md | 69 +++++++++++++++++++++++++++++++++++++++++ libmamba/CHANGELOG.md | 59 +++++++++++++++++++++++++++++++++++ libmambapy/CHANGELOG.md | 30 ++++++++++++++++++ micromamba/CHANGELOG.md | 45 +++++++++++++++++++++++++++ 4 files changed, 203 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b6f641216..438e7c5533 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,72 @@ +2024.11.22 +========== + +Releases: libmamba 2.0.4, libmambapy 2.0.4, micromamba 2.0.4 + +Enhancements: + +- [micromamba] feat: List PyPI packages in environment export by @jjerphan in https://github.com/mamba-org/mamba/pull/3623 +- [libmamba] More details in error message when failing to parse json from a python command's output by @Klaim in https://github.com/mamba-org/mamba/pull/3604 +- [libmamba] Fix: json parsing error due to wrong encoding of Python output by @Klaim in https://github.com/mamba-org/mamba/pull/3584 +- [libmamba] Adds logs clarifying the source of the error "could not load prefix data by @Klaim in https://github.com/mamba-org/mamba/pull/3581 +- [libmamba, micromamba] pip packages support with `list` by @Hind-M in https://github.com/mamba-org/mamba/pull/3565 +- [libmamba, libmambapy] chore: some CMake cleanup by @henryiii in https://github.com/mamba-org/mamba/pull/3564 +- [libmamba] Replaced rstrip reimplementation with call to remove_suffix by @JohanMabille in https://github.com/mamba-org/mamba/pull/3508 + +Bug fixes: + +- [micromamba, libmamba] fix: Return JSON on environment creation dry run by @jjerphan in https://github.com/mamba-org/mamba/pull/3627 +- [libmamba] fix: support homebrew/linuxbrew (AppleClang, GCC 11) by @henryiii in https://github.com/mamba-org/mamba/pull/3613 +- [libmamba, libmambapy] maint: Enable -Werror compiler flag for GCC, Clang and AppleClang by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3611 +- [libmamba] Fix build trailing `*` display by @Hind-M in https://github.com/mamba-org/mamba/pull/3619 +- [libmamba] fixed: incorrect erasing of env vars by @Klaim in https://github.com/mamba-org/mamba/pull/3622 +- [libmamba] Prevent pip "rich" ouput by @Klaim in https://github.com/mamba-org/mamba/pull/3607 +- [micromamba, libmamba] maint: Address compiler warnings by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3605 +- [micromamba] fix: Export `'channels'` as part of environments' export by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3587 +- [libmamba] Fix some warnings by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3595 +- [all] Remove Taskfile from `environment-dev-extra.yml` by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3597 +- [all] fixed incorrect syntax in static_build.yml by @Klaim in https://github.com/mamba-org/mamba/pull/3592 +- [micromamba] fix: Correct `mamba env export --json --from-history` by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3590 +- [libmamba] fix: Skip misformatted configuration files by @ChaonengQuan in https://github.com/mamba-org/mamba/pull/3580 +- [libmamba] Fix locking error by @Hind-M in https://github.com/mamba-org/mamba/pull/3572 +- [libmamba, micromamba] Fix test on windows by @Hind-M in https://github.com/mamba-org/mamba/pull/3555 +- [libmamba] fix: Only register channels in the context once by @jjerphan in https://github.com/mamba-org/mamba/pull/3521 +- [micromamba] fix: JSON output for environment export by @jjerphan in https://github.com/mamba-org/mamba/pull/3559 +- [micromamba] fix: Support `conda env export` `no-builds` flag by @jjerphan in https://github.com/mamba-org/mamba/pull/3563 +- [micromamba] fix: Export the environment prefix in specification by @jjerphan in https://github.com/mamba-org/mamba/pull/3562 +- [libmamba] windows shell init files use executable name by @Klaim in https://github.com/mamba-org/mamba/pull/3546 +- [libmamba, micromamba] Fix relative path in local channel by @Hind-M in https://github.com/mamba-org/mamba/pull/3540 +- [libmamba, micromamba] Correctly rename test to be run by @Hind-M in https://github.com/mamba-org/mamba/pull/3545 +- [libmamba, micromamba] Create empty base prefix with `env update` by @Hind-M in https://github.com/mamba-org/mamba/pull/3519 +- [libmamba, micromamba] fix: Use POSIX-compliant scripts by @jjerphan in https://github.com/mamba-org/mamba/pull/3522 +- [libmamba, micromamba] maint: Clarify `env` subcommand documentation in help menu (cont'd) by @jjerphan in https://github.com/mamba-org/mamba/pull/3539 +- [libmamba] fix: Handle space in `mamba` and `micromamba` executable absolute paths by @NewUserHa in https://github.com/mamba-org/mamba/pull/3525 +- [libmamba, micromamba] maint: Clarify `env` subcommand documentation in help menu by @jjerphan in https://github.com/mamba-org/mamba/pull/3502 +- [micromamba] fix: Adapt `test_env_update_pypi_with_conda_forge` by @jjerphan in https://github.com/mamba-org/mamba/pull/3537 +- [libmamba] Add recommendation if error with root prefix by @Hind-M in https://github.com/mamba-org/mamba/pull/3513 +- [libmamba] fix: Ignore inline comment in environment specification by @jjerphan in https://github.com/mamba-org/mamba/pull/3512 +- [libmamba] Replace `[System.IO.Path]::GetFileNameWithoutExtension` with `-replace` by @mleistner-bgr in https://github.com/mamba-org/mamba/pull/3510 +- [libmamba] Fix warnings and co by @Hind-M in https://github.com/mamba-org/mamba/pull/3507 + + +CI fixes and doc: + +- [all] ci: add brew toolchain test by @henryiii in https://github.com/mamba-org/mamba/pull/3625 +- [all] doc: show how to use advanced match specs in yaml spec by @corneliusroemer in https://github.com/mamba-org/mamba/pull/3384 +- [all] Doc: how to install specific Micromamba version by @truh in https://github.com/mamba-org/mamba/pull/3517 +- [all] doc: Homebrew currently only installs micromamba v1 by @corneliusroemer in https://github.com/mamba-org/mamba/pull/3499 +- [all] maint: Add dependabot config for GitHub workflows/actions by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3614 +- [all] maint: Unify `cmake` calls in workflows, build win static builds in p… by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3616 +- [all] docs: Update pieces of documentation after the release of mamba 2 by @jjerphan in https://github.com/mamba-org/mamba/pull/3610 +- [libmambapy, libmamba] maint: Update clang-format to v19 by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3600 +- [micromamba, libmamba] Update pre-commit hooks except clang-format by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3599 +- [all] Force spinx v6 in readthedocs by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3586 +- [all] Fix doc by @Hind-M in https://github.com/mamba-org/mamba/pull/3568 +- [all] [windows-vcpkg] Replace deprecated openssl with crypto feature with latest libarchive by @Hind-M in https://github.com/mamba-org/mamba/pull/3556 +- [all] maint: Unpin libcurl<8.10 by @jjerphan in https://github.com/mamba-org/mamba/pull/3548 +- [all] dev: Remove the use of Taskfile by @jjerphan in https://github.com/mamba-org/mamba/pull/3544 +- [all] Upgraded CI to micromamba 2.0.2 by @JohanMabille in https://github.com/mamba-org/mamba/pull/3497 + 2024.11.21 ========== diff --git a/libmamba/CHANGELOG.md b/libmamba/CHANGELOG.md index 3174d1ea0d..1aa7c93a5e 100644 --- a/libmamba/CHANGELOG.md +++ b/libmamba/CHANGELOG.md @@ -1,3 +1,62 @@ +libmamba 2.0.4 (November 22, 2024) +================================== + +Enhancements: + +- More details in error message when failing to parse json from a python command's output by @Klaim in https://github.com/mamba-org/mamba/pull/3604 +- Fix: json parsing error due to wrong encoding of Python output by @Klaim in https://github.com/mamba-org/mamba/pull/3584 +- Adds logs clarifying the source of the error "could not load prefix data by @Klaim in https://github.com/mamba-org/mamba/pull/3581 +- pip packages support with `list` by @Hind-M in https://github.com/mamba-org/mamba/pull/3565 +- chore: some CMake cleanup by @henryiii in https://github.com/mamba-org/mamba/pull/3564 +- Replaced rstrip reimplementation with call to remove_suffix by @JohanMabille in https://github.com/mamba-org/mamba/pull/3508 + +Bug fixes: + +- fix: Return JSON on environment creation dry run by @jjerphan in https://github.com/mamba-org/mamba/pull/3627 +- fix: support homebrew/linuxbrew (AppleClang, GCC 11) by @henryiii in https://github.com/mamba-org/mamba/pull/3613 +- maint: Enable -Werror compiler flag for GCC, Clang and AppleClang by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3611 +- Fix build trailing `*` display by @Hind-M in https://github.com/mamba-org/mamba/pull/3619 +- fixed: incorrect erasing of env vars by @Klaim in https://github.com/mamba-org/mamba/pull/3622 +- Prevent pip "rich" ouput by @Klaim in https://github.com/mamba-org/mamba/pull/3607 +- maint: Address compiler warnings by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3605 +- Fix some warnings by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3595 +- Remove Taskfile from `environment-dev-extra.yml` by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3597 +- fixed incorrect syntax in static_build.yml by @Klaim in https://github.com/mamba-org/mamba/pull/3592 +- fix: Skip misformatted configuration files by @ChaonengQuan in https://github.com/mamba-org/mamba/pull/3580 +- Fix locking error by @Hind-M in https://github.com/mamba-org/mamba/pull/3572 +- Fix test on windows by @Hind-M in https://github.com/mamba-org/mamba/pull/3555 +- fix: Only register channels in the context once by @jjerphan in https://github.com/mamba-org/mamba/pull/3521 +- windows shell init files use executable name by @Klaim in https://github.com/mamba-org/mamba/pull/3546 +- Fix relative path in local channel by @Hind-M in https://github.com/mamba-org/mamba/pull/3540 +- Correctly rename test to be run by @Hind-M in https://github.com/mamba-org/mamba/pull/3545 +- Create empty base prefix with `env update` by @Hind-M in https://github.com/mamba-org/mamba/pull/3519 +- fix: Use POSIX-compliant scripts by @jjerphan in https://github.com/mamba-org/mamba/pull/3522 +- maint: Clarify `env` subcommand documentation in help menu (cont'd) by @jjerphan in https://github.com/mamba-org/mamba/pull/3539 +- fix: Handle space in `mamba` and `micromamba` executable absolute paths by @NewUserHa in https://github.com/mamba-org/mamba/pull/3525 +- maint: Clarify `env` subcommand documentation in help menu by @jjerphan in https://github.com/mamba-org/mamba/pull/3502 +- Add recommendation if error with root prefix by @Hind-M in https://github.com/mamba-org/mamba/pull/3513 +- fix: Ignore inline comment in environment specification by @jjerphan in https://github.com/mamba-org/mamba/pull/3512 +- Replace `[System.IO.Path]::GetFileNameWithoutExtension` with `-replace` by @mleistner-bgr in https://github.com/mamba-org/mamba/pull/3510 +- Fix warnings and co by @Hind-M in https://github.com/mamba-org/mamba/pull/3507 + +CI fixes and doc: + +- ci: add brew toolchain test by @henryiii in https://github.com/mamba-org/mamba/pull/3625 +- doc: show how to use advanced match specs in yaml spec by @corneliusroemer in https://github.com/mamba-org/mamba/pull/3384 +- Doc: how to install specific Micromamba version by @truh in https://github.com/mamba-org/mamba/pull/3517 +- doc: Homebrew currently only installs micromamba v1 by @corneliusroemer in https://github.com/mamba-org/mamba/pull/3499 +- maint: Add dependabot config for GitHub workflows/actions by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3614 +- maint: Unify `cmake` calls in workflows, build win static builds in p… by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3616 +- docs: Update pieces of documentation after the release of mamba 2 by @jjerphan in https://github.com/mamba-org/mamba/pull/3610 +- maint: Update clang-format to v19 by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3600 +- Update pre-commit hooks except clang-format by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3599 +- Force spinx v6 in readthedocs by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3586 +- Fix doc by @Hind-M in https://github.com/mamba-org/mamba/pull/3568 +- [windows-vcpkg] Replace deprecated openssl with crypto feature with latest libarchive by @Hind-M in https://github.com/mamba-org/mamba/pull/3556 +- maint: Unpin libcurl<8.10 by @jjerphan in https://github.com/mamba-org/mamba/pull/3548 +- dev: Remove the use of Taskfile by @jjerphan in https://github.com/mamba-org/mamba/pull/3544 +- Upgraded CI to micromamba 2.0.2 by @JohanMabille in https://github.com/mamba-org/mamba/pull/3497 + libmamba 2.0.4alpha3 (November 21, 2024) ======================================== diff --git a/libmambapy/CHANGELOG.md b/libmambapy/CHANGELOG.md index 1bdc2f21d7..77197b4679 100644 --- a/libmambapy/CHANGELOG.md +++ b/libmambapy/CHANGELOG.md @@ -1,3 +1,33 @@ +libmambapy 2.0.4 (November 22, 2024) +==================================== + +Enhancements: + +- chore: some CMake cleanup by @henryiii in https://github.com/mamba-org/mamba/pull/3564 + +Bug fixes: + +- maint: Enable -Werror compiler flag for GCC, Clang and AppleClang by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3611 +- Remove Taskfile from `environment-dev-extra.yml` by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3597 +- fixed incorrect syntax in static_build.yml by @Klaim in https://github.com/mamba-org/mamba/pull/3592 + +CI fixes and doc: + +- ci: add brew toolchain test by @henryiii in https://github.com/mamba-org/mamba/pull/3625 +- doc: show how to use advanced match specs in yaml spec by @corneliusroemer in https://github.com/mamba-org/mamba/pull/3384 +- Doc: how to install specific Micromamba version by @truh in https://github.com/mamba-org/mamba/pull/3517 +- doc: Homebrew currently only installs micromamba v1 by @corneliusroemer in https://github.com/mamba-org/mamba/pull/3499 +- maint: Add dependabot config for GitHub workflows/actions by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3614 +- maint: Unify `cmake` calls in workflows, build win static builds in p… by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3616 +- docs: Update pieces of documentation after the release of mamba 2 by @jjerphan in https://github.com/mamba-org/mamba/pull/3610 +- maint: Update clang-format to v19 by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3600 +- Force spinx v6 in readthedocs by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3586 +- Fix doc by @Hind-M in https://github.com/mamba-org/mamba/pull/3568 +- [windows-vcpkg] Replace deprecated openssl with crypto feature with latest libarchive by @Hind-M in https://github.com/mamba-org/mamba/pull/3556 +- maint: Unpin libcurl<8.10 by @jjerphan in https://github.com/mamba-org/mamba/pull/3548 +- dev: Remove the use of Taskfile by @jjerphan in https://github.com/mamba-org/mamba/pull/3544 +- Upgraded CI to micromamba 2.0.2 by @JohanMabille in https://github.com/mamba-org/mamba/pull/3497 + libmambapy 2.0.4alpha3 (November 21, 2024) ========================================== diff --git a/micromamba/CHANGELOG.md b/micromamba/CHANGELOG.md index 36632a1868..991ad4b2cf 100644 --- a/micromamba/CHANGELOG.md +++ b/micromamba/CHANGELOG.md @@ -1,3 +1,48 @@ +micromamba 2.0.4 (November 22, 2024) +==================================== + +Enhancements: + +- feat: List PyPI packages in environment export by @jjerphan in https://github.com/mamba-org/mamba/pull/3623 +- pip packages support with `list` by @Hind-M in https://github.com/mamba-org/mamba/pull/3565 + +Bug fixes: + +- fix: Return JSON on environment creation dry run by @jjerphan in https://github.com/mamba-org/mamba/pull/3627 +- maint: Address compiler warnings by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3605 +- fix: Export `'channels'` as part of environments' export by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3587 +- Remove Taskfile from `environment-dev-extra.yml` by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3597 +- fixed incorrect syntax in static_build.yml by @Klaim in https://github.com/mamba-org/mamba/pull/3592 +- fix: Correct `mamba env export --json --from-history` by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3590 +- Fix test on windows by @Hind-M in https://github.com/mamba-org/mamba/pull/3555 +- fix: JSON output for environment export by @jjerphan in https://github.com/mamba-org/mamba/pull/3559 +- fix: Support `conda env export` `no-builds` flag by @jjerphan in https://github.com/mamba-org/mamba/pull/3563 +- fix: Export the environment prefix in specification by @jjerphan in https://github.com/mamba-org/mamba/pull/3562 +- Fix relative path in local channel by @Hind-M in https://github.com/mamba-org/mamba/pull/3540 +- Correctly rename test to be run by @Hind-M in https://github.com/mamba-org/mamba/pull/3545 +- Create empty base prefix with `env update` by @Hind-M in https://github.com/mamba-org/mamba/pull/3519 +- fix: Use POSIX-compliant scripts by @jjerphan in https://github.com/mamba-org/mamba/pull/3522 +- maint: Clarify `env` subcommand documentation in help menu (cont'd) by @jjerphan in https://github.com/mamba-org/mamba/pull/3539 +- maint: Clarify `env` subcommand documentation in help menu by @jjerphan in https://github.com/mamba-org/mamba/pull/3502 +- fix: Adapt `test_env_update_pypi_with_conda_forge` by @jjerphan in https://github.com/mamba-org/mamba/pull/3537 + +CI fixes and doc: + +- ci: add brew toolchain test by @henryiii in https://github.com/mamba-org/mamba/pull/3625 +- doc: show how to use advanced match specs in yaml spec by @corneliusroemer in https://github.com/mamba-org/mamba/pull/3384 +- Doc: how to install specific Micromamba version by @truh in https://github.com/mamba-org/mamba/pull/3517 +- doc: Homebrew currently only installs micromamba v1 by @corneliusroemer in https://github.com/mamba-org/mamba/pull/3499 +- maint: Add dependabot config for GitHub workflows/actions by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3614 +- maint: Unify `cmake` calls in workflows, build win static builds in p… by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3616 +- docs: Update pieces of documentation after the release of mamba 2 by @jjerphan in https://github.com/mamba-org/mamba/pull/3610 +- Update pre-commit hooks except clang-format by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3599 +- Force spinx v6 in readthedocs by @mathbunnyru in https://github.com/mamba-org/mamba/pull/3586 +- Fix doc by @Hind-M in https://github.com/mamba-org/mamba/pull/3568 +- [windows-vcpkg] Replace deprecated openssl with crypto feature with latest libarchive by @Hind-M in https://github.com/mamba-org/mamba/pull/3556 +- maint: Unpin libcurl<8.10 by @jjerphan in https://github.com/mamba-org/mamba/pull/3548 +- dev: Remove the use of Taskfile by @jjerphan in https://github.com/mamba-org/mamba/pull/3544 +- Upgraded CI to micromamba 2.0.2 by @JohanMabille in https://github.com/mamba-org/mamba/pull/3497 + micromamba 2.0.4alpha3 (November 21, 2024) ========================================== From 3f49aa5f6eeab8504983cc6beea898b54cedd05c Mon Sep 17 00:00:00 2001 From: Hind-M <70631848+Hind-M@users.noreply.github.com> Date: Mon, 2 Dec 2024 11:56:42 +0100 Subject: [PATCH 126/126] Uncomment test (#3641) --- micromamba/tests/test_create.py | 25 ++++++++++++------------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/micromamba/tests/test_create.py b/micromamba/tests/test_create.py index e26243daa9..3d45da1852 100644 --- a/micromamba/tests/test_create.py +++ b/micromamba/tests/test_create.py @@ -114,19 +114,18 @@ def test_lockfile(tmp_home, tmp_root_prefix, tmp_path): assert any(package["name"] == "zlib" and package["version"] == "1.2.11" for package in packages) -# TODO: uncomment when https://github.com/mamba-org/mamba/pull/3286 is merged -# @pytest.mark.parametrize("shared_pkgs_dirs", [True], indirect=True) -# def test_lockfile_online(tmp_home, tmp_root_prefix, tmp_path): -# env_prefix = tmp_path / "myenv" -# spec_file = ( -# "https://raw.githubusercontent.com/mamba-org/mamba/main/micromamba/tests/test_env-lock.yaml" -# ) -# -# res = helpers.create("-p", env_prefix, "-f", spec_file, "--json") -# assert res["success"] -# -# packages = helpers.umamba_list("-p", env_prefix, "--json") -# assert any(package["name"] == "zlib" and package["version"] == "1.2.11" for package in packages) +@pytest.mark.parametrize("shared_pkgs_dirs", [True], indirect=True) +def test_lockfile_online(tmp_home, tmp_root_prefix, tmp_path): + env_prefix = tmp_path / "myenv" + spec_file = ( + "https://raw.githubusercontent.com/mamba-org/mamba/main/micromamba/tests/test_env-lock.yaml" + ) + + res = helpers.create("-p", env_prefix, "-f", spec_file, "--json") + assert res["success"] + + packages = helpers.umamba_list("-p", env_prefix, "--json") + assert any(package["name"] == "zlib" and package["version"] == "1.2.11" for package in packages) @pytest.mark.parametrize("shared_pkgs_dirs", [True], indirect=True)