Skip to content

Require explicit layout on read_record - #858

Merged
tompollard merged 2 commits into
mainfrom
require-read-record-layout
Dec 2, 2026
Merged

tompollard merged 2 commits into
mainfrom
require-read-record-layout

Conversation

@tompollard

Copy link
Copy Markdown
Member

Summary

Require layout="uniform" or layout="expanded" on read_record, matching read_signals. Uniform layout averages multiple samples within a frame, so the choice should be explicit before the modern API settles. rdrecord keeps its existing default.

This updates the tests and documentation examples that relied on the previous default, and adds a migration note and changelog entry. It changes the behavior available since 5.14.0: calling read_record(path) now raises TypeError until a layout is supplied.

Verification

  • Offline suite: 1,716 passed, 4 skipped, 23 deselected.
  • Ruff check and format pass.
  • Sphinx HTML build passes with warnings treated as errors.

Related: #852.

@tompollard
tompollard force-pushed the require-read-record-layout branch from d69a095 to 44277c5 Compare December 2, 2026 15:51

@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.

This matches what we agreed in #852: read_record and read_signals now both require layout, and rdrecord keeps its default. The changelog entry needs a format fix; otherwise it's ready to merge.

What I checked

  • read_record("sample-data/100") now raises TypeError: read_record() missing 1 required keyword-only argument: 'layout', and rdrecord is unchanged.
  • I parsed every read_record( call in README.md, docs/*.rst and the src docstrings, including multi-line calls. All of them now pass layout, apart from prose that uses read_record(..., channels=[...]). The library doesn't call read_record internally without layout.
  • 44277c5 fixes the README example that Ruff reformats; the style job failed on d69a095 and passes now.
  • It merges cleanly with #859.
  • The offline suite (1,716 passed, 4 skipped), Ruff, the strict docs build and CI pass.

Changelog format

changelog.d/require-read-record-layout.rst uses a Changed heading with a bullet, but changelog.d/README.rst asks for a bold heading and an indented paragraph. I simulated the release: I merged this PR, #859 and #860 onto main, ran towncrier build --version 9.9.9, and built the docs with -W. Each of the three entries puts an indented Changed / ------- (or Fixed / -----) pair into docs/changes.rst, and the strict build fails with ERROR: Unexpected section title or transition. at each one. For example:

**Require a layout in read_record**
  ``read_record`` now requires ``layout="uniform"`` or ``layout="expanded"``,
  matching ``read_signals``; uniform layout averages samples within a frame.
  This changes behavior available since 5.14.0; ``rdrecord`` keeps its default.

#859 and #860 have the same format issue.

@tompollard

Copy link
Copy Markdown
Member Author

Thanks for catching the changelog format. I updated the fragment in 5cca215 to use the required bold heading and indented paragraph. I also ran towncrier build --draft --version 9.9.9 and checked that the rendered release notes parse as reStructuredText. I made the same fix on #859 and #860.

@tompollard
tompollard merged commit 3250111 into main Dec 2, 2026
19 checks passed
@tompollard
tompollard deleted the require-read-record-layout branch December 2, 2026 16:11
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