Skip to content

Warn on pn_dir and suggest explicit read paths - #818

Merged
tompollard merged 2 commits into
mainfrom
deprecate-pn-dir
Dec 1, 2026
Merged

tompollard merged 2 commits into
mainfrom
deprecate-pn-dir

Conversation

@tompollard

Copy link
Copy Markdown
Member

Summary

  • Emit one FutureWarning when a public reader is called with pn_dir. The warning suggests a physionet:// path or a complete HTTP URL for a custom server when the replacement can be formed without a network request.
  • Keep pn_dir calls working. Suppress warnings from internal reader calls, including download_records.
  • Update the remote-reading guide and add a changelog entry.

This is stacked on #817, which adds explicit HTTP URL reads for custom servers. Merge #817 first, then retarget this PR to main. Related to #534 and #672.

Checks

  • Offline suite: 1,543 passed, 4 skipped.
  • Ruff check and format: passed.
  • Sphinx HTML build with warnings as errors: passed.

Base automatically changed from explicit-http-record-paths to main December 1, 2026 04:04

@tompollard tompollard left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Thanks. The suggested replacements are correct and copyable: rdheader("100", pn_dir="mitdb") suggests physionet://mitdb/latest/100, which reads fine live (a version-less physionet://mitdb/100 doesn't, so including latest is needed), and a custom index gives the full https:// URL. Each public call warns exactly once at the caller's line (checked rdrecord, ann2rr, bxb_record), while download_records and dl_database stay silent despite using pn_dir internally. FutureWarning seems the right category for end users. The offline suite, Ruff and the strict docs build pass locally on the rebased branch.

Two small things:

  • The suite now emits 19 FutureWarnings, and with -W error::FutureWarning 12 existing tests fail. Wrapping those pn_dir tests in pytest.warns(FutureWarning) (or filterwarnings) would keep the output clean and assert the warning.
  • docs/io.rst still presents pn_dir calls (wfdb.rdrecord("100", pn_dir="mitdb") and the mimic-iv-ecg examples in the "Reading From PhysioNet" section) without saying they're deprecated. Showing the physionet:// form, or labelling those as legacy, would match the warning.

@tompollard

Copy link
Copy Markdown
Member Author

Thanks — I addressed both points in fa873fe.

The existing pn_dir tests now assert the FutureWarning. The full offline suite also passes with -W error::FutureWarning: 1,545 passed, 4 skipped, with no warning summary. I updated the PhysioNet guide to lead with explicit physionet:// paths and subfolder examples, and marked the pn_dir examples as legacy.

Ruff and the strict Sphinx build pass too.

@tompollard
tompollard merged commit 81da734 into main Dec 1, 2026
19 checks passed
@tompollard
tompollard deleted the deprecate-pn-dir branch December 1, 2026 04:07
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.

1 participant