Skip to content

[doc-sync] docs(pyOpenMS): document zero-copy API naming conventions (_view, _struct, deprecated _mv) - #8890

Merged
timosachsenberg merged 1 commit into
developfrom
doc-sync/zero-copy-api-conventions-2026-03-12-95b2c357efd808cd
Mar 12, 2026
Merged

timosachsenberg merged 1 commit into
developfrom
doc-sync/zero-copy-api-conventions-2026-03-12-95b2c357efd808cd

Conversation

@github-actions

Copy link
Copy Markdown
Contributor

Summary

This PR documents the zero-copy API naming conventions that were standardized in #8857 but were not captured in the developer README.

Source files that triggered this doc review

  • src/pyOpenMS/bindings/bind_chromatogram.cpp — added get_peaks_struct with structured dtype
  • src/pyOpenMS/bindings/bind_spectrum.cpp — moved get_peaks_struct from addon to C++ binding
  • src/pyOpenMS/bindings/bind_analysis.cpp — added empty guards to OpenSwath _mv methods
  • src/pyOpenMS/pyopenms/addons/deprecated_mv_aliases.py — added/renamed deprecated aliases
  • src/pyOpenMS/tests/unittests/test_zerocopy_conventions.py — new test file enforcing naming conventions

Documentation file updated

src/pyOpenMS/README.md

Added a new subsection "Zero-copy API Naming Conventions" under "Development Patterns → Adding Pythonic Methods".

What changed and why

The _view / _struct naming convention was formalized and enforced with tests in #8857, but the developer README only mentioned get_data_view() in passing with a note that get_data_mv() is a deprecated alias. Nothing explained:

  • When to use _view vs _struct
  • What each suffix guarantees (dtype, empty behavior)
  • That _mv is deprecated and where the aliases live
  • That _as_view should not be used for new methods

The new subsection fills this gap with a lookup table and explicit rules, making it easy for contributors to follow the convention when adding new zero-copy bindings.

Generated by Documentation Sync Agent · ◷

…ruct, deprecated _mv)

The zero-copy API naming convention was standardized in #8857
(Fix ChromatogramPeak IntensityType consistency and unify zero-copy API
conventions). Enforcement tests were added in
test_zerocopy_conventions.py, but the naming convention itself was not
documented in the developer README.

Add a 'Zero-copy API Naming Conventions' subsection to README.md
explaining:
- _view suffix: typed 1-D ndarray column views
- _struct suffix: structured ndarray record views
- _mv suffix: deprecated (aliases live in deprecated_mv_aliases.py)
- Empty-container return behavior for each suffix

Co-authored-by: Copilot <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant