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

Use regex-based version casting that accept #658

Merged
merged 5 commits into from
May 22, 2024
Merged

Use regex-based version casting that accept #658

merged 5 commits into from
May 22, 2024

Conversation

ccl-core
Copy link
Contributor

@ccl-core ccl-core commented May 17, 2024

Remove warning when version doesn't conform to MAJOR.MINOR.PATCH

Ref. ##609

@ccl-core ccl-core requested a review from marcenacp May 17, 2024 13:11
Copy link

github-actions bot commented May 17, 2024

MLCommons CLA bot All contributors have signed the MLCommons CLA ✍️ ✅

@@ -34,6 +34,7 @@ class Issues:
We use sets to represent errors and warnings to avoid repeated strings.
"""

ignore_warnings: bool = False
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 think it belongs here, but if you see it more fit it could also be an argument of report()

Copy link
Contributor

Choose a reason for hiding this comment

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

+1 to put it in report.

Copy link
Contributor

@marcenacp marcenacp left a comment

Choose a reason for hiding this comment

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

Thanks!

When reading the issue #643, I understand the user doesn't necessarily want to silence all warnings but rather wants to have #609 implemented. The goal would be to work on having interesting/relevant/not too noisy warnings rather than allowing the user to silence them.

@@ -34,6 +34,7 @@ class Issues:
We use sets to represent errors and warnings to avoid repeated strings.
"""

ignore_warnings: bool = False
Copy link
Contributor

Choose a reason for hiding this comment

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

+1 to put it in report.

issues.add_error("foo", metadata)
issues.add_warning("bar", file_object)

print(issues.report())
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove?

@ccl-core ccl-core marked this pull request as ready for review May 17, 2024 13:25
@ccl-core ccl-core requested a review from a team as a code owner May 17, 2024 13:25
@ccl-core
Copy link
Contributor Author

That's right, this would actually address the "However, adding a generic --ignore framework is probably a good first step, so I'm opening this issue." part of the issue, but I think a more long-term solution might be needed to silence only a subset of the warnings.

@ccl-core ccl-core changed the title Silence warnings in validate.py Remove versions warning. May 17, 2024
@ccl-core
Copy link
Contributor Author

Updated the PR as discussed offline.

raise WarningException(
f"Version doesn't follow MAJOR.MINOR.PATCH: {version}. For more"
" information refer to: https://semver.org/spec/v2.0.0.html"
f"Version contains non-numeric characters: {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.

Keeping the warning for non-numeric versioning. Reasonable? Or shall I remove this as well?

Copy link
Contributor

Choose a reason for hiding this comment

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

We could fully implement the semantic versioning standard.

semver is a python library that does exactly this. However it seems we only need to check the compatibility with the standard, so we could also just reuse their regular expression.

Copy link
Contributor

Choose a reason for hiding this comment

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

Also, I think that it's worth mentioning the semantic versioning standard: https://semver.org/spec/v2.0.0.html, and that minor and patch can be omitted.

@ccl-core
Copy link
Contributor Author

@marcenacp updated the PR -- PTAL, thanks! :)

@@ -101,17 +101,9 @@ def test_invalid_version(version, expected_error):
@pytest.mark.parametrize(
["version", "expected_warning"],
[
[
Copy link
Contributor

Choose a reason for hiding this comment

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

Still keep this?

Copy link
Contributor

Choose a reason for hiding this comment

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

(Those should fail)

Copy link
Contributor

Choose a reason for hiding this comment

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

Above, you could add that the versions 1 and 1.2 now succeed

Copy link
Contributor

@marcenacp marcenacp left a comment

Choose a reason for hiding this comment

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

See comments.

@ccl-core ccl-core changed the title Remove versions warning. Use regex-based version casting that accept May 22, 2024
@ccl-core ccl-core requested a review from marcenacp May 22, 2024 12:44
Copy link
Contributor

@marcenacp marcenacp left a comment

Choose a reason for hiding this comment

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

Thanks!

@ccl-core ccl-core merged commit f672f02 into main May 22, 2024
14 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators May 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants