Repository navigation
Import wfdb lazily: import braindecode.datasets no longer fails under -W error::DeprecationWarning with pandas 3.1 - #1524
Merged
bruAristimunha merged 1 commit intoNov 2, 2026
Conversation
bruAristimunha
added a commit
to bruAristimunha/braindecode
that referenced
this pull request
Nov 2, 2026
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The changelog still contains an XXXX placeholder that produces an incorrect GitHub link instead of linking to the relevant PR.
1 open issue
What changed in this PR
This PR defers importing wfdb until a PhysioNet Challenge 2018 recording is loaded, preventing its pandas-related deprecation warning from breaking dataset imports when warnings are treated as errors.
Changes:
- Move the
wfdbimport into_load_raw. - Add a fresh-interpreter regression test verifying dataset imports do not load
wfdb. - Document the fix in the changelog.
| File | Description |
|---|---|
test/unit_tests/test_lazy_imports.py |
Add regression coverage for lazy wfdb loading. |
docs/whats_new.rst |
Describe the import-related bug fix. |
braindecode/datasets/sleep_physio_challe_18.py |
Import wfdb only when loading recordings. |
Review effort: Balanced
import braindecode.datasets imported wfdb at module level, although only SleepPhysionetChallenge2018._load_raw uses it. With pandas 3.1 wfdb's import emits a DeprecationWarning (Pandas4Warning), so python -W error::DeprecationWarning -c 'import braindecode.datasets' failed.
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #1524 +/- ##
==========================================
- Coverage 91.34% 91.34% -0.01%
==========================================
Files 170 170
Lines 22105 22105
==========================================
- Hits 20192 20191 -1
- Misses 1913 1914 +1 🚀 New features to boost your workflow:
|
bruAristimunha
force-pushed
the
bd2deep/lazy-wfdb
branch
from
November 2, 2026 17:18
bf6516f to
fc551d0
Compare
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.

import braindecode.datasetsimportedwfdbat module level, although onlySleepPhysionetChallenge2018._load_rawuses it. With pandas 3.1, wfdb's own import emits aPandas4Warning(aDeprecationWarning), sofailed on an up-to-date stack (found by the 2.0 release audit, installed wheel, Python 3.14 / pandas 3.1).
wfdbis imported inside_load_raw.test_import_datasets_does_not_load_wfdb(fresh interpreter, like the other lazy-import tests).Verified in a Voyager Job:
pre-commit run --fileson the changed files exits 0;test_lazy_imports.py,test_dependencies.py,test_sleep_physionet.py: 10 passed, 5 skipped.