Skip to content

Commit 9baded5

Browse files
committed
Make 3.15/3.15t validation opt-in (torch-only) so torchvision is unaffected
The shared generator default is consumed by domain libraries (torchvision, torchaudio) as well as torch. Adding 3.15/3.15t directly to the test channel default leaked the versions into torchvision release validation, which has no 3.15 wheels. Make the preview versions opt-in instead: - PYTHON_ARCHES_DICT default is restored (no 3.15). - PREVIEW_PYTHON_ARCHES_DICT holds 3.15/3.15t for the test channel only, appended on Linux x86 and aarch64 only, when include_preview_python_versions is enabled. - generate_binary_build_matrix.yml gains an include-preview-python-versions input (default disable); validate-linux-binaries.yml and validate-aarch64-linux-binaries.yml (torch-only) enable it. - Install command stays torch-only for these versions (no torchvision). Update unit tests to cover the opt-in, default-off, non-linux, and test-channel-only behavior.
1 parent 1a5841d commit 9baded5

5 files changed

Lines changed: 83 additions & 21 deletions

File tree

.github/workflows/generate_binary_build_matrix.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,11 @@ on:
5252
description: "A JSON-encoded list of python versions to build. An empty list means building all supported versions"
5353
default: "[]"
5454
type: string
55+
include-preview-python-versions:
56+
description: "Include opt-in preview python versions (torch-only, Linux x86 and aarch64), e.g. 3.15/3.15t"
57+
default: "disable"
58+
required: false
59+
type: string
5560
getting-started:
5661
description: "Release matrix for getting started page"
5762
required: false
@@ -97,6 +102,7 @@ jobs:
97102
BUILD_PYTHON_ONLY: ${{ inputs.build-python-only }}
98103
GETTING_STARTED: ${{ inputs.getting-started }}
99104
PYTHON_VERSIONS: ${{ inputs.python-versions }}
105+
INCLUDE_PREVIEW_PYTHON_VERSIONS: ${{ inputs.include-preview-python-versions }}
100106
run: |
101107
set -eou pipefail
102108
MATRIX_BLOB="$(python3 tools/scripts/generate_binary_build_matrix.py)"

.github/workflows/validate-aarch64-linux-binaries.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ jobs:
100100
with-cuda: enable
101101
with-cpu: enable
102102
use-only-dl-pytorch-org: ${{ inputs.use-only-dl-pytorch-org }}
103+
# Validate torch-only preview python versions (3.15/3.15t) on the test channel.
104+
include-preview-python-versions: enable
103105

104106
linux-aarch64:
105107
needs: generate-aarch64-linux-matrix

.github/workflows/validate-linux-binaries.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,8 @@ jobs:
109109
test-infra-ref: release/2.13
110110
use-only-dl-pytorch-org: ${{ inputs.use-only-dl-pytorch-org }}
111111
with-xpu: enable
112+
# Validate torch-only preview python versions (3.15/3.15t) on the test channel.
113+
include-preview-python-versions: enable
112114

113115
linux:
114116
needs: generate-linux-matrix

tools/scripts/generate_binary_build_matrix.py

Lines changed: 33 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,19 @@
2323

2424
PYTHON_ARCHES_DICT = {
2525
"nightly": ["3.10", "3.11", "3.12", "3.13", "3.14", "3.14t"],
26-
"test": ["3.10", "3.11", "3.12", "3.13", "3.14", "3.14t", "3.15", "3.15t"],
26+
"test": ["3.10", "3.11", "3.12", "3.13", "3.14", "3.14t"],
2727
"release": ["3.10", "3.11", "3.12", "3.13", "3.14", "3.14t"],
2828
}
2929

30-
# Python versions validated on Linux (x86 and aarch64) only for now. They are
31-
# stripped from Windows and macOS matrices since torch wheels for these versions
32-
# are not built/validated there yet.
33-
LINUX_ONLY_PYTHON_ARCHES = ["3.15", "3.15t"]
30+
# Preview Python versions validated for torch only, on Linux x86 and aarch64.
31+
# These are opt-in via INCLUDE_PREVIEW_PYTHON_VERSIONS so that the shared
32+
# generator default is unchanged for domain libraries (torchvision, torchaudio)
33+
# and for Windows/macOS, which do not have wheels for these versions yet.
34+
PREVIEW_PYTHON_ARCHES_DICT = {
35+
"nightly": [],
36+
"test": ["3.15", "3.15t"],
37+
"release": [],
38+
}
3439

3540
# Python versions for which only torch is validated (no torchvision). torchvision
3641
# wheels are not published for these versions yet, so the install command must
@@ -345,7 +350,9 @@ def generate_libtorch_matrix(
345350
abi_versions: Optional[List[str]] = None,
346351
arches: Optional[List[str]] = None,
347352
libtorch_variants: Optional[List[str]] = None,
353+
include_preview_python_versions: bool = False,
348354
) -> List[Dict[str, str]]:
355+
# libtorch is python-agnostic; the preview python versions do not apply.
349356
ret: List[Dict[str, str]] = []
350357

351358
if arches is None:
@@ -435,23 +442,24 @@ def generate_wheels_matrix(
435442
getting_started: bool = False,
436443
python_versions: Optional[List[str]] = None,
437444
arches: Optional[List[str]] = None,
445+
include_preview_python_versions: bool = False,
438446
) -> List[Dict[str, str]]:
439447
package_type = "wheel"
440448

441449
if not python_versions:
442450
# Define default python version
443451
python_versions = list(PYTHON_ARCHES)
444452

453+
# Opt-in preview versions (e.g. 3.15/3.15t) are torch-only and validated
454+
# on Linux x86 and aarch64 only. Append them to the default list so the
455+
# shared default (used by domain libraries, Windows and macOS) is
456+
# unaffected.
457+
if include_preview_python_versions and os in (LINUX, LINUX_AARCH64):
458+
python_versions += PREVIEW_PYTHON_ARCHES_DICT.get(channel, [])
459+
445460
if os == WINDOWS_ARM64:
446461
python_versions = ["3.11", "3.12", "3.13"] # only versions for now
447462

448-
# Restrict Linux-only Python versions (e.g. 3.15/3.15t) to the Linux x86 and
449-
# aarch64 matrices so Windows/macOS validation is unaffected.
450-
if os not in (LINUX, LINUX_AARCH64):
451-
python_versions = [
452-
pv for pv in python_versions if pv not in LINUX_ONLY_PYTHON_ARCHES
453-
]
454-
455463
if os == LINUX:
456464
# NOTE: We only build manywheel packages for linux
457465
package_type = "manywheel"
@@ -548,6 +556,7 @@ def generate_build_matrix(
548556
build_python_only: str,
549557
getting_started: str = "false",
550558
python_versions: Optional[List[str]] = None,
559+
include_preview_python_versions: str = "disable",
551560
) -> Dict[str, List[Dict[str, str]]]:
552561
includes = []
553562

@@ -577,6 +586,8 @@ def generate_build_matrix(
577586
use_only_dl_pytorch_org == "true",
578587
getting_started == "true",
579588
python_versions,
589+
include_preview_python_versions=include_preview_python_versions
590+
== ENABLE,
580591
)
581592
)
582593

@@ -678,6 +689,15 @@ def main(args: List[str]) -> None:
678689
default=os.getenv("PYTHON_VERSIONS", "[]"),
679690
)
680691

692+
parser.add_argument(
693+
"--include-preview-python-versions",
694+
help="Include opt-in preview python versions (torch-only, Linux x86 and "
695+
"aarch64) in the matrix",
696+
type=str,
697+
choices=[ENABLE, DISABLE],
698+
default=os.getenv("INCLUDE_PREVIEW_PYTHON_VERSIONS", DISABLE),
699+
)
700+
681701
options = parser.parse_args(args)
682702
try:
683703
python_versions = json.loads(options.python_versions)
@@ -701,6 +721,7 @@ def main(args: List[str]) -> None:
701721
options.build_python_only,
702722
options.getting_started,
703723
python_versions,
724+
options.include_preview_python_versions,
704725
)
705726

