Skip to content

ci: Test Python 3.15 with torch nightly - #788

Merged
ValerianRey merged 3 commits into
SimplexLab:mainfrom
mattbuot:ci/python-3.15
Sep 30, 2026
Merged

ValerianRey merged 3 commits into
SimplexLab:mainfrom
mattbuot:ci/python-3.15

Conversation

@mattbuot

@mattbuot mattbuot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

This is a first step towards Python 3.15 support: it runs the tests on Python 3.15 in the CI, using torch nightly since stable torch doesn't ship cp315 wheels yet. It doesn't make support official (no classifier, no change to installation.md, no changelog entry). I thought that would be better done in a follow-up, like #474, once stable torch supports 3.15. Happy to change the scope if you'd prefer it another way.

  • Add a Python 3.15 + torch nightly config to the tests matrix, with the quadprog_projector and fairgrad options. cvxpy (needed by cagrad and nash_mtl) is left out for now: its dependency sparsediffpy has no cp315 wheel yet, and building it from source on ubuntu-latest fails because BLAS isn't installed. Once wheels are available, this could switch to full.
  • In install-deps, install torch nightly before the other dependencies instead of upgrading to it afterwards. Otherwise, the first install fails on Python 3.15 because no stable torch wheel matches. The existing torch-nightly config should end up with the same packages as before.
  • Rename tests/profiling to tests/profiler (and PROFILING_RESULTS_DIR to PROFILER_RESULTS_DIR). Python 3.15 adds a stdlib profiling package (PEP 799), and since tests/ is on sys.path during the tests, tests/profiling shadowed it. This broke import cProfile, and therefore torch._dynamo and torchvision, so test collection failed.

Local checks, following CONTRIBUTING.md:

  • Python 3.15.0rc2 + torch 2.15.0.dev20260929, without options: 2737 passed, 79 skipped, 33 xfailed.
  • Python 3.15.0rc2 + torch nightly with [quadprog_projector,fairgrad]: 3140 passed and 1 failed (with [full], which builds on macOS thanks to Accelerate: 3280 passed and the same 1 failed): test_upgrad.py::test_permutation_invariant[UPGrad-T[20, 100]1], which is off by 5.6e-7 against a 5e-7 tolerance. I get the same failure on Python 3.14 + torch nightly on my machine (macOS arm64), and the torch-nightly job on main is green on Linux, so I believe it's platform-specific and unrelated to Python 3.15.
  • Python 3.14 + stable torch, [full]: pytest -W error tests/unit passes, and ty check, pre-commit run --all-files, make doctest and make html pass too.

🤖 Generated with Claude Code

https://claude.ai/code/session_01LnhiXDUDYQhk7YvfpMC61d

mattbuot and others added 2 commits September 29, 2026 18:57
* Add a Python 3.15 + torch nightly config to the tests matrix
* Install torch nightly before the other dependencies in install-deps, so that it works on Python
  versions for which no stable torch wheel exists yet
* Remove tests/profiling/__init__.py, which shadowed the new stdlib profiling package (PEP 799) and
  broke import cProfile (and thus torch._dynamo and torchvision) when running tests on Python 3.15

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LnhiXDUDYQhk7YvfpMC61d
sparsediffpy, a dependency of cvxpy, has no Python 3.15 wheel yet and fails to build from source
on ubuntu-latest because BLAS is not installed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LnhiXDUDYQhk7YvfpMC61d
@ValerianRey ValerianRey added the cc: ci Conventional commit type for changes to the CI (Github workflows and actions). label Sep 29, 2026
@ValerianRey

Copy link
Copy Markdown
Member
  • Remove tests/profiling/__init__.py. Python 3.15 adds a stdlib profiling package (PEP 799), and since tests/ is on sys.path during the tests, tests/profiling shadowed it. This broke import cProfile, and therefore torch._dynamo and torchvision, so test collection failed. Without the __init__.py, tests/profiling is only a namespace package, so the stdlib one takes precedence. The profiling scripts are run as scripts and aren't imported anywhere, so nothing else depends on it. If you'd rather rename the folder instead, I can do that.

Yeah, could we instead rename profiling to profiler? Make sure to rename all mentions of it.

Apart from that I think we should merge this already.

@ValerianRey
ValerianRey marked this pull request as ready for review September 29, 2026 18:45
Renaming the folder avoids shadowing the stdlib profiling package added in Python 3.15, so its
__init__.py can be restored. Also rename PROFILING_RESULTS_DIR to PROFILER_RESULTS_DIR.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LnhiXDUDYQhk7YvfpMC61d
@mattbuot

Copy link
Copy Markdown
Contributor Author

Rename done ✅
Thanks for the quick review, let me know if you'd want any other change

@ValerianRey

Copy link
Copy Markdown
Member

@PierreQuinton fyi

@ValerianRey
ValerianRey merged commit 4ee54f2 into SimplexLab:main Sep 30, 2026
19 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cc: ci Conventional commit type for changes to the CI (Github workflows and actions).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants