Skip to content

Fix documentation warnings, unify docstring style and use a src layout - #589

Merged
tompollard merged 6 commits into
MIT-LCP:mainfrom
cbrnr:docs-and-docstrings
Oct 28, 2026
Merged

tompollard merged 6 commits into
MIT-LCP:mainfrom
cbrnr:docs-and-docstrings

Conversation

@cbrnr

@cbrnr cbrnr commented Oct 28, 2026 •

Copy link
Copy Markdown
Contributor

This is the last part of the cleanup that started with #578, #580, #581, #582 and #588. It builds the documentation without warnings, applies one docstring style everywhere, and moves the package to a src layout. Each commit can be reviewed on its own.

  1. Fix all Sphinx documentation warnings. The docs build reported 94 warnings. They are fixed, and the docs workflow now builds with -W --keep-going so they stay fixed.
    • Duplicate object descriptions: repeated automodule directives and the classes documented on both the wfdb and io pages are marked :no-index:, so each object is indexed once.
    • numpydoc_class_members_toctree = False, because the autosummary stubs it links to do not exist.
    • Too short title underlines, and reStructuredText errors in docstrings (lists, literal blocks for the EDF/MATLAB/WAV format descriptions and tables, doctest continuation lines).
    • The :no-index: option needs Sphinx 7.2, so the pinned Sphinx version of the docs group goes from 7.0.0 to 7.2.6.
  2. Wrap docstrings and comments at 88 columns, the same width as the code, and enable W505 in Ruff so it stays that way. This is a mechanical change, and the commit is listed in .git-blame-ignore-revs.
  3. Start docstrings on the opening quote line with a one-line summary. Summaries that were wrapped over several lines or too long for one line are shortened, and the rest of the text moves into the description below. No code changes: comparing the ASTs with docstrings removed shows no difference. A few docstrings were reworded to fit, and the descriptions of csv_to_wfdb and csv2ann (which described reading a WFDB header) now match what the functions do. Also listed in .git-blame-ignore-revs.
  4. Move the package to src/wfdb. This is the default module root of uv_build, so the module-root setting is removed. The tests now always run against the installed package, and docs/conf.py adds src to sys.path. Files are moved without changes, so git blame and git log --follow keep working. The wheel and the sdist build as expected.
  5. Ignore the two reformatting commits in git blame, and add a note about the docstring style to DEVELOPING.md. The hashes stay valid with a merge commit, as in Replace black and pylint with Ruff #582.
  6. Add AGENTS.md and CLAUDE.md with short guidance for coding agents (commands and conventions). CLAUDE.md only points to AGENTS.md.

Checked locally: Ruff lint and format, the docs build with -W --keep-going, and the tests that work offline on Python 3.11 with the lowest dependencies and on 3.15.

@tompollard this concludes the tooling and infrastructure refresh. Any remaining changes are minor, such as fixing the ignored Ruff rules, which can be done later in follow-up PRs.

cbrnr added 6 commits October 28, 2026 21:50
The docs build reported 94 warnings. Fix them and make the docs workflow
fail on warnings (-W --keep-going) so they do not come back.

- Mark repeated automodule directives and the classes that are documented
  both on the wfdb and io pages as :no-index:, so each object is indexed
  once (duplicate object descriptions). This option requires Sphinx 7.2,
  so raise the pinned Sphinx version of the docs group from 7.0.0 to 7.2.6.
- Do not link the numpydoc method tables to autosummary stubs, which do
  not exist (numpydoc_class_members_toctree = False).
- Fix too short title underlines.
- Fix reStructuredText in docstrings: blank lines before lists, literal
  blocks for the EDF/MATLAB/WAV format descriptions, label and class
  tables, the rdedfann dictionary and the gqrs_detect pseudo-code, and
  "..." continuation lines in doctest examples (which also fixes a typo
  in a csv_to_wfdb example).
- Rename the "Examples:" and "Example" docstring sections to the section
  name numpydoc knows ("Examples").

No code is changed.
Docstrings and comments were wrapped inconsistently, with 86 lines over
the 88 columns used for the code. Rewrap them and enforce the limit with
ruff (W505, max-doc-length = 88).

- Prose comments and docstrings are reflowed.
- Long shell commands in the test docstrings, doctest examples, the EDF
  specification tables, the AnnotationLabel examples and commented-out
  code are split over several lines.
- The EDF+ annotation table in the rdedfann docstring is now a literal
  block like the other format descriptions.
- Fix a few typos in the lines that were touched ("thee", "mooth",
  "enfore").

No code is changed.
Put the summary directly after the opening quotes instead of on the next
line, and make it a single line. Summaries that were wrapped over several
lines or were too long for one line are shortened, and the remaining text
moves into the extended description below it. Lists in the first paragraph
are now separated from the text by a blank line.

Only docstrings change. Fix a few typos on the way ("suration", a doubled
period) and make the descriptions of the CSV converters accurate.
Move wfdb/ to src/wfdb/, which is the default module root of uv_build, so
the module-root setting is no longer needed. The tests now always run
against the installed package instead of the copy in the working
directory, and the documentation build adds src/ to sys.path.
@cbrnr
cbrnr requested a review from tompollard October 28, 2026 20:54
@tompollard

Copy link
Copy Markdown
Member

Very cool, thanks for the huge clean up! One minor thing: the new summary of csv_to_wfdb says "A record and header file are written if write_dir is set", but the files are written whenever record_only is False (into the current directory if write_dir is empty).

@cbrnr

cbrnr commented Oct 28, 2026

Copy link
Copy Markdown
Contributor Author

I'll fix this tomorrow! Going to bed now!

@tompollard

Copy link
Copy Markdown
Member

Sleep well, and thanks again! I'm going to merge and we can update as needed later.

@tompollard
tompollard merged commit b8914e1 into MIT-LCP:main Oct 28, 2026
18 checks passed
@tompollard

Copy link
Copy Markdown
Member

Raised issue here: #590

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.

2 participants