706727
print(json.dumps(build_matrix))

tools/tests/test_generate_binary_build_matrix.py

Lines changed: 40 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -126,36 +126,64 @@ def test_linux_wheel_cuda_xpu_nocpu(self):
126126
reference_output_file="build_matrix_linux_wheel_xpu.json",
127127
)
128128

129-
def _test_channel_python_versions(self, operating_system: str) -> set:
129+
def _test_channel_python_versions(
130+
self,
131+
operating_system: str,
132+
include_preview: str = "disable",
133+
channel: str = "test",
134+
) -> set:
130135
out = generate_build_matrix(
131136
"wheel",
132137
operating_system,
133-
"test",
138+
channel,
134139
"enable",
135140
"enable" if operating_system in ("linux",) else "disable",
136141
"enable",
137142
"enable" if operating_system in ("linux", "windows") else "disable",
138143
"false",
139144
"false",
140145
"disable",
146+
"false",
147+
None,
148+
include_preview,
141149
)
142150
return {entry["python_version"] for entry in out["include"]}
143151

144-
def test_linux_only_python_arches_on_linux(self):
145-
# 3.15 / 3.15t are validated on Linux x86 and aarch64 for the test channel.
152+
def test_preview_python_versions_opt_in_on_linux(self):
153+
# 3.15 / 3.15t are validated on Linux x86 and aarch64 for the test channel
154+
# only when explicitly opted in.
146155
for operating_system in ("linux", "linux-aarch64"):
147-
versions = self._test_channel_python_versions(operating_system)
156+
versions = self._test_channel_python_versions(
157+
operating_system, include_preview="enable"
158+
)
148159
self.assertIn("3.15", versions)
149160
self.assertIn("3.15t", versions)
150161

151-
def test_linux_only_python_arches_excluded_elsewhere(self):
152-
# Windows and macOS must not pick up the Linux-only versions.
153-
for operating_system in ("windows", "macos"):
162+
def test_preview_python_versions_off_by_default(self):
163+
# Without opt-in the shared default is unchanged (e.g. torchvision builds).
164+
for operating_system in ("linux", "linux-aarch64"):
154165
versions = self._test_channel_python_versions(operating_system)
155166
self.assertNotIn("3.15", versions)
156167
self.assertNotIn("3.15t", versions)
157168

158-
def test_torch_only_install_command_for_linux_only_arches(self):
169+
def test_preview_python_versions_excluded_on_non_linux(self):
170+
# Windows and macOS must not pick up the preview versions even when opted in.
171+
for operating_system in ("windows", "macos"):
172+
versions = self._test_channel_python_versions(
173+
operating_system, include_preview="enable"
174+
)
175+
self.assertNotIn("3.15", versions)
176+
self.assertNotIn("3.15t", versions)
177+
178+
def test_preview_python_versions_only_test_channel(self):
179+
# Preview versions are defined for the test channel only.
180+
versions = self._test_channel_python_versions(
181+
"linux", include_preview="enable", channel="nightly"
182+
)
183+
self.assertNotIn("3.15", versions)
184+
self.assertNotIn("3.15t", versions)
185+
186+
def test_torch_only_install_command_for_preview_arches(self):
159187
out = generate_build_matrix(
160188
"wheel",
161189
"linux",
@@ -167,6 +195,9 @@ def test_torch_only_install_command_for_linux_only_arches(self):
167195
"false",
168196
"false",
169197
"disable",
198+
"false",
199+
None,
200+
"enable",
170201
)
171202
for entry in out["include"]:
172203
if entry["python_version"] in ("3.15", "3.15t"):

0 commit comments

Comments
 (0)