Skip to content

Fix_pms - #8063

Merged
timosachsenberg merged 9 commits into
developfrom
fix_pms
May 22, 2025
Merged

Fix_pms#8063
timosachsenberg merged 9 commits into
developfrom
fix_pms

Conversation

@timosachsenberg

@timosachsenberg timosachsenberg commented May 22, 2025 •

Copy link
Copy Markdown
Contributor

Description

fix pyopenms builds

Checklist

  • Make sure that you are listed in the AUTHORS file
  • Add relevant changes and new features to the CHANGELOG file
  • I have commented my code, particularly in hard-to-understand areas
  • New and existing unit tests pass locally with my changes
  • Updated or added python bindings for changed or new classes (Tick if no updates were necessary.)

How can I get additional information on failed tests during CI

Click to expand If your PR is failing you can check out

Advanced commands (admins / reviewer only)

Click to expand
  • /reformat (experimental) applies the clang-format style changes as additional commit. Note: your branch must have a different name (e.g., yourrepo:feature/XYZ) than the receiving branch (e.g., OpenMS:develop). Otherwise, reformat fails to push.
  • setting the label "NoJenkins" will skip tests for this PR on jenkins (saves resources e.g., on edits that do not affect tests)
  • commenting with rebuild jenkins will retrigger Jenkins-based CI builds

⚠️ Note: Once you opened a PR try to minimize the number of pushes to it as every push will trigger CI (automated builds and test) and is rather heavy on our infrastructure (e.g., if several pushes per day are performed).

Summary by CodeRabbit

  • New Features
    • Added setter methods for protein and peptide identifications in certain data structures.
  • Bug Fixes
    • Updated method signatures to return values instead of references for improved consistency and usability.
    • Adjusted several method parameter types to use a more specific data structure.
    • Removed an obsolete method related to hit ranking.
  • Chores
    • Standardized the order of exception and thread-safety annotations throughout the codebase.
    • Cleaned up redundant imports and updated documentation comments for clarity.
    • Enhanced CI workflow to conditionally compile specific components for pull requests on Ubuntu.
    • Improved build logic to support conditional compilation based on environment variables.

@coderabbitai

coderabbitai Bot commented May 22, 2025 •

Copy link
Copy Markdown
Contributor

Walkthrough

The changes primarily reorder the except + and nogil specifiers in Cython function and constructor declarations across multiple files, both in actual .pxd interface files and in comments or code generation scripts. Several Cython interfaces are updated to use AnnotatedMSRun instead of MSExperiment for relevant method parameters and return types. Some getter methods are modified to return values instead of references, and corresponding setter methods are added. Redundant imports and wrapper ignore directives are also adjusted or removed. Additionally, CI workflow and build scripts are updated to conditionally compile pxds targets.

Changes

File(s) Change Summary
src/pyOpenMS/README_WRAPPING_NEW_CLASSES, src/pyOpenMS/addons/MzMLFile.pyx,
src/pyOpenMS/addons/SequestOutfile.pyx, src/pyOpenMS/tests/unittests/test000.py,
tools/PythonExtensionChecker.py
Reordered nogil except + to except + nogil in Cython function/constructor declarations, comments, and code generation templates. No logic or interface changes.
src/pyOpenMS/pxds/AnnotatedMSRun.pxd Changed all constructors and methods to use except + nogil ordering. Getter methods for protein/peptide identifications and experiments now return values instead of references. Added corresponding setter methods. Removed const overloads. Updated operator[] to return value pair instead of reference pair.
src/pyOpenMS/pxds/ConsensusMap.pxd Added a redundant import for MSExperiment. No functional or interface changes.
src/pyOpenMS/pxds/IDFilter.pxd Changed method parameter types from MSExperiment& to AnnotatedMSRun& in three methods. Removed updateHitRanks method. Added import for AnnotatedMSRun.
src/pyOpenMS/pxds/IDMapper.pxd Updated two annotate method signatures to use AnnotatedMSRun& instead of MSExperiment& as the first parameter. Updated corresponding documentation comments and added import for AnnotatedMSRun.
src/pyOpenMS/pxds/MSExperiment.pxd Changed return types of spectrumRanges(), chromatogramRanges(), and combinedRanges() from reference (const and non-const) to value. No other changes.
src/pyOpenMS/pxds/MSPFile.pxd Changed store method to accept AnnotatedMSRun& instead of MSExperiment&. Added import for AnnotatedMSRun.
src/pyOpenMS/pxds/RangeManager.pxd Removed the # wrap-ignore directive from RangeManagerRtMzIntMob class declaration. No other changes.
.github/workflows/openms_ci_matrix_full.yml Added environment variable COMPILE_PXDS set conditionally to "ON" for Ubuntu pull requests targeting develop branch; otherwise "OFF".
tools/ci/cibuild.cmake Extended environment variables to load with COMPILE_PXDS. Added conditional build step for compile_pxds target when COMPILE_PXDS is "ON" and PYOPENMS is "OFF".

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant IDFilter
  participant AnnotatedMSRun
  participant IDMapper
  participant MSPFile

  User->>IDFilter: filterHitsByScore(AnnotatedMSRun, ...)
  User->>IDFilter: keepNBestHits(AnnotatedMSRun, ...)
  User->>IDFilter: keepHitsMatchingProteins(AnnotatedMSRun, ...)

  User->>IDMapper: annotate(AnnotatedMSRun, ...)
  User->>MSPFile: store(filename, AnnotatedMSRun)
