Skip to content

Commit fcd5ab4

Browse files
authored
[CI] Phase out Python 3.8 wheel builds (#633)
cibuildwheel 4.x no longer accepts Python 3.8 build selectors, so the wheel build configuration needs to start at Python 3.9. This PR: - raises the package Python floor to 3.9 - removes cp38 from cibuildwheel build and test-skip selectors - updates the CI test matrix Python 3.8 leg to Python 3.9
1 parent fc275d6 commit fcd5ab4

18 files changed

Lines changed: 43 additions & 290 deletions

.github/actions/build-wheel-for-publish/action.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,6 @@ inputs:
4545
runs:
4646
using: "composite"
4747
steps:
48-
# Special handling for macOS arm64 + python 3.8.
49-
# Install Python 3.8 from `actions/setup-python`, which is an arm64 build.
50-
- name: Install Python 3.8 for macOS arm64
51-
if: runner.os == 'macOS' && inputs.arch == 'arm64'
52-
uses: actions/setup-python@v5
53-
with:
54-
python-version: 3.8
55-
5648
- name: Set up uv
5749
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
5850

.github/workflows/ci_test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ jobs:
131131
matrix:
132132
include:
133133
- {os: ubuntu-latest, arch: x86_64, python_version: '3.14t'}
134-
- {os: ubuntu-24.04-arm, arch: aarch64, python_version: '3.8'}
134+
- {os: ubuntu-24.04-arm, arch: aarch64, python_version: '3.14'}
135135
- {os: windows-latest, arch: AMD64, python_version: '3.9'}
136136
- {os: macos-14, arch: arm64, python_version: '3.13'}
137137

pyproject.toml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ classifiers = [
3131
"Intended Audience :: Science/Research",
3232
]
3333
keywords = ["machine learning", "inference"]
34-
requires-python = ">=3.8"
34+
requires-python = ">=3.9"
3535
dependencies = ["typing-extensions>=4.5"]
3636

3737
[project.urls]
@@ -181,7 +181,7 @@ testpaths = ["tests"]
181181
include = ["python/**/*.py", "tests/**/*.py"]
182182
line-length = 100
183183
indent-width = 4
184-
target-version = "py38"
184+
target-version = "py39"
185185

186186
[tool.ruff.lint]
187187
select = [
@@ -235,10 +235,10 @@ build-verbosity = 1
235235
# only build up to cp312, cp312
236236
# will be abi3 and can be used in future versions
237237
# ship 314t threaded nogil version
238-
build = ["cp38-*", "cp39-*", "cp310-*", "cp311-*", "cp312-*", "cp314t-*"]
238+
build = ["cp39-*", "cp310-*", "cp311-*", "cp312-*", "cp314t-*"]
239239
skip = ["*musllinux*"]
240240
# we only need to test on cp312
241-
test-skip = ["cp38-*", "cp39-*", "cp310-*", "cp311-*"]
241+
test-skip = ["cp39-*", "cp310-*", "cp311-*"]
242242
# focus on testing abi3 wheel
243243
build-frontend = "build[uv]"
244244
test-command = "pytest {package}/tests/python -vvs"
@@ -267,6 +267,7 @@ unused-ignore-comment = "ignore"
267267

268268
[tool.ty.analysis]
269269
allowed-unresolved-imports = [
270+
"tvm_ffi._version",
270271
"torch",
271272
"torch.*",
272273
"torch.utils.*",

python/tvm_ffi/container.py

Lines changed: 11 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,17 @@
2020

2121
import itertools
2222
import operator
23-
import sys
23+
from collections.abc import ItemsView as ItemsViewBase
24+
from collections.abc import (
25+
Iterable,
26+
Iterator,
27+
Mapping,
28+
MutableMapping,
29+
MutableSequence,
30+
Sequence,
31+
)
32+
from collections.abc import KeysView as KeysViewBase
33+
from collections.abc import ValuesView as ValuesViewBase
2434
from typing import (
2535
Any,
2636
Callable,
@@ -33,46 +43,6 @@
3343
from . import _ffi_api, core
3444
from .registry import register_object
3545

36-
if sys.version_info >= (3, 9):
37-
# PEP 585 generics
38-
from collections.abc import (
39-
ItemsView as ItemsViewBase,
40-
)
41-
from collections.abc import (
42-
Iterable,
43-
Iterator,
44-
Mapping,
45-
MutableMapping,
46-
MutableSequence,
47-
Sequence,
48-
)
49-
from collections.abc import (
50-
KeysView as KeysViewBase,
51-
)
52-
from collections.abc import (
53-
ValuesView as ValuesViewBase,
54-
)
55-
else: # Python 3.8
56-
# workarounds for python 3.8
57-
# typing-module generics (subscriptable on 3.8)
58-
from typing import (
59-
ItemsView as ItemsViewBase,
60-
)
61-
from typing import (
62-
Iterable,
63-
Iterator,
64-
Mapping,
65-
MutableMapping,
66-
MutableSequence,
67-
Sequence,
68-
)
69-
from typing import (
70-
KeysView as KeysViewBase,
71-
)
72-
from typing import (
73-
ValuesView as ValuesViewBase,
74-
)
75-
7646
__all__ = ["Array", "Dict", "List", "Map"]
7747

7848

python/tvm_ffi/cpp/dtype.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@
5959
}
6060

6161

62-
@functools.lru_cache(maxsize=None)
62+
@functools.cache
6363
def _determine_backend_once() -> Literal["cpu", "cuda", "rocm"]:
6464
try:
6565
import torch # noqa: PLC0415

python/tvm_ffi/cpp/nvrtc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
from __future__ import annotations
2020

21-
from typing import Sequence
21+
from collections.abc import Sequence
2222

2323

2424
def nvrtc_compile( # noqa: PLR0912, PLR0915

python/tvm_ffi/registry.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,8 @@
2121
import json
2222
import sys
2323
import warnings
24-
from typing import Any, Callable, Literal, Sequence, TypeVar, overload
24+
from collections.abc import Sequence
25+
from typing import Any, Callable, Literal, TypeVar, overload
2526

2627
from . import core
2728
from .core import Function, TypeInfo

python/tvm_ffi/stub/file_utils.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,9 @@
2222
import difflib
2323
import os
2424
import traceback
25+
from collections.abc import Generator, Iterable
2526
from pathlib import Path
26-
from typing import Callable, Generator, Iterable
27+
from typing import Callable
2728

2829
from . import consts as C
2930

python/tvm_ffi/stub/lib_state.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
from .utils import FuncInfo, NamedTypeSchema, ObjectInfo
3131

3232

33-
@functools.lru_cache(maxsize=None)
33+
@functools.cache
3434
def object_info_from_type_key(type_key: str) -> ObjectInfo:
3535
"""Construct an `ObjectInfo` from an object type key."""
3636
type_info = _lookup_or_register_type_info_from_type_key(str(type_key))
@@ -108,7 +108,7 @@ def toposort_objects(type_keys: list[str]) -> list[ObjectInfo]:
108108
return [infos[type_key] for type_key in sorted_keys]
109109

110110

111-
@functools.lru_cache(maxsize=None)
111+
@functools.cache
112112
def _func_info_from_global_name(name: str) -> FuncInfo:
113113
"""Construct a `FuncInfo` from a global function name."""
114114
return FuncInfo(

python/tvm_ffi/testing/testing.py

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,6 @@
4141
from .. import _ffi_api
4242
from .. import core as tvm_ffi_core
4343

44-
requires_py39 = pytest.mark.skipif(
45-
sys.version_info < (3, 9),
46-
reason="requires Python 3.9+",
47-
)
4844
requires_py310 = pytest.mark.skipif(
4945
sys.version_info < (3, 10),
5046
reason="requires Python 3.10+",

0 commit comments

Comments
 (0)