You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Use a single path argument (and deprecate pn_dir and file_name) #534
I think the reason for having two arguments is to support auto-detection of files (e.g. get locally if local and if not get from the PhysioNet servers). This kind of behaviour doesn't seem like a good idea. If WFDB is retrieving a remote file, it should be explicit.
My preference would be to:
Introduce a new path argument
Deprecate pn_dir and file_name
Remove any logic that automatically retrieves files from remote servers.
Where do you see that happening? I don't think that's right or at least not intended.
This is based on my recollection of discussing the project with Chen when the project started. I may well be wrong! I'll spend a bit more time thinking about this (but the original point still stands...I think we should clean up the API).
Most of this is now in place. The first argument (record_name) already works as a single path: it takes a local path, a cloud URI (s3://, gs://, az://, memory://), a .wfdb archive, and since 5.1.0 a PhysioNet URI such as physionet://mitdb/1.0.0/100. So I'd suggest making that argument the one way to say where a record is, rather than adding a separate path argument, which would be a third way to say the same thing.
On the other two points:
Automatic fallback: as @bemoody said, nothing falls back from local files to PhysioNet. Remote reads only happen with pn_dir or a URI.
file_name: no reading function takes it as a location argument now, so it's only pn_dir that remains.
Decide about set_db_index_url.pn_dir is the only way to read from a custom server. Options: let the physionet package take a base URL, keep pn_dir only for that, or drop support for custom servers.
Use physionet:// URIs in the docs and examples. This also states the version explicitly (or latest), whereas pn_dir="mitdb" silently uses whatever is newest.
Then deprecate pn_dir, with a warning that gives the exact equivalent URI (database, version, folders and record name), so updating code is a copy and paste. Remove it in a major release.
If the first argument is renamed (#672), that should happen in the same pass, so that nothing is renamed twice. The unused DataSource registry (#367) could be removed at the same time, since URIs and fsspec cover what it was meant for.
The path migration is now in 5.12.0. The newer readers use a single path argument for local files, archives, cloud URIs, and physionet:// URIs. Explicit HTTP(S) URLs also cover custom servers without combining set_db_index_url(...) and pn_dir. Legacy pn_dir calls still work but now emit a FutureWarning with a replacement path when one can be constructed. A missing local path does not fall back to PhysioNet. #826 updates the README to match the released behavior. I am closing this issue as the requested API and migration path are available; any further removal of legacy names belongs to the later major-release decision in #672.
Activity
bemoody commentedon Apr 3, 2025
For most APIs, I think, the first argument is called
record_name. Notfile_name, because it isn't a file name.Where do you see that happening? I don't think that's right or at least not intended.
tompollard commentedon Apr 3, 2025
This is based on my recollection of discussing the project with Chen when the project started. I may well be wrong! I'll spend a bit more time thinking about this (but the original point still stands...I think we should clean up the API).
tompollard commentedon Apr 28, 2025
This issue looks related, so just making a note here: #367
tompollard commentedon Nov 24, 2026
An update, and a proposed plan.
Most of this is now in place. The first argument (
record_name) already works as a single path: it takes a local path, a cloud URI (s3://,gs://,az://,memory://), a.wfdbarchive, and since 5.1.0 a PhysioNet URI such asphysionet://mitdb/1.0.0/100. So I'd suggest making that argument the one way to say where a record is, rather than adding a separatepathargument, which would be a third way to say the same thing.On the other two points:
pn_diror a URI.file_name: no reading function takes it as a location argument now, so it's onlypn_dirthat remains.Proposed plan for
pn_dir:pn_diralso takes aphysionet://URI. All butread_edf,rdedfannandread_wavalready did; Read EDF and WAV files from physionet:// and other URIs #674 covers those three.set_db_index_url.pn_diris the only way to read from a custom server. Options: let thephysionetpackage take a base URL, keeppn_dironly for that, or drop support for custom servers.physionet://URIs in the docs and examples. This also states the version explicitly (orlatest), whereaspn_dir="mitdb"silently uses whatever is newest.pn_dir, with a warning that gives the exact equivalent URI (database, version, folders and record name), so updating code is a copy and paste. Remove it in a major release.If the first argument is renamed (#672), that should happen in the same pass, so that nothing is renamed twice. The unused
DataSourceregistry (#367) could be removed at the same time, since URIs andfsspeccover what it was meant for.Read EDF and WAV files from physionet:// and other URIs (#674)
Read EDF and WAV files from physionet:// and other URIs
Document source location contract for record I/O (#780)
Add readable read_annotations API (#783)
Add list_databases using physionet.list_projects (#816)
Read WFDB files from explicit HTTP URLs (#817)
Warn on pn_dir and suggest explicit read paths (#818)
Clarify explicit remote paths and read/write round trips (#819)
tompollard commentedon Dec 1, 2026
The path migration is now in 5.12.0. The newer readers use a single
pathargument for local files, archives, cloud URIs, andphysionet://URIs. Explicit HTTP(S) URLs also cover custom servers without combiningset_db_index_url(...)andpn_dir. Legacypn_dircalls still work but now emit aFutureWarningwith a replacement path when one can be constructed. A missing local path does not fall back to PhysioNet. #826 updates the README to match the released behavior. I am closing this issue as the requested API and migration path are available; any further removal of legacy names belongs to the later major-release decision in #672.Update README guidance for explicit source paths (#826)