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

Add semver ignore-condition range code into python version #10844

Merged
merged 1 commit into from
Oct 25, 2024

Conversation

amazimbe
Copy link
Contributor

@amazimbe amazimbe commented Oct 25, 2024

Issue: #10845

What are you trying to accomplish?

Backport this fix from maven into python.

Though, currently, ignore conditions like ["version-update:semver-major", "version-update:semver-minor"] are working exactly like in the previous python version implementation, this is not strictly correct. Based on (the python version specification)[https://packaging.python.org/en/latest/specifications/version-specifiers], dev0 is the suffix with the lowest precedence so that's what we need to use in the ranges. Otherwise, we could end up in a situation where a dependency with version 2.9 and settings that say ignore majors could upgrade to 3.dev0 as 3.dev0 < 3.a.

How will you know you've accomplished your goal?

Checklist

  • I have run the complete test suite to ensure all tests and linters pass.
  • I have thoroughly tested my code changes to ensure they work as expected, including adding additional tests for new functionality.
  • I have written clear and descriptive commit messages.
  • I have provided a detailed description of the changes in the pull request, including the problem it addresses, how it fixes the problem, and any relevant details about the implementation.
  • I have ensured that the code is well-documented and easy to understand.

@amazimbe amazimbe self-assigned this Oct 25, 2024
@amazimbe amazimbe marked this pull request as ready for review October 25, 2024 18:24
@amazimbe amazimbe requested a review from a team as a code owner October 25, 2024 18:24
@@ -214,6 +214,38 @@ def lowest_prerelease_suffix
"dev0"
end

sig { override.returns(T::Array[String]) }
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just overriding these from common/verison.rb

@@ -234,8 +234,8 @@ def updated_version_req_lower_bound
.reject { |req_string| req_string.start_with?("<") }
.select { |req_string| req_string.match?(VERSION_REGEX) }
.map { |req_string| req_string.match(VERSION_REGEX) }
.select { |version| Gem::Version.correct?(version) }
.max_by { |version| Gem::Version.new(version) }
.select { |version| Python::Version.correct?(version) }
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We need to use th correct method that is ecosystem specific and not the one from gem version that checks against a completely different regex.

@@ -77,10 +77,6 @@
describe ".new" do
subject(:version) { described_class.new(version_string) }

before do
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I didn't cleanup fully previously, but this is no longer needed.

@randhircs randhircs merged commit dbf5b05 into main Oct 25, 2024
64 checks passed
@randhircs randhircs deleted the amazimbe/fix-python-version-ignore-range branch October 25, 2024 19:48
@randhircs randhircs restored the amazimbe/fix-python-version-ignore-range branch October 25, 2024 19:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants