Repository navigation
Fix pyOpenMS import failure when built with WITH_WNETALIGN=OFF - #9957
Merged
Merged
Conversation
With -DWITH_WNETALIGN=OFF, WNetMatcher.cpp and FeatureGroupingAlgorithmWNet.cpp are excluded from libOpenMS, but bind_misc.cpp still referenced their symbols unconditionally. Shared modules resolve symbols lazily, so the build succeeded and every 'import pyopenms' then failed with an undefined-symbol ImportError in _pyopenms_misc (issue #9946). Guard the WNet includes and bindings with #ifdef WITH_WNETALIGN, using the macro already exported through OpenMS/config.h (the same mechanism ToolHandler.cpp uses to conditionally register FeatureLinkerWNet), and document the availability plus the hasattr() feature-detection idiom in the affected docstrings, following the WITH_OPENTIMS/BrukerTimsFile precedent. No CMake changes are needed: config.h already carries '#cmakedefine WITH_WNETALIGN 1' and is installed alongside the other headers, so the guard works both for in-tree pyOpenMS builds and for standalone wheel builds against an installed OpenMS. Fixes #9946 Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01TdWTAurDnbxsMorHTuCQTT
Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01TdWTAurDnbxsMorHTuCQTT
Contributor
|
Warning Review limit reachedNext included review available in 14 minutes. View limit detailsLimit details: You’ve used all 4 included reviews currently available. You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Review configuration: ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
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. Comment |
4 tasks done
timosachsenberg
pushed a commit
that referenced
this pull request
Sep 24, 2026
… builds Extends the previous commit from the pull request builds to every build the repository runs: the Release workflow no longer turns WITH_WNETALIGN back on, the pyOpenMS wheel workflow configures OpenMS with WITH_WNETALIGN=OFF for every event, and the container image passes it too. The installers, the wheels and the images therefore no longer contain FeatureLinkerWNet or the WNetMatcher / FeatureGroupingAlgorithmWNet bindings (pyopenms feature-detects those with hasattr since #9957). The CMake default is unchanged (ON), so source builds keep the feature, and a manual run of the Build and Test workflow can still opt in through its wnetalign input. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0141tQxVx5GENqUuU8zJh2NT
timosachsenberg
added a commit
that referenced
this pull request
Sep 24, 2026
…F) (#10255) * [CI] Leave the WNet alignment out of CI builds by default The ci presets, which the Build and Test and the Release workflows share, set WITH_WNETALIGN=OFF and no longer request the wnetalign vcpkg feature, so pull request CI neither fetches pylmcf/wnet/wnetalign nor compiles FeatureLinkerWNet and its classes. The pyOpenMS wheel workflow passes WITH_WNETALIGN=OFF for pull requests as well. What is shipped does not change. The build action gains a wnetalign input that turns the option back on; the Release workflow sets it, so the installers keep FeatureLinkerWNet, and CMake then fetches the same pinned versions the vcpkg ports install. Wheels built for nightly, tags and manual runs keep the WNet bindings, and the container and bioconda builds, which rely on the CMake default (ON), are untouched. A manual run of Build and Test can opt in through a workflow_dispatch input. The CI presets build the documentation, which did not work with WITH_WNETALIGN=OFF: - DefaultParamHandlerDocumenter documented FeatureGroupingAlgorithmWNet unconditionally, so it failed to link against a libOpenMS without the class. The class is now documented only when WITH_WNETALIGN is defined. - FeatureLinkerWNet's page includes the command line and INI documentation TOPPDocumenter writes, and FeatureGroupingAlgorithmWNet's the parameter table DefaultParamHandlerDocumenter writes. Neither is written without the WNet alignment, and doxygen's three "included file ... is not found" warnings would fail Doxygen_Warning_test. As for WITH_GUI (#10241), these parts are marked @if WITH_WNETALIGN and doc/CMakeLists.txt enables that section when the option is on. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0141tQxVx5GENqUuU8zJh2NT * [CI] Leave the WNet alignment out of the release, wheel and container builds Extends the previous commit from the pull request builds to every build the repository runs: the Release workflow no longer turns WITH_WNETALIGN back on, the pyOpenMS wheel workflow configures OpenMS with WITH_WNETALIGN=OFF for every event, and the container image passes it too. The installers, the wheels and the images therefore no longer contain FeatureLinkerWNet or the WNetMatcher / FeatureGroupingAlgorithmWNet bindings (pyopenms feature-detects those with hasattr since #9957). The CMake default is unchanged (ON), so source builds keep the feature, and a manual run of the Build and Test workflow can still opt in through its wnetalign input. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0141tQxVx5GENqUuU8zJh2NT * Make the WNet alignment opt-in: WITH_WNETALIGN defaults to OFF WITH_WNETALIGN now defaults to OFF, so no build fetches pylmcf/wnet/wnetalign or compiles FeatureLinkerWNet and its classes unless it is configured with -DWITH_WNETALIGN=ON. This replaces the per-build switches of the two previous commits: the wheel workflow and the container image rely on the default again, the build action's wnetalign input and the manual opt-in of the Build and Test workflow are gone, and the Release workflow is as on develop. The ci presets keep WITH_WNETALIGN=OFF explicitly, like WITH_ONNX, and do not request the wnetalign vcpkg feature. The documentation that stated the old default is updated: the CHANGELOG (dependencies, FeatureLinkerWNet and the library entry), the CMake parameter reference, AGENTS.md and the pyOpenMS docstrings. FeatureLinkerWNet's page and FeatureGroupingAlgorithmWNet's class documentation note that they are only built with the option. The documenter guard and the @if WITH_WNETALIGN sections from the first commit are what let the documentation of a default build pass Doxygen_Warning_test. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0141tQxVx5GENqUuU8zJh2NT * CHANGELOG: keep the WITH_WNETALIGN qualifier off PipEchoAlgorithm The library entry listed PipEchoAlgorithm and the WNet classes together under one WITH_WNETALIGN=ON qualifier, which reads as if PipEchoAlgorithm needed the option too; it is built unconditionally. Split the entry so the qualifier covers only FeatureGroupingAlgorithmWNet/WNetMatcher (CodeRabbit review on #10255). Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_0141tQxVx5GENqUuU8zJh2NT --------- Co-authored-by: Claude <[email protected]>
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
Fixes #9946.
Building with
-DWITH_WNETALIGN=OFFexcludesWNetMatcher.cppandFeatureGroupingAlgorithmWNet.cppfrom libOpenMS, butbind_misc.cppreferenced their symbols unconditionally. Since shared modules resolve symbols lazily, the build succeeded with zero errors and everyimport pyopenmsthen failed with an undefined-symbolImportErrorin_pyopenms_misc— making the entire package unusable.The fix: guard the WNet includes and the
WNetMatcherDistanceMetric/WNetMatchResult/WNetMatcher/FeatureGroupingAlgorithmWNetbindings with#ifdef WITH_WNETALIGN, and note the availability plus thehasattr(pyopenms, "WNetMatcher")feature-detection idiom in the docstrings — the same pattern used forBrukerTimsFile/WITH_OPENTIMS.Why no CMake change (deviating from the approach sketched in the issue):
config.h.inalready carries#cmakedefine WITH_WNETALIGN 1, whichToolHandler.cppalready uses to conditionally registerFeatureLinkerWNet. Reusing that macro (via an explicit#include <OpenMS/config.h>) needs no build-system change and also works for standalone wheel builds against an installed OpenMS, whereconfig.his installed with the headers. ExportingOPENMS_HAS_WNETALIGNpublicly would have added a second, redundant mechanism — that macro is currently defined but referenced nowhere.Verified locally on Ubuntu 24.04 / GCC 13.3 (the issue's repro environment) with
-DCMAKE_BUILD_TYPE=Release -DWITH_GUI=OFF -DPYOPENMS=ON -DWITH_WNETALIGN=OFF:import pyopenmssucceeds; all four WNet names are absent and feature-detectable viahasattrnm -D _pyopenms_misc.soshows zero WNet symbol references (previouslyU OpenMS::WNetMatcher::metricFromString(...))WITH_WNETALIGN=ONpath compiles the identical binding set as before (CI exercises that configuration)Checklist
Generated by Claude Code