Repository navigation
[Python] Refactor pyproject.toml dependencies - #19723
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors project dependencies in pyproject.toml by moving psutil from main dependencies to optional and test groups, renaming importer-pytorch to importer-torch, and updating the all extra. In python/tvm/s_tir/meta_schedule/utils.py, the psutil import is moved inline. Feedback suggests catching ImportError when importing psutil inline to fall back to os.cpu_count(), and keeping importer-pytorch as an alias to avoid breaking backward compatibility.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
095d0c6 to
30becbe
Compare
A plain `import tvm` hard-required psutil: the import chain tvm -> relax -> relax/pipeline.py -> s_tir.meta_schedule -> meta_schedule/utils.py reached a top-level `import psutil`, even though the only use in that module is psutil.cpu_count() for the meta schedule search. All other call sites (popen_pool, disco.process_pool, rpc.server) already import psutil lazily inside the functions that need it. - Move `import psutil` in s_tir/meta_schedule/utils.py from module level into _cpu_count_impl with an actionable error message, and drop psutil from the core dependencies. - Drop the importer extras: users importing torch/onnx/tflite models already have the corresponding framework installed, so declaring it on TVM's side is redundant. - Drop the coreml extra: the CoreML BYOC backend additionally requires a USE_COREML=ON build (off by default and in the published wheels) and Xcode's coremlcompiler, so the extra alone could not enable the feature. Its lazy coremltools import now raises an actionable error instead. - Organize the remaining extras by feature: torch, cuda (cuda-python for NVRTC JIT), meta-schedule (xgboost), popen-pool (psutil, cloudpickle), rpc (tornado, psutil, cloudpickle), and all (the union of the lightweight feature deps). - Add a popen-pool dependency group (cloudpickle, psutil) included by the test group, covering the PopenPool worker deps when running the test suite from a source checkout. - Give the onnx/torch/tflite frontends actionable ImportErrors too. The onnx frontend's existing "Unable to import onnx" guards were unreachable: the unguarded module-level import failed first.
30becbe to
0e8e0df
Compare
This pr refactors `pyproject.toml` and deletes redundant dependencies (cherry picked from commit a4a2bf5)
This pr refactors `pyproject.toml` and deletes redundant dependencies (cherry picked from commit a4a2bf5)
This pr refactors `pyproject.toml` and deletes redundant dependencies
This pr refactors `pyproject.toml` and deletes redundant dependencies
This pr refactors
pyproject.tomland deletes redundant dependencies