Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jan 16, 2026

Description

Modern Python dependency resolvers (pip ≥20.3, uv, poetry, pdm) treat onnxruntime-gpu and onnxruntime as unrelated packages, causing both to install simultaneously. This happens because variant packages don't declare Provides-Dist: onnxruntime in their wheel metadata, violating PEP 566 dependency resolution semantics.

Changes:

  • Custom Distribution class - Extends setuptools.Distribution to inject Provides-Dist metadata into wheel METADATA files via monkey-patched write_pkg_file method
  • Automatic metadata assignment - All variant packages (gpu, openvino, migraphx, dnnl, tvm, vitisai, acl, armnn, cann, qnn, webgpu, training variants, trt-rtx) automatically receive Provides-Dist: onnxruntime (=={version})
  • Base package unchanged - Only applies when package_name != "onnxruntime"

Result:

# requirements.txt
onnxruntime-gpu==1.23.2
markitdown==0.1.4  # depends on onnxruntime

# Before: Both onnxruntime and onnxruntime-gpu installed
# After:  Only onnxruntime-gpu installed (satisfies markitdown's onnxruntime dependency)

Motivation and Context

Resolves dependency conflicts where variant packages fail to satisfy base package requirements, causing duplicate installations and environment pollution. Implements PEP 566 Provides-Dist field for proper distribution aliasing.

Original prompt

Please make a PR to fix the issue referred in #26807


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI and others added 3 commits January 16, 2026 02:27
- Created custom Distribution class that adds Provides-Dist metadata
- All variant packages (onnxruntime-gpu, onnxruntime-openvino, etc.) now declare they provide onnxruntime
- This fixes dependency resolution issues where both onnxruntime and onnxruntime-gpu could be installed
- Addresses issue #26807

Co-authored-by: fs-eire <[email protected]>
- Added comprehensive docstring for Distribution class
- Added validation to check if provides_dist is iterable
- Added try-except for original write_pkg_file call
- Added skip for empty strings in provides_dist entries

Co-authored-by: fs-eire <[email protected]>
- Removed redundant try-except block
- Simplified type checking with isinstance for list/tuple
- Improved code readability

Co-authored-by: fs-eire <[email protected]>
Copilot AI changed the title [WIP] Fix issue referenced in #26807 Add Provides-Dist metadata to onnxruntime variant packages Jan 16, 2026
Copilot AI requested a review from fs-eire January 16, 2026 02:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants