Skip to content

Fix pyOpenMS enum bindings out of sync with C++ enums - #9705

Merged
timosachsenberg merged 1 commit into
developfrom
claude/quirky-darwin-ankicg
Jul 3, 2026
Merged

timosachsenberg merged 1 commit into
developfrom
claude/quirky-darwin-ankicg

Conversation

@timosachsenberg

@timosachsenberg timosachsenberg commented Jul 3, 2026 •

Copy link
Copy Markdown
Contributor

Description

A routine audit of all 108 nb::enum_<...> registrations in src/pyOpenMS/bindings/*.cpp against their C++ enum definitions found 4 enums where the Python binding was missing enumerators present in the C++ header. This means those values were entirely inaccessible from Python (not a value-corruption issue — the bound values were correct, just incomplete). No ordering/value-mismatch issues were found anywhere else in the sweep (nanobind binds by explicit CppEnum::VALUE, not registration order, so omission is the only failure mode).

Fixes:

  • NASequence::NASFragmentType (CHEMISTRY/NASequence.h) — added 8 missing values: BIonMinusH20, YIonMinusH20, BIonMinusNH3, YIonMinusNH3, NonIdentified, Unannotated, AminusB, SizeOfNASFragmentType. Python users could not construct/compare these nucleic-acid fragment ion types.
  • ProteomicsPkaScale (CHEMISTRY/IsoelectricPoint.h) — added the missing SIZE_OF_PROTEOMICS_PKA_SCALES sentinel, for consistency with every other SIZE_OF_*/NUMBER_OF_* sentinel bound elsewhere in the codebase.
  • OSWHierarchy::Level (DATASTRUCTURES/OSWData.h) — added the missing SIZE_OF_VALUES sentinel, which is used by OSWIndexTrace::lowest as the "not set" marker.
  • LPWrapper::SOLVER (DATASTRUCTURES/LPWrapper.h) — SOLVER_COINOR/SOLVER_HIGHS exist in the C++ enum under #ifdef OPENMS_HAS_COINOR/OPENMS_HAS_HIGHS but were never bound in Python. Added them under matching #ifdef guards (the macros are already visible in this translation unit via LPWrapper.h's own #include <OpenMS/config.h>).

Only .value(...) binding lines were added; no existing bindings were reordered or changed, so this cannot affect any currently-working Python code.

Checklist

  • I have commented my code, particularly in hard-to-understand areas (n/a — mechanical binding additions, self-explanatory)
  • Add relevant changes and new features to the CHANGELOG file
  • Updated or added python bindings for changed or new classes
  • New and existing unit tests pass locally with my changes — not verified in this environment (no local build directory / submodules not initialized in this session); relies on CI to confirm compilation, especially the conditional OPENMS_HAS_COINOR/OPENMS_HAS_HIGHS branches of LPWrapper::SOLVER.

Generated by Claude Code

Summary by CodeRabbit

  • New Features

    • Expanded Python-accessible enum options for chemistry and data-structure APIs, including additional fragment types and size markers.
    • Added support for more solver options in Python when those libraries are available.
  • Bug Fixes

    • Exposed previously missing enum values so Python users can access the full set of supported constants.

NASequence::NASFragmentType, ProteomicsPkaScale, OSWHierarchy::Level,
and LPWrapper::SOLVER were missing enumerators in the nanobind bindings
that exist in the corresponding C++ enum definitions, making those
values inaccessible from Python.

- NASFragmentType: add 8 missing values (BIonMinusH20, YIonMinusH20,
  BIonMinusNH3, YIonMinusNH3, NonIdentified, Unannotated, AminusB,
  SizeOfNASFragmentType)
- ProteomicsPkaScale: add missing SIZE_OF_PROTEOMICS_PKA_SCALES sentinel
- OSWHierarchy::Level: add missing SIZE_OF_VALUES sentinel, used as the
  "unset" marker by OSWIndexTrace::lowest
