Repository navigation
[doc-sync] docs(pyOpenMS): fix get_data_view() empty return behavior in README - #8879
Merged
timosachsenberg merged 1 commit intoMar 11, 2026
Conversation
The _view zero-copy methods return an empty ndarray when the container is empty, not None. This was incorrectly documented as 'None if empty' after the zero-copy API naming unification in #8857. The actual implementation in bind_kernel.cpp returns an empty ndarray with shape (0,), consistent with its docstring 'empty array if empty'. This is confirmed by test_zerocopy_conventions.py which asserts isinstance(arr, np.ndarray) and len(arr) == 0. Co-authored-by: Copilot <[email protected]>
timosachsenberg
marked this pull request as ready for review
March 11, 2026 06:21
timosachsenberg
enabled auto-merge (squash)
March 11, 2026 06:21
timosachsenberg
disabled auto-merge
March 11, 2026 07:16
timosachsenberg
deleted the
doc-sync/fix-pyopenms-readme-view-empty-behavior-7f9192237820232a
branch
March 11, 2026 07:16
This was referenced Mar 13, 2026
Merged
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
This PR fixes an inaccuracy in
src/pyOpenMS/README.mdintroduced by #8857 (the zero-copy API naming unification commit).Source files that triggered this review
src/pyOpenMS/bindings/bind_kernel.cpp—get_data_view()implementation forFloatDataArray/IntegerDataArraysrc/pyOpenMS/pyopenms/addons/deprecated_mv_aliases.py—_mv→_viewdeprecation conventionsrc/pyOpenMS/tests/unittests/test_zerocopy_conventions.py— convention testsDocumentation file updated
src/pyOpenMS/README.md— one-line fix in the "Adding Pythonic Methods" sectionChange made and why
Before:
Why: The
_view-suffix methods return an empty ndarray when the container is empty, notNone. This is:"Returns a zero-copy writable view of the data as numpy array (empty array if empty)"test_zerocopy_conventions.pywhich assertsisinstance(arr, np.ndarray)andlen(arr) == 0(notNone)_view = typed zero-copy column view, returns empty ndarray(T) if emptyThe incorrect "None if empty" description was accidentally copied into the new
get_data_view()entry during the rename in #8857.