Use metatensor public API instead of private methods#438
Merged
Conversation
Migrate the Python package off metatensor's private methods, which were made public in metatensor v0.2 and only kept as shims for featomic: - Labels._as_mts_labels_t() -> Labels.as_mts_labels_t() - TensorMap._ptr -> TensorMap.as_mts_tensormap_t() - TensorMap._from_ptr() -> TensorMap.unsafe_from_ptr() This lets metatensor drop the backward-compat shims added in metatensor#1146. Fixes #437. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
341965d to
93f2f5f
Compare
The switch to the public `as_mts_tensormap_t()` API pushed this line over the line-length limit; wrap it to satisfy `ruff format`. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
ASE moved its documentation; the old wiki.fysik.dtu.dk/ase/ URL now redirects to ase-lib.org where objects.inv 404s, breaking the docs build. The inventory now lives at https://docs.ase-lib.org/. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Description
featomic's Python package calls several metatensor methods that were made public in metatensor v0.2 (the leading underscore was dropped). metatensor only kept the private names around as backward-compat shims for featomic, with the note "used by featomic, kept here until we update featomic to use the public API."
This PR is that update, migrating
calculator_base.pyto the public API:Labels._as_mts_labels_t()Labels.as_mts_labels_t()TensorMap._ptrTensorMap.as_mts_tensormap_t()TensorMap._from_ptr()TensorMap.unsafe_from_ptr()Semantics are unchanged:
as_mts_tensormap_t()returns a borrowed pointer (metatensor keeps ownership), matching the old._ptrand the borrowedpredefinedfield, whileunsafe_from_ptr()takes ownership of the freshly-allocated result.Once this lands, metatensor can drop the shims from metatensor#1146.
Fixes #437.
🤖 Generated with Claude Code
📚 Download documentation for this pull-request