Fix cuOpt solver name formatting for versions with != 3 components - #4026
Closed
ramakrishnap-nv wants to merge 1 commit into
Closed
Fix cuOpt solver name formatting for versions with != 3 components#4026ramakrishnap-nv wants to merge 1 commit into
ramakrishnap-nv wants to merge 1 commit into
Conversation
_get_cuopt_version formatted the solver name with "cuOpt %s.%s%s" against
tuple(cuopt.__version__.split('.')), which assumes the version has exactly
three dot-separated components. cuOpt nightly wheels carry a PEP 440 .post
suffix (e.g. 26.10.0a37.post260819050903), giving four components and
raising TypeError: not all arguments converted during string formatting.
Because this runs in the attempt_import callback, the error surfaces when
Pyomo resolves its solver plugins, so it aborts collection for any test
module that touches the solver list -- not just cuOpt's own tests.
Use the version string directly, which is correct for any number of
components. This also fixes the separator for the 3-component case, which
previously rendered 26.10.00 as "cuOpt 26.1000".
3 tasks
Contributor
|
Hi @ramakrishnap-nv - The PR description deleted a required part of the template (AI disclosure), so this will be closed by policy. Please feel free to reopen with the correct template and we will happily review it. |
Contributor
Author
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #4026 +/- ##
=======================================
Coverage 89.94% 89.94%
=======================================
Files 917 917
Lines 109250 109250
=======================================
+ Hits 98263 98267 +4
+ Misses 10987 10983 -4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes # .
Summary/Motivation:
_get_cuopt_versionformats the solver name with"cuOpt %s.%s%s" % tuple(cuopt.__version__.split('.')), which requires the version to have exactly three dot-separated components. cuOpt nightly wheels carry a PEP 440.postsuffix (e.g.26.10.0a37.post260819050903), giving four components and raising:Since this runs in the
attempt_importcallback, it fires when Pyomo resolves its solver plugins and aborts pytest collection for any module that touches the solver list, not just cuOpt's own tests.It also fixes the 3-component case, which dropped a separator:
26.10.00rendered ascuOpt 26.1000.cuopt.__version__26.10.0a37.post260819050903TypeErrorcuOpt 26.10.0a37.post26081905090326.10.00a37cuOpt 26.1000a37cuOpt 26.10.00a3726.10.00cuOpt 26.1000cuOpt 26.10.00Changes proposed in this PR:
_versionis unchanged, soversion()behaviour is unaffected.AI-Use Disclosure
or
AI tools contributed to the development of this PR
Review process (select ONE):
Notes for reviewers (optional): The change is a one-line formatting fix. Verified by evaluating the format against the version strings cuOpt ships (release, nightly conda, nightly wheel) and by running
black --check. No test was added — happy to add one if you'd like coverage for the version-parsing callback.Legal Acknowledgement
By contributing to this software project, I have read the contribution guide and agree to the following terms and conditions for my contribution: