[TESTS] Fix ONNX serialization test failures: setuptools bump + converter bug fix#36854
Open
mvafin wants to merge 1 commit into
Open
[TESTS] Fix ONNX serialization test failures: setuptools bump + converter bug fix#36854mvafin wants to merge 1 commit into
mvafin wants to merge 1 commit into
Conversation
623a900 to
0696506
Compare
0696506 to
dd6c7ea
Compare
### Details: - Root cause: `check_python_requirements.py` used `pkg_resources`, which setuptools removed in 82.0. When CI installs a modern setuptools, the import fails, the requirement check exits non-zero, `onnx_FOUND` is set to OFF, and the `.prototxt` -> `.onnx` test-model conversion is skipped. The serialization tests (`SerializationDeterministicityTest`, `ONNXSerialization/SerializationTest`) then fail because their `.onnx` models are missing. - Rewrite `check_python_requirements.py` on top of stdlib `importlib.metadata` + `packaging` instead of the removed `pkg_resources` API, so requirement/constraint validation keeps working with any setuptools version. Also strip inline comments from constraints lines. - Bump `setuptools` upper bound from `<80.10` to `<84` now that the check no longer depends on `pkg_resources`. ### Tickets: - CVS-188510
Contributor
There was a problem hiding this comment.
Pull request overview
This PR targets ONNX serialization test failures by relaxing the Python setuptools constraint and updating the CMake-time Python requirement checker to work without pkg_resources (which is removed in newer setuptools), keeping the developer/test environment checks compatible with modern Python packaging tooling.
Changes:
- Bump
setuptoolsupper bound inconstraints.txtfrom<80.10to<84. - Replace
pkg_resources.require(...)usage incheck_python_requirements.pywith animportlib.metadata+packaging-based validation loop. - Improve constraints parsing by stripping inline comments in
constraints.txtentries before processing.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| src/bindings/python/constraints.txt | Expands allowed setuptools versions to unblock environments using newer releases. |
| cmake/developer_package/check_python_requirements.py | Migrates requirements validation off pkg_resources to keep CMake dependency checks working with newer setuptools. |
| build<1.6 | ||
| pygments>=2.8.1 | ||
| setuptools>=77,<80.10 | ||
| setuptools>=77,<84 |
Comment on lines
49
to
52
| line = line.replace("\n", "") | ||
| if re.search("\W", line): | ||
| requirements.append(line) | ||
| else: |
Comment on lines
+62
to
+66
| # Validate each requirement against the installed distributions. Uses | ||
| # importlib.metadata + packaging instead of the removed pkg_resources API | ||
| # (dropped in setuptools>=82), so the check keeps working with modern | ||
| # setuptools. Raises to signal an unsatisfied requirement to the caller. | ||
| for raw in requirements: |
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.
Details:
setuptoolsupper bound from<80.10to<84to allow 80.10.x patch releases and current 83.xonnx_prototxt_converter.py:serialize_proto(bytes, ModelProto())→deserialize_proto(bytes, ModelProto())in thebytesbranch ofsave_model(serialize_prototakes one argument;deserialize_protois the two-argument form that parses raw bytes into a proto message)Tickets:
AI Assistance:
check_python_requirements.py/test_model_zoo.cmakechain and verifyingonnx.serializationAPI signatures. Changes manually reviewed.