- LPWrapper::SOLVER: bind SOLVER_COINOR/SOLVER_HIGHS under the same
  OPENMS_HAS_COINOR/OPENMS_HAS_HIGHS guards used by the C++ enum

Co-Authored-By: Claude Sonnet 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01GhhgiwwEafRKTMtWeKSaEA
@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

@timosachsenberg The following names might be missing from the AUTHORS file:

  • Claude

Please consider applying the following patch:

--- AUTHORS	2026-07-03 05:40:03.707319626 +0000
+++ AUTHORS.new	2026-07-03 05:40:09.043198469 +0000
@@ -25,6 +25,7 @@
  - Chris Bielow
  - Christian Ehrlich
  - Christie Mathews
+ - Claude
  - Clemens Groepl
  - Cornelia Friedle
  - Daniel Jameson

@coderabbitai

coderabbitai Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: a9503e11-dce5-4d3b-8f91-4cd8cf08ce8d

📥 Commits

Reviewing files that changed from the base of the PR and between 4e5d2c2 and 5af1747.

📒 Files selected for processing (2)
  • src/pyOpenMS/bindings/bind_chemistry.cpp
  • src/pyOpenMS/bindings/bind_datastructures.cpp

📝 Walkthrough

Walkthrough

This PR updates pyOpenMS bindings to expose additional enum values. ProteomicsPkaScale and NASequence::NASFragmentType gain new constants including size-of sentinels. LPWrapper::SOLVER conditionally exposes SOLVER_COINOR/SOLVER_HIGHS, and OSWHierarchy::Level adds SIZE_OF_VALUES.

Changes

Enum binding expansions

Layer / File(s) Summary
Chemistry enum exports
src/pyOpenMS/bindings/bind_chemistry.cpp
Adds SIZE_OF_PROTEOMICS_PKA_SCALES to ProteomicsPkaScale and expands NASFragmentType with additional fragment-type constants and SizeOfNASFragmentType.
Datastructures enum exports
src/pyOpenMS/bindings/bind_datastructures.cpp
Restructures LPWrapper::SOLVER registration to conditionally add SOLVER_COINOR/SOLVER_HIGHS based on build flags, and adds SIZE_OF_VALUES to OSWHierarchy::Level.

Poem

A rabbit hops through binding code so neat,
Adding enums, making Python's toolkit complete.
COINOR, HIGHS, sizes tucked in place,
New constants exported, each in its space.
Thump-thump hooray, the bindings grow! 🐇✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: syncing pyOpenMS enum bindings with their C++ counterparts.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/quirky-darwin-ankicg

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@timosachsenberg
timosachsenberg merged commit 8b8790f into develop Jul 3, 2026
44 checks passed
@timosachsenberg
timosachsenberg deleted the claude/quirky-darwin-ankicg branch July 3, 2026 07:35
timosachsenberg added a commit that referenced this pull request Jul 4, 2026
Routine changelog sweep found three merged develop PRs without changelog
coverage: FileInfo progress-logging restoration (#9707), a pyOpenMS enum
binding completeness fix (#9705), and OpenMP parallelization of the QPX
feature Parquet export (#9699, extending #9698). Also updated the #9698
entry's now-inaccurate "Serial only" note to point at #9699.


Claude-Session: https://claude.ai/code/session_014CUTttkkvRtTRtiV8ctAM6

Co-authored-by: Claude <[email protected]>
timosachsenberg added a commit that referenced this pull request Jul 6, 2026
Three recently merged PRs landed on develop without changelog coverage:
the OpenMP parallelization of the QPX feature Parquet export (#9699,
follow-up to #9698), the pyOpenMS enum-binding drift fix restoring
several inaccessible NASFragmentType/ProteomicsPkaScale/OSWHierarchy/
LPWrapper::SOLVER enumerators (#9705), and the re-added FileInfo
progress logging exposed to pyOpenMS via Options.log_type (#9707).


Claude-Session: https://claude.ai/code/session_01YCkM79JUnodCGEHtBKNWSz

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants