Skip to content

Read WFDB archives from remote URIs - #832

Merged
tompollard merged 2 commits into
mainfrom
feature/remote-archive-read
Dec 1, 2026
Merged

tompollard merged 2 commits into
mainfrom
feature/remote-archive-read

Conversation

@tompollard

Copy link
Copy Markdown
Member

Summary

  • Read .wfdb archives from HTTP URLs, supported cloud URIs, and physionet:// URIs through the existing seekable fsspec opener.
  • Keep the underlying remote file open for the archive's lifetime and close it with the ZIP reader. HTTP servers must support byte-range requests; remote archive writing remains unsupported.
  • Handle archive URLs with query parameters, update the read API documentation, and add a changelog entry.

Verification

  • Full offline suite: 1,596 passed, 4 skipped (WFDB bxb unavailable), 23 deselected.
  • Archive, annotation, and remote I/O tests: 131 passed.
  • Strict Sphinx build, Ruff lint and formatting: passed.

Tests cover remote record, signal, header, annotation, and multi-segment reads; partial signal reads; HTTP byte ranges; and an HTTP server that does not support ranges.

@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. Remote archive reads match local ones, including from a gzip-capable server (allow_gzip=True), and the legacy rdann, iter_dataframes, read_channel_header and a preserved multi-segment read (segment_views) all work against an HTTP archive too. Remote writes and servers without byte ranges fail clearly. The offline suite, Ruff and the strict docs build pass locally.

Two things I'd change:

  • HTTP reads fetch large blocks. The partial-read test uses memory://. Over HTTP, reading 100 frames from a 16 MB archive fetched 13.25 MB (5 requests), because fsspec's HTTP file uses 5 MB blocks. Passing a smaller block_size for http(s):// opens in _fsspec_open fixes it: 1 MB fetched 2.10 MB, 256 KB fetched 0.53 MB and 64 KB fetched 0.14 MB, all in 5 requests with identical results. Could you set something around 256 KB, and add an HTTP version of the partial-read test that checks the bytes served?
  • Signed URLs. docs/io.rst (around line 992) still says HTTP URLs with query strings "are not supported", but this PR reads archives from them (?token=demo in the test). It would be worth saying that query-string URLs work for .wfdb archives, since they're a single file, but not for multi-file records.

@tompollard

Copy link
Copy Markdown
Member Author

Thanks for checking these cases. I addressed both points in 1778fb0.

  • HTTP and physionet:// archive reads now use 256 KB blocks. Other file reads keep their existing settings. The HTTP test uses an archive over 16 MB, counts response bytes at the server, and verifies that a 100-frame read transfers under 2 MB while returning the same values as a local read.
  • The HTTP documentation now says that query-string URLs work for .wfdb archives, where the URL identifies one file, but remain unsupported for records with separate header and signal files.

The full offline suite passes (1,596 passed, 4 skipped), as do Ruff and the strict docs build.

@tompollard
tompollard merged commit 580fa9e into main Dec 1, 2026
19 checks passed
@tompollard
tompollard deleted the feature/remote-archive-read branch December 1, 2026 15:25
tompollard added a commit that referenced this pull request Dec 1, 2026
## Summary

- Bump the package version to 5.14.0.
- Collect the changelog entries from #832 and #833 into the release
notes.

This release adds remote `.wfdb` archive reading and clarifies
multi-segment read coordinates and provenance. After merging, publish a
GitHub release tagged `v5.14.0` to trigger the configured PyPI workflow.

## Verification

- Strict Sphinx docs build: passed.
- Source distribution and wheel build: passed.
- Ruff lint and formatting: passed.
- #832 and #833 CI checks: passed before merge.
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