Repository navigation
Deprecate the legacy function names - #830
Merged
Merged
Conversation
Calling rdrecord, rdsamp, rdheader, rdann, wrsamp, wrann, Record.wrsamp, Annotation.wrann, dl_database, get_record_list, get_dbs, show_ann_labels, show_ann_classes or processing.Comparitor now emits a DeprecationWarning naming the newer function. Calls made by the package itself stay silent. The warning helpers live in a new wfdb.io._deprecation module, shared with the pn_dir warning, so stacked wrappers find the real caller: both warnings are emitted and point at the user's line. show_ann_labels and show_ann_classes become thin wrappers, and Comparitor resolves through a module __getattr__ so old pickles still load.
tompollard
force-pushed
the
deprecate-legacy-api
branch
from
December 1, 2026 06:10
a3ec21e to
9d8fbfa
Compare
Member
Author
|
Two points I'd address before merging:
The new warning tests pass locally (6 passed), and the warning locations and internal-call suppression look sound. |
Star imports of wfdb.processing and wfdb.processing.evaluate provide Comparitor again, through __all__, and warn when importing it that way. rdheader and the module-level wrsamp and wrann no longer warn: their newer counterparts do not cover rd_segments=True or writing directly from arrays. The guide explains what replaces them and what does not yet.
Member
Author
|
Thanks, both were right. Fixed in 09c742d:
I also updated the changelog and the PR description. The offline suite (1,590 passed), Ruff and the strict docs build pass. |
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.
Summary
Start deprecating the legacy function names from #672. Calling one of these now emits a
DeprecationWarningthat names its replacement:rdrecord,rdsamp,rdannread_record,read_signals,read_annotationsRecord.wrsampRecord.writeAnnotation.wrannAnnotation.writedl_database,get_record_list,get_dbsdownload_records,list_records,list_databasesshow_ann_labels,show_ann_classesshow_annotation_labels,show_annotation_classesprocessing.Comparitorprocessing.ComparatorDeprecationWarning, notFutureWarning: Python shows it in scripts, notebooks and test suites, but not by default when the call comes from another installed package, so users of downstream libraries aren't flooded. A later release can switch toFutureWarningbefore removal in a major version.mrgann, the processing helpers and plotting still use some legacy implementations internally without warning.rdheader(no replacement forrd_segments=True), the module-levelwrsampandwrann(which take arrays directly),mrgannandMultiRecord.wrsamp;dl_files(covered byphysionet.download); and the legacy attribute and argument names.pn_dirwarning: the helpers now live inwfdb.io._deprecationand are shared with thepn_dirdecorator. With two stacked wrappers, each one finds the real caller, sordrecord("100", pn_dir=...)emits both aDeprecationWarningand aFutureWarning, each pointing at the user's line. Python 3.11 is still supported, so this doesn't rely onskip_file_prefixes.show_ann_labelsandshow_ann_classesbecome thin wrappers instead of identical aliases.Comparitorresolves through a module__getattr__inwfdb.processingandwfdb.processing.evaluate, so old pickles still load (with a warning).__all__keepsComparitorin star imports of both modules, which warn at the import.tests/test_legacy_deprecations.pychecks the warnings explicitly.The warning messages refer to the migration guide added in #829.
Checks
DeprecationWarningas an error; oldComparitorpickles load.rdrecordshows the warning at its own line, while the same call from an imported library module stays silent under default filters.import wfdbis clean with-W error::DeprecationWarning.@tompollard 🟥 red 🦥 sloth · aspen