Skip to content

Update pytorch dependencies - #40710

Open
jrmccluskey wants to merge 5 commits into
apache:masterfrom
jrmccluskey:torchRelay
Open

jrmccluskey wants to merge 5 commits into
apache:masterfrom
jrmccluskey:torchRelay

Conversation

@jrmccluskey

Copy link
Copy Markdown
Contributor

Updates pytorch, with the floor set at 2.3.0 to allow for support with numpy 2+. Also updates test environments.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

📋 Review Summary

This PR updates the PyTorch dependency configuration by removing the upper version bound on torch, bumping the minimum supported version to 2.3.0, and consolidating the tox and Gradle test suites to test the lower bound (pytorch-23) and pytorch-latest across Python 3.11 and 3.14.

🔍 General Feedback

  • The dependency and test suite simplifications in setup.py, tox.ini, and the Gradle build definitions are clean and consistent across the targeted Python versions.
  • One minor inconsistency exists in tox.ini where the 23 factor is omitted from envlist, which will prevent tox from recognizing py311-pytorch-23 unless explicitly matched or added to the factor list.

💡 Tip: Comment /gemini review on this pull request to trigger a new Gemini code review.

💬 Inline Findings

  • sdks/python/tox.ini (line 25): 🟡 Medium: envlist only includes latest for the pytorch environments (py{311,314}-pytorch-{latest}), omitting 23. While [testenv:py{311,314}-pytorch-{23,latest}] defines the 23 factor below, keeping 23 in envlist ensures consistency with other versioned test environments (like pyarrow and transformers) and allows tox environment enumeration to include py311-pytorch-23.
  py{311,314}-pytorch-{23,latest}

@jrmccluskey

Copy link
Copy Markdown
Contributor Author

/gemini review

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

📋 Review Summary

This PR drops support for PyTorch 1.x by bumping the minimum requirement in sdks/python/setup.py to torch>=2.0.0,<3.0.0, removing obsolete PyTorch 1.x tox environments (pytorch-19, pytorch-110, pytorch-111, pytorch-112, pytorch-113), and updating the Gradle tox test suites (py311, py312, py314) and tox.ini to test PyTorch 2.0, 2.7, and 2.11 (pytorch-latest).

🔍 General Feedback

  • The changes across setup.py, tox.ini, and the Gradle build configurations are clean, consistent, and well-aligned with recent dependency modernization PRs.
  • The updated PostCommit Python Dependency CI workflow passed on all target Python versions (3.11, 3.12, and 3.14).

💡 Tip: Comment /gemini review on this pull request to trigger a new Gemini code review.

@codecov

codecov Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 79.92%. Comparing base (a8d6afd) to head (991d911).
⚠️ Report is 43 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #40710      +/-   ##
==========================================
- Coverage   80.04%   79.92%   -0.13%     
==========================================
  Files         490      493       +3     
  Lines       82916    83363     +447     
==========================================
+ Hits        66373    66628     +255     
- Misses      16543    16735     +192     
Flag Coverage Δ
python 79.92% <ø> (-0.13%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

Copy link
Copy Markdown
Contributor

Assigning reviewers:

R: @tvalentyn for label python.
Backup reviewer: claudevdm (if the main reviewer is unresponsive, you can escalate to them by tagging their username)

Note: If you would like to opt out of this review, comment assign to next reviewer.

Available commands:

  • stop reviewer notifications - opt out of the automated review tooling
  • remind me after tests pass - tag the comment author after tests pass
  • waiting on author - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)

The PR bot will only process comments in the main thread (not review comments).

toxTask "testPy311pytorch-200", "py311-pytorch-200", "${posargs}"
test.dependsOn "testPy311pytorch-200"
postCommitPyDep.dependsOn "testPy311pytorch-200"
// Create a test task for the lower and upper bounds of supported pytorch.

@tvalentyn tvalentyn Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

is pytorch-latest conceptually the same as pytorch-upper?

@tvalentyn tvalentyn Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

if so, maybe we should rename it as such. 'latest' configuration sounds to me like "test against whatever pytorch is currently latest "

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

renamed to follow the previous convention

@jrmccluskey
jrmccluskey requested a review from tvalentyn October 22, 2026 19:12
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