Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

fix: Support levels properly for compatible versions #3651

Conversation

jjerphan
Copy link
Member

@jjerphan jjerphan commented Dec 3, 2024

Fix #3647.
Fix #3472 properly, reverting parts of #3483.

@jjerphan jjerphan added the release::bug_fixes For PRs fixing bugs label Dec 3, 2024
@jjerphan
Copy link
Member Author

Closing for reason given in #3647 (comment).

@jjerphan jjerphan closed this Dec 17, 2024
@jjerphan jjerphan reopened this Jan 16, 2025
@jjerphan jjerphan force-pushed the fix/parse-compatible-release-with-build-number branch from bccce93 to 17148e1 Compare January 16, 2025 14:47
Signed-off-by: Julien Jerphanion <git@jjerphan.xyz>
Signed-off-by: Julien Jerphanion <git@jjerphan.xyz>
Signed-off-by: Julien Jerphanion <git@jjerphan.xyz>
@jjerphan jjerphan force-pushed the fix/parse-compatible-release-with-build-number branch 2 times, most recently from a5ed577 to 48bb5fa Compare February 11, 2025 13:30
Signed-off-by: Julien Jerphanion <git@jjerphan.xyz>
Signed-off-by: Julien Jerphanion <git@jjerphan.xyz>
Signed-off-by: Julien Jerphanion <git@jjerphan.xyz>
@jjerphan jjerphan force-pushed the fix/parse-compatible-release-with-build-number branch from 48bb5fa to e5b4440 Compare February 12, 2025 11:41
out,
"{}{}",
VersionSpec::compatible_str,
pred.m_version.str(op.level)
Copy link
Member Author

@jjerphan jjerphan Feb 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note to reviewer: this line cause the bug as the solver relies on the valid assumption that:

std::string match_spec_as_str = "numpy~=1.26"; // for instance.
match_spec_as_str == MatchSpec::parse(match_spec_as_str).value().str()

here:

const auto [first, second] = make_abused_namespace_dep_args(pool, ms.str());

which was not verified for compatible versions.

I think we need to add tests cases (in another PR) to test that this is valid for many MatchSpec.

REQUIRE_FALSE("~=1.7"_vs.contains("1"_v));
REQUIRE_FALSE("~=1.7"_vs.contains("1.6.0"_v));
REQUIRE_FALSE("~=1.7"_vs.contains("0.1.0"_v));
REQUIRE("~=1.7.0"_vs.str() == "~=1.7.0");
Copy link
Member Author

@jjerphan jjerphan Feb 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a first test for the assumption described in https://github.com/mamba-org/mamba/pull/3651/files#r1952499642.

Signed-off-by: Julien Jerphanion <git@jjerphan.xyz>
Signed-off-by: Julien Jerphanion <git@jjerphan.xyz>
Comment on lines +140 to +141
auto ms2 = MatchSpec::parse(ms.str()).value();
REQUIRE(ms2 == ms);
Copy link
Member Author

@jjerphan jjerphan Feb 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a first test for the assumption described in https://github.com/mamba-org/mamba/pull/3651/files#r1952499642.

@jjerphan jjerphan changed the title fix: Support for PEP 440 "Compatible Releases" (operator ~= for MatchSpec) with build string fix: Support levels properly for compatible releases Feb 12, 2025
@jjerphan jjerphan changed the title fix: Support levels properly for compatible releases fix: Support levels properly for compatible versions Feb 12, 2025
@jjerphan jjerphan marked this pull request as ready for review February 12, 2025 14:20
@jjerphan
Copy link
Member Author

Closing in preference of #3818.

@jjerphan jjerphan closed this Feb 12, 2025
@jjerphan jjerphan deleted the fix/parse-compatible-release-with-build-number branch February 12, 2025 14:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release::bug_fixes For PRs fixing bugs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

MatchSpec parsing error with ~= version operator Micromamba v2.0 unable to parse environment.yml
1 participant