Add pip packaging (scikit-build-core) and an ASE neighbour-list plugin - #2
Merged
Merged
Conversation
Make matscipy-neighbours pip-installable and register its neighbour list as an
ASE neighbour-list backend, so `pip install .` builds the C extension and ASE
can select it via ase.neighborlist.get_neighbor_list("matscipy-neighbours").
- pyproject.toml (new): scikit-build-core build backend; CPU-only wheel
(BUILD_TESTING/BENCHMARKS/EXAMPLES off); ase.plugins entry point. GPU stays an
opt-in build (-C cmake.define.ENABLE_CUDA=ON / ENABLE_HIP=ON).
- language_bindings/python/CMakeLists.txt: install the _matscipy_neighbours
extension into the package dir so the wheel's relative import resolves.
- language_bindings/python/matscipy_neighbours/_ase_plugin.py (new): adapter
matching ASE's NeighborListFunction contract (rejects self_interaction=True,
which the kernel does not support) plus a guarded __ase_plugins__ that
registers nothing on an ASE without the v4 plugin API, so plugin discovery
never breaks.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
pastewka
approved these changes
Jun 21, 2026
Contributor
|
Thanks @jameskermode! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Makes
matscipy-neighbourspip-installable and registers its neighbour list as an ASE neighbour-list backend, so:Selection is explicit and never automatic — this only makes the backend available under the name
matscipy-neighbours.What's here
pyproject.toml(new) — a scikit-build-core build backend driving the existing CMake. Builds a CPU-only wheel by default (BUILD_TESTING/BUILD_BENCHMARKS/BUILD_EXAMPLESoff, so the GoogleTest fetch is skipped); GPU stays an explicit opt-in (-C cmake.define.ENABLE_CUDA=ON/ENABLE_HIP=ON). Declares thease.pluginsentry point.aseis an optional extra.language_bindings/python/CMakeLists.txt— adds aninstall(TARGETS _matscipy_neighbours … DESTINATION matscipy_neighbours)rule so the extension lands inside the package in the wheel; the existing relative-import fallback inneighbours.py(from . import _matscipy_neighbours) then resolves with no source change.language_bindings/python/matscipy_neighbours/_ase_plugin.py(new) — a thin adapter matching ASE'sNeighborListFunctioncontract.neighbour_listalready returns the same(i, j, d, D, S)letters andD = r[j]-r[i]+S@cell; the adapter only adds theself_interactionkeyword, rejectingself_interaction=True(unsupported by the kernel) rather than silently differing.Notes
ase.pluginsentry-point group +NeighborListPlugin). The__ase_plugins__registration is guarded — on an ASE without that API it registers nothing instead of breaking plugin discovery — so this is safe to merge ahead of the ASE side landing, and a no-op for current released ASE.version = "0.1.0"is a static placeholder (the repo has no version metadata today); maintainers may prefer a dynamic/scm version.Validation
Built and installed with
pip install .(cp312 wheel, extension installed inside the package). Against an ASE branch carrying the v4NeighborListPlugin:matscipy-neighboursedge sets are byte-identical to ASE's reference backend across fcc / hcp / mixed-pbc slab systems (cutoffs 3 and 5 Å;Dagrees to ~1e-15). In a neighbour-list backend benchmark it was the fastest CPU backend measured (e.g. ~3× faster thanmatscipy.neighboursand ~55× faster than ASE's default at 108k atoms) with the lowest peak memory.🤖 Generated with Claude Code