deepmodeling / deepmodeling/deepmd-gnn
[Code scan] Python builds should discover Torch CMake prefix when BUILD_PY_IF is true
- Dominant language
- Python
- Stars
- 56
- Forks
- 10
- Avg merge
- 15d 8h
- Merged PRs (30d)
- 12
Description
This issue was found by a Codex global scan of the repository at commit 19f9265efe8825a4383e5a13ce128361533b5ac6.
`pyproject.toml` configures scikit-build to build the Python interface only:
https://github.com/deepmodeling/deepmd-gnn/blob/19f9265efe8825a4383e5a13ce128361533b5ac6/pyproject.toml#L97-L99
However, the CMake logic that queries `torch.utils.cmake_prefix_path` only runs for selected C++ builds or `CIBUILDWHEEL=1`:
https://github.com/deepmodeling/deepmd-gnn/blob/19f9265efe8825a4383e5a13ce128361533b5ac6/CMakeLists.txt#L85-L109
`find_package(Torch REQUIRED)` then runs unconditionally:
https://github.com/deepmodeling/deepmd-gnn/blob/19f9265efe8825a4383e5a13ce128361533b5ac6/CMakeLists.txt#L120-L124
A normal local configure without user-supplied `CMAKE_PREFIX_PATH` fails with:
```text
Could not find a package configuration file provided by "Torch"
```
Suggested fix: when `BUILD_PY_IF` is true and `Torch_DIR`/`CMAKE_PREFIX_PATH` is not already sufficient, query `torch.utils.cmake_prefix_path` using the build Python interpreter before `find_package(Torch REQUIRED)`.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.