Skip to content

Commit 99c1ece

Browse files
wanghan-iapcmHan Wang
andauthored
build: move vesin[torch] to the torch extra (fix conda-forge) (deepmodeling#5501)
## Summary `vesin`'s torch bindings ship as a separate PyPI package (`vesin-torch`, pulled in by the `vesin[torch]` extra). **conda-forge packages `vesin` but not `vesin-torch`**, so listing `vesin[torch]` in the **core** `dependencies` (added in deepmodeling#5491) breaks the conda-forge build of the base `deepmd-kit` package. This moves `vesin[torch]` out of the core dependencies and into the **`torch` optional-dependency extra** (`backend/find_pytorch.get_pt_requirement`), so only `deepmd-kit[torch]` (pip) pulls it. The neighbor-list runtime already guards usage via `is_vesin_torch_available()`, and `nlist_backend="auto"` falls back to the native builder when vesin is absent, so this is behavior-preserving for installs that don't ship the torch extra. ## Changes - `pyproject.toml`: drop `vesin[torch]` from core `dependencies`. - `backend/find_pytorch.py`: add `vesin[torch]` to the `torch` extra. ## Known limitations - No automated test covers the build-backend's generated extras; the change is verified by inspection (the `pip install deepmd-kit[torch]` resolution and the conda-forge recipe build are not exercised in CI here). - When torch is not requested, the `torch` extra is empty and vesin is not installed (intended). <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Chores** * Adjusted dependency configuration for improved package management. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Co-authored-by: Han Wang <wang_han@iapcm.ac.cn>
1 parent 2e3117e commit 99c1ece

2 files changed

Lines changed: 5 additions & 2 deletions

File tree

backend/find_pytorch.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,11 @@ def get_pt_requirement(pt_version: str = "") -> dict:
137137
# https://github.com/pytorch/pytorch/commit/7e0c26d4d80d6602aed95cb680dfc09c9ce533bc
138138
else "torch>=2.1.0",
139139
"e3nn>=0.5.9",
140+
# O(N) cell-list neighbor list for fast Python/ASE inference; the
141+
# torch bindings (vesin-torch) ship only as a PyPI extra, so keep it
142+
# under the torch extra rather than the core deps (conda-forge has
143+
# vesin but not vesin-torch).
144+
"vesin[torch]",
140145
*mpi_requirement,
141146
*cibw_requirement,
142147
],

pyproject.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,6 @@ dependencies = [
5858
'array-api-compat',
5959
'lmdb',
6060
'msgpack',
61-
# O(N) cell-list neighbor list (vesin.torch) for fast Python/ASE inference
62-
'vesin[torch]',
6361
]
6462
requires-python = ">=3.10"
6563
keywords = ["deepmd"]

0 commit comments

Comments
 (0)