Loading

Suggested labels

Review effort 2/5

Poem

In the warren of code, we hop and we wiggle,
Swapping nogil except + for except + nogil.
Annotated runs now lead the way,
As references leap to values today.
With tidy imports and comments in line,
This rabbit declares: the code’s looking fine!
🐇✨

Note

⚡️ AI Code Reviews for VS Code, Cursor, Windsurf

CodeRabbit now has a plugin for VS Code, Cursor and Windsurf. This brings AI code reviews directly in the code editor. Each commit is reviewed immediately, finding bugs before the PR is raised. Seamless context handoff to your AI code agent ensures that you can easily incorporate review feedback.
Learn more here.


Note

⚡️ Faster reviews with caching

CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 30th. To opt out, configure Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings.
Enjoy the performance boost—your workflow just got faster.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b33ec6a and 899283f.

📒 Files selected for processing (2)
  • .github/workflows/openms_ci_matrix_full.yml (1 hunks)
  • tools/ci/cibuild.cmake (2 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (6)
  • GitHub Check: build-and-test (macos-13, xcode, 14.2)
  • GitHub Check: build-and-test (macos-14, xcode, 15.0.1)
  • GitHub Check: build-and-test (windows-2022, cl.exe, 14.36)
  • GitHub Check: build-and-test (ubuntu-22.04, g++, 11)
  • GitHub Check: build-and-test (ubuntu-22.04, clang++, 15)
  • GitHub Check: cppcheck-test
🔇 Additional comments (3)
.github/workflows/openms_ci_matrix_full.yml (1)

416-416: Addition of COMPILE_PXDS variable to test pxds generation in CI

The new environment variable is conditionally set to "ON" only for pull requests targeting the develop branch on Ubuntu runners. This selective approach helps optimize CI resources by only running the pxds compilation when necessary.

tools/ci/cibuild.cmake (2)

110-110: LGTM: Added COMPILE_PXDS to environment variables list

This change properly adds the new COMPILE_PXDS variable to the list of environment variables that should be loaded from the environment.


187-190: Good implementation of conditional pxds compilation

This block correctly implements the conditional compilation of the "compile_pxds" target. The comment clearly explains why this is only done when PYOPENMS is not enabled (to avoid duplicate work since it's already a subtarget of pyopenms).


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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

🧹 Nitpick comments (4)
src/pyOpenMS/pxds/MSExperiment.pxd (1)

117-119: Changed return types from references to values

The range manager accessor methods now return values instead of references. This change:

  1. Makes the Python bindings more intuitive since Python doesn't have the concept of references
  2. Avoids potential memory management issues with references in Python bindings
  3. Provides a cleaner interface for Python users

Consider updating the method documentation to clarify that these methods return copies rather than references, especially since the documentation still says "Returns a reference to..."

src/pyOpenMS/pxds/AnnotatedMSRun.pxd (3)

32-34: Specifier order change is syntactically fine – keep it consistent across pxd files
Both nogil except + and except + nogil are valid in Cython; switching here is harmless.
Just double-check the other modified *.pxd files so all constructors use the same ordering – this prevents unnecessary churn in future diffs.


37-43: Consider returning / accepting const references to avoid extra copies
getProteinIdentifications() / getPeptideIdentifications() now return the whole std::vector by value and the setters take a non-const reference.
For large ID lists this causes a full copy on every getter call and prevents passing r-values to the setter.

-        libcpp_vector[ProteinIdentification] getProteinIdentifications() except + nogil
-        void setProteinIdentifications(libcpp_vector[ProteinIdentification]& ids) except + nogil
+        const libcpp_vector[ProteinIdentification]& getProteinIdentifications() except + nogil
+        void setProteinIdentifications(const libcpp_vector[ProteinIdentification]& ids) except + nogil

-        libcpp_vector[PeptideIdentification] getPeptideIdentifications() except + nogil
-        void setPeptideIdentifications(libcpp_vector[PeptideIdentification]& ids) except + nogil
+        const libcpp_vector[PeptideIdentification]& getPeptideIdentifications() except + nogil
+        void setPeptideIdentifications(const libcpp_vector[PeptideIdentification]& ids) except + nogil

Returning/accepting const& avoids the copy while still protecting the data.
If the copy semantics are required for capsule-safety in the Python layer, please add a short comment explaining this choice.


49-49: Potentially costly value return in operator[]
operator[] now returns a std::pair by value, meaning both the spectrum and peptide ID are copied on every index access.
Depending on typical use-cases this could be acceptable, but if random access is performance-critical consider returning a view/tuple of (const) references instead.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8b30bf3 and b33ec6a.

📒 Files selected for processing (12)
  • src/pyOpenMS/README_WRAPPING_NEW_CLASSES (1 hunks)
  • src/pyOpenMS/addons/MzMLFile.pyx (1 hunks)
  • src/pyOpenMS/addons/SequestOutfile.pyx (1 hunks)
  • src/pyOpenMS/pxds/AnnotatedMSRun.pxd (1 hunks)
  • src/pyOpenMS/pxds/ConsensusMap.pxd (1 hunks)
  • src/pyOpenMS/pxds/IDFilter.pxd (2 hunks)
  • src/pyOpenMS/pxds/IDMapper.pxd (4 hunks)
  • src/pyOpenMS/pxds/MSExperiment.pxd (1 hunks)
  • src/pyOpenMS/pxds/MSPFile.pxd (2 hunks)
  • src/pyOpenMS/pxds/RangeManager.pxd (0 hunks)
  • src/pyOpenMS/tests/unittests/test000.py (3 hunks)
  • tools/PythonExtensionChecker.py (5 hunks)
💤 Files with no reviewable changes (1)
  • src/pyOpenMS/pxds/RangeManager.pxd
⏰ Context from checks skipped due to timeout of 90000ms (6)
  • GitHub Check: build-and-test (windows-2022, cl.exe, 14.36)
  • GitHub Check: build-and-test (macos-13, xcode, 14.2)
  • GitHub Check: build-and-test (ubuntu-22.04, clang++, 15)
  • GitHub Check: build-and-test (ubuntu-22.04, g++, 11)
  • GitHub Check: build-and-test (macos-14, xcode, 15.0.1)
  • GitHub Check: cppcheck-test
🔇 Additional comments (22)
src/pyOpenMS/addons/SequestOutfile.pyx (1)

10-10: Standardized order of exception specifiers in comment.

The comment has been updated to use the except + nogil order instead of the previous order. This appears to be part of a broader standardization effort across the codebase to maintain consistent ordering of these specifiers.

src/pyOpenMS/README_WRAPPING_NEW_CLASSES (1)

35-36: Standardized order of exception specifiers in example code.

The example code has been updated to use the except + nogil order instead of the previous order. This change maintains consistency with the standardization effort applied throughout the codebase.

src/pyOpenMS/pxds/MSPFile.pxd (2)

5-5: Added import for AnnotatedMSRun.

Added import statement for AnnotatedMSRun which is now used as a parameter type in the store method.


14-14:

Details

✅ Verification successful

Updated parameter type from MSExperiment to AnnotatedMSRun.

The store method now accepts an AnnotatedMSRun reference instead of an MSExperiment reference. This change aligns with a broader pattern in the PR where several method parameters have been updated to use the more specific AnnotatedMSRun type.


🏁 Script executed:

#!/bin/bash
# Check if the C++ implementation of MSPFile has been updated to match this interface change
grep -A 5 "void store" $(find . -name "MSPFile.h" | grep -v build)

# Check for other instances of similar changes in the codebase
grep -r "AnnotatedMSRun" --include="*.pxd" src/pyOpenMS/pxds/

Length of output: 2207


store signature correctly updated to AnnotatedMSRun

Verified that in src/openms/include/OpenMS/FORMAT/MSPFile.h the C++ method signature has been updated to:

void store(const String & filename, const AnnotatedMSRun & exp) const;

which matches the .pxd change. No further action needed.

src/pyOpenMS/addons/MzMLFile.pyx (1)

16-19: Consistent ordering of Cython specifiers.

The reordering of nogil except + to except + nogil in these commented function declarations aligns with the PR's objective to fix pyopenms builds. This standardization ensures consistent specifier ordering across the codebase, which can help prevent subtle Cython compilation issues.

src/pyOpenMS/tests/unittests/test000.py (1)

42-49: Standardizing Cython exception and GIL specifier order

The changes here reorder the exception and GIL specifiers in the commented method declarations from nogil except + to except + nogil. This aligns with a broader pattern of standardization across the codebase to ensure consistent ordering of these specifiers.

This change is purely in the comments and has no functional impact on the test code, but it's important for consistency with the actual implementation in the .pxd files.

tools/PythonExtensionChecker.py (7)

199-199: Ordering of exception specification changed for consistency

The order of except + and nogil specifiers has been swapped to standardize the syntax across the codebase.


209-209: Ordering of exception specification changed for consistency

The order of except + and nogil specifiers has been swapped to standardize the syntax across the codebase.


489-490: Ordering of exception specification changed for consistency

The order of except + and nogil specifiers has been swapped to standardize the syntax across the codebase for both regular and static methods.


492-492: Ordering of exception specification changed for consistency

The order of except + and nogil specifiers has been swapped to standardize the syntax across the codebase.


501-501: Ordering of exception specification changed for consistency

The order of except + and nogil specifiers has been swapped to standardize the syntax for default constructor declarations.


503-505: Ordering of exception specification changed for consistency

The order of except + and nogil specifiers has been swapped to standardize the syntax for copy constructor declarations.


648-649: Ordering of exception specification changed for consistency

The order of except + and nogil specifiers has been swapped in the string replacement logic that generates Cython function declarations.

src/pyOpenMS/pxds/IDFilter.pxd (4)

13-14: Added import for AnnotatedMSRun

The import for AnnotatedMSRun has been added to support the type changes in the method signatures below.


179-179: Changed parameter type from MSExperiment to AnnotatedMSRun

The method now uses AnnotatedMSRun instead of MSExperiment as the experiment parameter type, which is more specific for representing experiment data with annotations.


181-181: Changed parameter type from MSExperiment to AnnotatedMSRun

The method now uses AnnotatedMSRun instead of MSExperiment as the experiment parameter type, which is more specific for representing experiment data with annotations.


187-187: Changed parameter type from MSExperiment to AnnotatedMSRun

The method now uses AnnotatedMSRun instead of MSExperiment as the experiment parameter type, which is more specific for representing experiment data with annotations.

src/pyOpenMS/pxds/IDMapper.pxd (5)

10-11: Added import for AnnotatedMSRun

The import for AnnotatedMSRun has been added to support the type changes in the method signatures below.


24-28: Changed parameter type from MSExperiment to AnnotatedMSRun

The first parameter of the annotate method has been changed from MSExperiment to AnnotatedMSRun, which is more specific for representing experiment data with annotations.


37-38: Updated documentation to reflect parameter type change

The documentation has been correctly updated to mention AnnotatedMSRun instead of MSExperiment.


45-48: Changed parameter type from MSExperiment to AnnotatedMSRun

The first parameter of the annotate method overload has been changed from MSExperiment to AnnotatedMSRun, which is more specific for representing experiment data with annotations.


59-60: Updated documentation to reflect parameter type change

The documentation has been correctly updated to mention AnnotatedMSRun instead of MSExperiment.

Comment thread src/pyOpenMS/pxds/ConsensusMap.pxd Resolved
Comment thread src/pyOpenMS/pxds/AnnotatedMSRun.pxd Resolved
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
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