Skip to content

fixes failing pyopenms tests on Windows when -DNO_DEPENDENCIES=ON, - #9738

Merged
timosachsenberg merged 1 commit into
OpenMS:developfrom
cbielow:py_win-fixes
Jul 14, 2026
Merged

timosachsenberg merged 1 commit into
OpenMS:developfrom
cbielow:py_win-fixes

Conversation

@cbielow

@cbielow cbielow commented Jul 14, 2026 •

Copy link
Copy Markdown
Contributor

fixes #9732

The easy fix would be to always use NO_DEPENDENCIES=OFF when building (except when creating the pyopenms wheel).
But I wanted the pyopenms tests to always work, no matter the state of NO_DEPENDENCIES.
This does it.
There is a ton of code around NO_DEPENDENCIES, which fixes/undoes stuff, and this could be cleaned up or unified, maybe, with MacOS etc?! Not sure...

History:
NO_DEPENDENCIES originally introduced in #5780, and switched to 'OFF' by default in #8530 (thanks Claude)

CI Matrix only uses 'OFF' for Ubuntu: https://github.com/OpenMS/OpenMS/blob/develop/.github/workflows/openms_ci_matrix_full.yml#L285

Description

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

  • Bug Fixes

    • Improved Windows support by ensuring required dynamic libraries are located automatically when importing pyOpenMS.
    • Resolved issues that could prevent pyOpenMS modules and tests from running when dependencies are installed in separate directories.
  • Improvements

    • Standardized the placement of generated pyOpenMS modules across different build configurations.
    • Increased reliability for unit, integration, documentation, and feature tests on Windows.

@cbielow
cbielow requested a review from jpfeuffer July 14, 2026 12:57
@coderabbitai

coderabbitai Bot commented Jul 14, 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: 5e02deec-c45d-4c08-bc88-349c499d37a2

📥 Commits

Reviewing files that changed from the base of the PR and between 1ae0562 and d94741c.

📒 Files selected for processing (2)
  • src/pyOpenMS/CMakeLists.txt
  • src/pyOpenMS/pyopenms/__init__.py

📝 Walkthrough

Walkthrough

Changes

Windows pyOpenMS DLL resolution

Layer / File(s) Summary
Generated module output layout
src/pyOpenMS/CMakeLists.txt
Nanobind-generated modules use multi-config-compatible library and runtime output paths.
Test-time DLL search setup
src/pyOpenMS/CMakeLists.txt, src/pyOpenMS/pyopenms/__init__.py
Windows pyOpenMS tests receive dependent DLL directories through PYOPENMS_DLL_PATH, which pyopenms registers during import.

Sequence Diagram(s)

sequenceDiagram
  participant CTest
  participant PythonTests
  participant pyopenms_init as pyopenms.__init__
  participant WindowsDLLLoader as os.add_dll_directory
  CTest->>PythonTests: Set PYOPENMS_DLL_PATH and launch pytest
  PythonTests->>pyopenms_init: Import pyopenms
  pyopenms_init->>WindowsDLLLoader: Register valid DLL directories
  WindowsDLLLoader-->>pyopenms_init: Keep directory handles alive
Loading

Suggested reviewers: jpfeuffer, timosachsenberg

Poem

A rabbit hops through build paths bright,
And tucks DLLs where tests take flight.
Python opens every door,
Windows finds the files once more.
CMake guides the way—
Hoppy tests all pass the day!

🚥 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 states the main Windows pyOpenMS test failure fix and the NO_DEPENDENCIES setting involved.
Linked Issues check ✅ Passed The CMake and init.py changes address the Windows DLL loading failures described in #9732 and should make pyOpenMS tests pass.
Out of Scope Changes check ✅ Passed The edits stay focused on pyOpenMS Windows test execution and DLL discovery, with no obvious unrelated changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@jpfeuffer

Copy link
Copy Markdown
Contributor

makes sense. no one should use NO_DEPENDENCIES=ON on Windows. Doesn't really make sense there since the dlls do not know about each other or have RPaths. Was luck that it ever worked.

@timosachsenberg
timosachsenberg merged commit 7e0c749 into OpenMS:develop Jul 14, 2026
41 checks passed
timosachsenberg added a commit that referenced this pull request Jul 15, 2026
, #9740 (#9744)

Backfills changelog entries for a SQLite private-dependency change, a
ROCCurve::cutoffNeg fix, a pyOpenMS Windows NO_DEPENDENCIES test fix,
and the Ghostscript-to-MathJax documentation build change, none of
which had CHANGELOG entries yet.


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

Co-authored-by: Claude <[email protected]>
@pjones

pjones commented Jul 16, 2026

Copy link
Copy Markdown
Contributor

Thank you @cbielow! This fixed the issue for me.

timosachsenberg added a commit that referenced this pull request Jul 17, 2026
* docs(changelog): add entries for #9492, #9752

Backfills two CHANGELOG entries for recently merged PRs that landed
without their own entry:
- #9752: new BUILD_TOPP_TOOLS / INSTALL_OPENMS_EXAMPLES CMake options
  enabling a core-only OpenMS SDK build
- #9492: null-dereference guards in TargetedExperiment::get*ByRef and
  ReactionMonitoringTransition::getPrediction

All other PRs merged since the last CHANGELOG update (#9613, #9750,
#9738) already carried their own entries; #9572 is test-only and
follows the existing convention of not adding a changelog entry for
test-only PRs in this series.

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

* Update CHANGELOG

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

---------

Co-authored-by: Claude <[email protected]>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
jcharkow pushed a commit to jcharkow/OpenMS that referenced this pull request Aug 12, 2026
…S#9753)

* docs(changelog): add entries for OpenMS#9492, OpenMS#9752

Backfills two CHANGELOG entries for recently merged PRs that landed
without their own entry:
- OpenMS#9752: new BUILD_TOPP_TOOLS / INSTALL_OPENMS_EXAMPLES CMake options
  enabling a core-only OpenMS SDK build
- OpenMS#9492: null-dereference guards in TargetedExperiment::get*ByRef and
  ReactionMonitoringTransition::getPrediction

All other PRs merged since the last CHANGELOG update (OpenMS#9613, OpenMS#9750,
OpenMS#9738) already carried their own entries; OpenMS#9572 is test-only and
follows the existing convention of not adding a changelog entry for
test-only PRs in this series.

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

* Update CHANGELOG

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

---------

Co-authored-by: Claude <[email protected]>
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.

Tests fail on Windows when -DPYOPENMS=ON

4 participants