This is an automated email from the ASF dual-hosted git repository.
tqchen pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm-ffi.git
The following commit(s) were added to refs/heads/main by this push:
new 78d3c42 chore: Upgrade Python dependency (#135)
78d3c42 is described below
commit 78d3c42b104b2b5109cf2c4c53bbfdf493ea3f67
Author: Junru Shao <[email protected]>
AuthorDate: Wed Oct 15 15:04:30 2025 -0700
chore: Upgrade Python dependency (#135)
- Adds "torch" back to Windows test dependency, and further constrains
to use latest torch;
- Adds a new uv `dependency-group` called `dev` which developers could
use for local development;
- Enforce using Ninja instead of Makefile in `scikit-build-core`
configurations. Ninja can be easily installed via PyPI so it's not a
harsh constraint.
Future forward, we may consider manage & lock those dependencies
periodically with `uv.lock` so that development experience can be more
consistent
---
pyproject.toml | 28 ++++++++++++++++++++++------
python/tvm_ffi/__init__.py | 16 +++++++++++++---
2 files changed, 35 insertions(+), 9 deletions(-)
diff --git a/pyproject.toml b/pyproject.toml
index 732bc2c..4e0e2b8 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -43,14 +43,25 @@ GitHub = "https://github.com/apache/tvm-ffi"
torch = ["torch", "setuptools", "ninja"]
cpp = ["ninja"]
# note pytorch does not yet ship with 3.14t
-test = [
+test = ["pytest", "numpy", "ninja", "torch; python_version < '3.14'"]
+
+[dependency-groups]
+dev = [
+ "ruff",
+ "mypy",
+ "clang-format",
+ "clang-tidy",
+ "ipdb",
+ "ipython",
+ "ninja",
+ "pre-commit",
"pytest",
"numpy",
- "ninja",
- "torch; python_version < '3.14' and sys_platform != 'win32'",
+ "ml_dtypes",
+ "cython",
+ "cmake",
+ "scikit-build-core",
]
-
-[dependency-groups]
docs = [
"autodocsumm",
"breathe",
@@ -83,12 +94,14 @@ tvm-ffi-config = "tvm_ffi.config:__main__"
tvm-ffi-stubgen = "tvm_ffi.stub.stubgen:__main__"
[build-system]
-requires = ["scikit-build-core>=0.10.0", "cython", "cmake>=3.18"]
+requires = ["scikit-build-core>=0.10.0", "cython", "cmake>=3.18", "ninja"]
build-backend = "scikit_build_core.build"
[tool.scikit-build]
wheel.py-api = "cp312"
minimum-version = "build-system.requires"
+ninja.version = ">=1.11"
+ninja.make-fallback = false
# Build configuration
build-dir = "build"
@@ -248,3 +261,6 @@ exclude = '''(?x)(
[[tool.mypy.overrides]]
module = ["torch", "torch.*", "my_ffi_extension", "my_ffi_extension.*"]
ignore_missing_imports = true
+
+[tool.uv.dependency-groups]
+docs = { requires-python = ">=3.13" }
diff --git a/python/tvm_ffi/__init__.py b/python/tvm_ffi/__init__.py
index e2bf619..d2bf5a8 100644
--- a/python/tvm_ffi/__init__.py
+++ b/python/tvm_ffi/__init__.py
@@ -16,11 +16,21 @@
# under the License.
"""TVM FFI Python package."""
-# version
-__version__ = "0.1.0b19"
-
# order matters here so we need to skip isort here
# isort: skip_file
+__version__ = "0.1.0b19"
+
+# HACK: try importing torch first, to avoid a potential
+# symbol conflict when both torch and tvm_ffi are imported.
+# This conflict can be reproduced in a very narrow scenario:
+# 1. GitHub action on Windows X64
+# 2. Python 3.12
+# 3. torch 2.9.0
+try:
+ import torch # type: ignore
+except ImportError:
+ pass
+
# base always go first to load the libtvm_ffi
from . import base
from . import libinfo